How to use selianize - 10 common examples

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
: [],
          modulePaths: parseModulePath(path.join(__dirname, '../node_modules')),
          setupFilesAfterEnv: [
            require.resolve('jest-environment-selenium/dist/setup.js'),
          ],
          testEnvironment: 'jest-environment-selenium',
          testEnvironmentOptions: configuration,
        },
        dependencies: project.dependencies || {},
      },
      null,
      2
    )
  )

  return Selianize(project, { silenceErrors: true }, project.snapshot).then(
    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)),
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 => {
github SeleniumHQ / selenium-ide / packages / selenium-ide-extension / src / api / v1 / export.js View on Github external
router.get('/location', (req, res) => {
  Location.emit(req.location).then(res)
})
github SeleniumHQ / selenium-ide / packages / selenium-ide / src / neo / IO / filesystem.js View on Github external
return Manager.validatePluginExport(project).then(() => {
    return Selianize(project, { silenceErrors: true, skipStdLibEmitting: true }).catch(err => {
      const markdown = ParseError(err && err.message || err);
      ModalState.showAlert({
        title: "Error saving project",
        description: markdown,
        confirmLabel: "Download log",
        cancelLabel: "Close"
      }, (choseDownload) => {
        if (choseDownload) {
          browser.downloads.download({
            filename: project.name + "-logs.md",
            url: createBlob("text/markdown", markdown),
            saveAs: true,
            conflictAction: "overwrite"
          });
        }
      });
github SeleniumHQ / selenium-ide / packages / selenium-ide-extension / src / neo / IO / filesystem.js View on Github external
return Manager.validatePluginExport(project).then(() => {
    return Selianize(project, {
      silenceErrors: true,
      skipStdLibEmitting: true,
    }).catch(err => {
      const markdown = ParseError((err && err.message) || err)
      ModalState.showAlert({
        title: 'Error saving project',
        description: markdown,
        confirmLabel: 'download log',
        cancelLabel: 'close',
      }).then(choseDownload => {
        if (choseDownload) {
          browser.downloads.download({
            filename: project.name + '-logs.md',
            url: createBlob('text/markdown', markdown),
            saveAs: true,
            conflictAction: 'overwrite',
github SeleniumHQ / selenium-ide / packages / selenium-ide-extension / src / neo / IO / filesystem.js View on Github external
}).catch(err => {
      const markdown = ParseError((err && err.message) || err)
      ModalState.showAlert({
        title: 'Error saving project',
        description: markdown,
        confirmLabel: 'download log',
        cancelLabel: 'close',
      }).then(choseDownload => {
        if (choseDownload) {
          browser.downloads.download({
            filename: project.name + '-logs.md',
            url: createBlob('text/markdown', markdown),
            saveAs: true,
            conflictAction: 'overwrite',
          })
        }
      })
      return Promise.reject()
github SeleniumHQ / selenium-ide / packages / selenium-ide / src / neo / IO / filesystem.js View on Github external
return Selianize(project, { silenceErrors: true, skipStdLibEmitting: true }).catch(err => {
      const markdown = ParseError(err && err.message || err);
      ModalState.showAlert({
        title: "Error saving project",
        description: markdown,
        confirmLabel: "Download log",
        cancelLabel: "Close"
      }, (choseDownload) => {
        if (choseDownload) {
          browser.downloads.download({
            filename: project.name + "-logs.md",
            url: createBlob("text/markdown", markdown),
            saveAs: true,
            conflictAction: "overwrite"
          });
        }
      });
      return Promise.reject();
github SeleniumHQ / selenium-ide / packages / selenium-ide / src / plugin / manager.js View on Github external
constructor() {
    this.plugins = []
    RegisterConfigurationHook(project => {
      return new Promise(res => {
        Promise.all(
          this.plugins.map(plugin =>
            this.emitConfiguration(plugin, project).catch(_e => {
              return ''
            })
          )
        ).then(configs => res(configs.join('')))
      })
    })
  }
github SeleniumHQ / selenium-ide / packages / selenium-ide / src / plugin / manager.js View on Github external
plugin.commands.forEach(({ id, name, type, docs }) => {
          const doks = this.useExistingArgTypesIfProvided(
            Object.assign({}, docs, {
              plugin: {
                id,
              },
            })
          )
          Commands.addCommand(id, { name, type, ...doks })
          registerCommand(id, RunCommand.bind(undefined, plugin.id, id))
          RegisterEmitter(id, this.emitCommand.bind(undefined, plugin, id))
        })
      }
github SeleniumHQ / selenium-ide / packages / selenium-ide / src / plugin / manager.js View on Github external
registerPlugin(plugin) {
    if (!this.hasPlugin(plugin.id)) {
      plugin.canEmit = false
      this.plugins.push(plugin)
      RegisterSuiteHook(this.emitSuite.bind(undefined, plugin))
      RegisterTestHook(this.emitTest.bind(undefined, plugin))
      if (plugin.commands) {
        plugin.commands.forEach(({ id, name, type, docs }) => {
          const doks = this.useExistingArgTypesIfProvided(
            Object.assign({}, docs, {
              plugin: {
                id,
              },
            })
          )
          Commands.addCommand(id, { name, type, ...doks })
          registerCommand(id, RunCommand.bind(undefined, plugin.id, id))
          RegisterEmitter(id, this.emitCommand.bind(undefined, plugin, id))
        })
      }
    } else {