@telus/telus-nightwatch-commands

2.12.1 • Public • Published

Telus Nightwatch Commands

version

Nightwatch custom commands for Telus Digital

Setup

This library was generated with @telus/create-library. In order for your library to handle version management and releases automatically, please make sure you set up the NPM_TOKEN inside the Github actions workflow, following the instructions here.

Install

npm install @telus/telus-nightwatch-commands

Configure your E2E Environment

In nightwatch.conf.js, modify the CUSTOM_COMMANDS and CUSTOM_ASSERTIONS value to include the Telus nightwatch custom commands, ie

const CUSTOM_COMMANDS = [
  path.join(__dirname, 'node_modules', '@telus/nightwatch-visual', 'commands'),
  path.join(__dirname, 'node_modules', '@telus/telus-nightwatch-commands', 'commands')
]
const CUSTOM_ASSERTIONS = [
  path.join(__dirname, 'node_modules', '@telus/nightwatch-visual', 'assertions'),
  path.join(__dirname, 'node_modules', '@telus/telus-nightwatch-commands', 'assertions')
]

And set the environment variable accessibilityTestingEnabled to true

  test_settings: {
    default: {
      globals: {
        accessibilityTestingEnabled: true
      }
    }
  }

Use the commands in your E2E Tests

  1. To call the login method from your test code, pass in the url for loginUrl from any authenticated page as the follows:
    browser.url('https://www.telus.com/my-telus') // example url, visit any authenticated page on Telus.
    browser.url((response) => {
      const loginUrl = response.value
      browser.login({
        username,
        password,
        returnUrl: 'https://www.telus.com/my-telus', // example url, use the page url you want to visit after login action
        loginUrl,
        oauthCookie: 'oauthCookieName', // environment specific, see note below.
        sessionCookie: 'sessionCookieName',
        isDevelopment: false // set to true is run locally
      })
    })

Note: oauth and session cookie names are specific to the environment you're trying to log into.

Environment Value
Staging oauthCookie = 'OAuth2TokenStage'
sessionCookie = 'SessionTokenStage'
Production oauthCookie = 'OAuth2Token'
sessionCookie = 'SessionToken'
  1. To call the Accessibility scan from your test code, call the command when the driver is on a page as the follows:
    browser
      .url(url, () => {
        browser.assert.urlEquals(url)
      })
      .accessibility({
        pageName: 'Hello World',
        root: '#app',
        rules: {
          'color-contrast': { enabled: true }
        },
        runOnly: {
          type: "tag",
          values: ["wcag2a", "wcag2aa"]
        },
        verbose: false,
        timeout: 5000
      })

Note: None of the parameters are mandatory, the command can be called like this:

    browser.accessibility()
  1. To use the custom console log command, call the command as the follow:
    browser.log('Successfully logging a message.')
  1. To use the custom removeMyTelusSurvey command, call the command as follows:
    browser.removeMyTelusSurvey()
  1. To use the getOneTimePasscode command, call the command as follows:
    const rackspaceAuthentication = {
      user: `${process.env.RACKSPACE_USER}`,
      pass: `${process.env.RACKSPACE_PASS}`
    }
    browser.getOneTimePasscode(rackspaceAuthentication, (result) => {
      browser.log(`One Time Passcode is ${result.value}`)
    })

Note: Environment variables can be set locally by executing set-env.sh script. Need for such a shippy-user access with a read policy from any My TELUS tribe.

Note: Environment can be set in an Openshift project by using the standard method used in the my-telus-e2e project.

  1. To use the restoreDevice command, call the command from any authenticated page as follows:
    browser.restoreDevice({
      ban,
      sub
    })
  1. To use the changeEmail command, call the command from any authenticated page as follows:
    browser.changeEmail('newEmail')
  1. To use the setBillFormat command, call the command from any authenticated page as follows:
    browser.changeEmail({
      ban,
      emailAddress
    })

Github: @telus • Twitter: @telusdigital

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.12.1
    7
    • latest

Version History

Package Sidebar

Install

npm i @telus/telus-nightwatch-commands

Weekly Downloads

18

Version

2.12.1

License

ISC

Unpacked Size

45.6 kB

Total Files

32

Last publish

Collaborators

  • pdufault
  • telusdigitaldelivery
  • stv-telus