Launch Week Day 2: Introducing Reports: An Extensible Reporting Framework for Socket Data.Learn More
Socket
Book a DemoSign in
Socket

@telus/telus-nightwatch-commands

Package Overview
Dependencies
Maintainers
18
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@telus/telus-nightwatch-commands

Nightwatch custom commands for Telus Digital

latest
Source
npmnpm
Version
2.12.1
Version published
Weekly downloads
87
278.26%
Maintainers
18
Weekly downloads
 
Created
Source

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

  • 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.

EnvironmentValue
StagingoauthCookie = 'OAuth2TokenStage'
sessionCookie = 'SessionTokenStage'
ProductionoauthCookie = 'OAuth2Token'
sessionCookie = 'SessionToken'
  • 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()
  • To use the custom console log command, call the command as the follow:
    browser.log('Successfully logging a message.')
  • To use the custom removeMyTelusSurvey command, call the command as follows:
    browser.removeMyTelusSurvey()
  • 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.

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

Github: @telus • Twitter: @telusdigital

Keywords

telus

FAQs

Package last updated on 02 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts