How to use the selianize.getUtilsFile function in selianize

To help you get started, we’ve selected a few selianize 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 SeleniumHQ / selenium-ide / packages / selenium-side-runner / src / index.js View on Github external
code => {
      const tests = code.tests
        .reduce((tests, test) => {
          return (tests += test.code)
        }, 'const utils = require("./utils.js");const tests = {};')
        .concat('module.exports = tests;')
      writeJSFile(path.join(projectPath, 'commons'), tests, '.js')
      writeJSFile(path.join(projectPath, 'utils'), getUtilsFile(), '.js')
      code.suites.forEach(suite => {
        if (!suite.tests) {
          // not parallel
          const cleanup = suite.persistSession
            ? ''
            : 'beforeEach(() => {vars = {};});afterEach(async () => (cleanup()));'
          writeJSFile(
            path.join(projectPath, sanitizeFileName(suite.name)),
            `// This file was generated using Selenium IDE\nconst tests = require("./commons.js");${
              code.globalConfig
            }${suite.code}${cleanup}`
          )
        } else if (suite.tests.length) {
          fs.mkdirSync(path.join(projectPath, sanitizeFileName(suite.name)))
          // parallel suite
          suite.tests.forEach(test => {