How to use the @qawolf/config.CONFIG.domPath function in @qawolf/config

To help you get started, we’ve selected a few @qawolf/config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github qawolf / qawolf / packages / runner / src / Runner.ts View on Github external
public static async create(workflow: Workflow) {
    /**
     * An async constructor for Runner.
     */
    logger.verbose(`Runner: create for ${workflow.name}`);

    const self = new Runner();

    // replace the url w/ env variable if it exists
    workflow.url = getUrl(workflow);

    const options: BrowserCreateOptions = { size: workflow.size };
    if (CONFIG.domPath) options.domPath = `${CONFIG.domPath}/${workflow.name}`;

    self._browser = await Browser.create(options);
    self._envValues = getEnvValues(workflow);
    self._workflow = workflow;

    if (CONFIG.videoPath) {
      const device = self._browser.device;

      self._screenCapture = await ScreenCapture.start({
        offset: {
          x: CONFIG.chromeOffsetX,
          y: CONFIG.chromeOffsetY
        },
        savePath: `${CONFIG.videoPath}/${workflow.name}`,
        size: {
          height: device.viewport.height,
github qawolf / qawolf / packages / browser / src / browser / QAWolfBrowser.ts View on Github external
public get domPath() {
    const path = this._options.domPath || CONFIG.domPath;
    if (!path) return;

    // name the dom path based on the main script filename
    // ex. /login.test.js/page_0.html
    return `${path}/${basename(require.main!.filename)}`;
  }
github qawolf / qawolf / packages / cli / src / record.ts View on Github external
export const record = async (options: RecordOptions): Promise => {
  const Listr = require("listr");
  const input = require("listr-input");

  const { name } = options;

  const browser = await launch({
    device: options.device,
    domPath: CONFIG.domPath ? `${CONFIG.domPath}/${name}` : undefined,
    recordEvents: true,
    timeout: 0,
    url: options.url.href
  });

  const qawolfPath = `${process.cwd()}/.qawolf`;

  const saveJson = (type: string, data: any) => {
    const path = `${qawolfPath}/${type}/${name}.json`;
    logger.verbose(`save ${path}`);
    return outputJson(path, data, { spaces: " " });
  };

  const codeFileName = options.test ? `${name}.test.js` : `${name}.js`;

  const codePath = options.test