How to use the @seleniumhq/side-model.Commands.find function in @seleniumhq/side-model

To help you get started, we’ve selected a few @seleniumhq/side-model 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 / side-utils / src / code-export / emit.js View on Github external
function validateCommand(command) {
  const commandName = command.command
  if (!commandName.startsWith('//')) {
    let commandSchema = Commands.find(cmdObj => cmdObj[0] === commandName)
    if (commandSchema) commandSchema = commandSchema[1]
    else throw new Error(`Invalid command '${commandName}'`)
    if (!!commandSchema.target !== !!command.target) {
      const isOptional = !!commandSchema.target.isOptional
      if (!isOptional) {
        throw new Error(
          `Incomplete command '${
            command.command
          }'. Missing expected target argument.`
        )
      }
    }
    if (!!commandSchema.value !== !!command.value) {
      const isOptional = !!commandSchema.value.isOptional
      if (!isOptional) {
        throw new Error(

@seleniumhq/side-model

Selenium IDE shared models

Apache-2.0
Latest version published 4 months ago

Package Health Score

86 / 100
Full package analysis

Similar packages