gqa-automation

1.0.0 • Public • Published

Table of Contents

gqa-automation


Installation


  • Clone repository using ssh
git clone git@github.com:wbd-streaming/gqa-automation.git

SSH installation is needed for the installation of dependencies. If you set up via https your bundle install will fail.

If you have problems cloning via SSH you can try the following

brew install gh
gh auth login

If you need to reset your repository from https to ssh, or check if it is set to ssh please follow this link

  • Install NVM
  • Install latest node LTS. node version to > 16.0 is required
nvm install --lts
nvm use --lts
nvm list
  • Setup Jfrog by following the instructions here
  • If you are having problems with jfrog installation fallback instructions can be found here
  • Install NPM by running npm install
  • Install Xcode tools xcode-select --install
  • Install additional packages required by tesseract brew install pkg-config cairo pango libpng jpeg giflib librsvg

If you are having issues, try running

  • Install Xcode tools xcode-select --install
  • Install additional packages required by tesseract brew install pkg-config cairo pango libpng jpeg giflib librsvg prior to running
  • Install NPM by running npm install

Android Installation


Local Setup is not necessary for development but can be useful to speed up development times.

FireTV/AndroidTV Installation

iOS Installation


Local Setup is not necessary for development but can be useful to speed up development times.


tvOS Installation

Web Installation



Suitest Installation


Roku Installation
Samsung Installation
LG Installation
Xbox Installation

Gherkin Style

We follow a Gherkin style guide which is enforced by the gherkin lint package and can be found here. It's exact configuration for this project can be found here

You can run the lint:gherkin command locally (either yarn lint:gherkin or npm run lint:gherkin). You can use jake comand npx gherkin-lint

JS Standards


Our standards for linting, unit tests and threshold tests can be found here

JS Styleguide

We follow the airbnb/js style guide which can be found here

JS Doc


Node modules dependency graph


Dependency graph The above link provides access to the dependency graph, which offers both image and tabular views of the node module dependencies within shown repos. The graph specifically shows dependencies that belong to our organization.

Please note, however, that it only captures dependencies where the Git repository and the name specified in the package.json of each package match.

For further details, please refer Dependency Graph Generation Process


TODO

Running


From Command Line


Command Line - Jake tasks

Jake tasks are the recommended way of executing test scripts in parallel. They leveraged by our entrypoint.sh script and orange dot pipelines. This allows our pipelines to have a common interface to execute tests across teams.

How tasks are created

Test runs can be triggered from the command line by using Jake tasks. Jake tasks are programmatically made in the jakefile.js file. Every Product folder under projects is created as a namespace, every client folder under the product is a task.

For the following project structure:

── projects
│   ├── ATVE
│   │   ├── roku
│   │   ├── samsung
│   │   └── xbox
│   └── DTC
│       ├── android
│       ├── androidtv
│       ├── appletv
│       ├── features
│       ├── firetab
│       ├── firetv
│       ├── ios
│       ├── ipad
│       ├── lg
│       ├── roku
│       ├── samsung
│       ├── web
│       └── xbox
How to check available tasks

The following tasks will be created:

jake ATVE:roku[...features]                                       # ATVE roku
jake ATVE:samsung[...features]                                    # ATVE samsung
...
...
jake BEAM:android[...features]                                    # BEAM android
jake BEAM:appletv[...features]                                    # BEAM appletv
jake BEAM:firetab[...features]                                    # BEAM firetab
jake BEAM:ios[...features]                                        # BEAM ios
jake BEAM:lg[...features]                                         # BEAM lg
...
...
jake DTC:android[...features]                                     # DTC android
jake DTC:androidtv[...features]                                   # DTC androidtv
jake DTC:appletv[...features]                                     # DTC appletv
jake DTC:firetab[...features]                                     # DTC firetab
jake DTC:firetv[...features]                                      # DTC firetv
jake DTC:ios[...features]                                         # DTC ios
...
jake browserstack:isAutomateUnderBsUsage                          # browserstack: Returns true if the automate is under browserstack usage
jake browserstack:isAppUnderBsUsage                               # browserstack: Returns true if the app is under browserstack usage
jake browserstack:bsAppUploadedAppsList                           # browserstack: List all uploaded apps
jake browserstack:uploadApp[filePath]                             # browserstack: Upload app
jake browserstack:uploadAppWithCustomId[filePath,customId]        # browserstack: Upload app with custom id
jake browserstack:deleteApp[appID]                                # browserstack: Delete app
...
jake headspin:uploadedApks                                        # HeadSpin-Appium: Gets list of uploaded apk(s)
jake headspin:uploadApk[filePath]                                 # HeadSpin-Appium: Upload apk
jake headspin:deleteApk[apkAppID]                                 # HeadSpin-Appium: Delete apk
jake headspin:uploadedApkPackageNames                             # HeadSpin-Appium: List all uploaded APKs' package names
jake headspin:apkAppInfo[apkAppID]                                # HeadSpin-Appium: APK's app information
jake headspin:listAllAdbDevicesByModel[deviceModel]               # HeadSpin-Appium: List all ADB devices by model
jake headspin:installApk[deviceID,apkAppID]                       # HeadSpin-Appium: Install apk on device
jake headspin:uninstallApk[deviceID,packageName]                  # HeadSpin-Appium: Uninstall apk-package on device
jake headspin:installApkOnAllAndroidTvDevices[apkAppID]           # HeadSpin-Appium: Install apk on all Android TV device
jake headspin:installApkOnAllFireTabDevices[apkAppID]             # HeadSpin-Appium: Install apk on all Fire Tab device
jake headspin:installApkOnAllFireTvDevices[apkAppID]              # HeadSpin-Appium: Install apk on all Fire Tv device
jake headspin:uninstallApkOnAllAndroidTvDevices[packageName]      # HeadSpin-Appium: Uninstall apk-package on all Android TV device
jake headspin:uninstallApkOnAllFireTabDevices[packageName]        # HeadSpin-Appium: Uninstall apk-package on all Fire Tab device
jake headspin:uninstallApkOnAllFireTvDevices[packageName]         # HeadSpin-Appium: Uninstall apk-package on all Fire Tv device
jake headspin:uploadedIpas                                        # HeadSpin-Appium: Gets list of uploaded ipa(s)
jake headspin:uploadIpa[filePath]                                 # HeadSpin-Appium: Upload ipa
jake headspin:deleteIpa[ipaAppID]                                 # HeadSpin-Appium: Delete ipa
jake headspin:uploadedIpaBundleIdentifiers                        # HeadSpin-Appium: List all uploaded IPAs' bundle identifiers
jake headspin:ipaAppInfo[ipaAppID]                                # HeadSpin-Appium: IPA's app information
jake headspin:listAlliDevicesByModel[deviceType]                  # HeadSpin-Appium: List all i-devices by model 'AppleTV'
jake headspin:installIpa[deviceID,ipaAppID]                       # HeadSpin-Appium: Install ipa on device
jake headspin:uninstallIpa[deviceID,ipaAppID]                     # HeadSpin-Appium: Uninstall Ipa on device
jake headspin:installIpaOnAllAppleTvDevices[ipaAppID]             # HeadSpin-Appium: Install ipa on all Apple TV device
jake headspin:uninstallIpaOnAllAppleTvDevices[ipaAppID]           # HeadSpin-Appium: Uninstall ipa app on all Apple TV device
jake headspin:uploadAppWithTag[filePath,appTag]                   # HeadSpin-Appium: Upload app (apk/ipa) with tag
jake headspin:listAllAdbDeviceAddressByModel[deviceModel]         # HeadSpin-Appium: Lists device address for adb devices by model
jake headspin:listAlliDeviceAddressByModel[deviceType]            # HeadSpin-Appium: Lists device address for iDevices by type, ex: 'AppleTV'
jake headspin:deviceCleaning[deviceAddress]                       # HeadSpin-Appium: Clean device data using device address
jake headspin:cleanAllAdbDevicesByModel[deviceModel]              # HeadSpin-Appium: Cleans all adb devices using device model
jake headspin:cleanAlliDevicesByModel[deviceType]                 # HeadSpin-Appium: Cleans all iDevices using device type, ex: 'AppleTV'
jake headspin:listAllUploadedAppsV1                               # HeadSpin-V1: List all app(s) uploaded
jake headspin:uploadAppV1[filePath]                               # HeadSpin-V1: Upload app
jake headspin:uploadAppWithTagV1[filePath,appTag]                 # HeadSpin-V1: Upload app with tag
jake headspin:appInfoV1[appID]                                    # HeadSpin-V1: Get app's information
jake headspin:listAppMetaDataKeysV1                               # HeadSpin-V1: List all meta data keys for app
jake headspin:updateAppMetaDataV1[appID,metaKey,metaValue]        # HeadSpin-V1: Update app meta data with appID, key, value
jake headspin:deleteAppV1[appID]                                  # HeadSpin-V1: Delete app
jake headspin:installAppV1[deviceID,appID]                        # HeadSpin-V1: Install app on device
jake headspin:uninstallAppV1[deviceID,appID]                      # HeadSpin-V1: Uninstall app on device
jake headspin:getNetworkEndpoints[deviceAddress]                  # HeadSpin: List network end points for given device
jake headspin:getNetworkConfig[deviceAddress]                     # HeadSpin: Get network config for given device
jake headspin:setNetworkConfig[deviceAddress,downBandwidth,upBandwidth,latency,dropRate] # HeadSpin: Set network config for given device
jake headspin:resetNetworkConfig[deviceAddress]                   # HeadSpin: Reset/delete network config for given device
jake jFrog:uploadBuildToHeadspinFromJfrog                         # Downloads latest build from JFrog and uploads to headspin
...
jake utils:clean_logs                                             # Empties the logs directory
...
jake utils:report                                                 # Create Cucumber Report

You can see all available jake tasks by running npx jake --tasks or npx jake -t from the command line

Checking underlying cucumber commands

When running a jake task you will be able to see the cucumber CLI command that is being programatically created in your console logs. If you are facing issues with your execution try running the underlying cucumber command directly to verify the cucumber-js commands are made correctly.

> ~/D/D/gqa-automation on github_actions ⨯ npx jake DTC:android                                               17:37:59
Starting 'DTC:android'...
exeucuting command:
npx cucumber-js /Users/mswiss/Documents/Discovery/gqa-automation/projects/DTC/android/features/*
--parallel 0
--require-module /Users/mswiss/Documents/Discovery/gqa-automation/cucumber.js

Command Line - Report Generation

You can generate report by using below mentioned command

npx jake utils:report

Command Line - Cucumber CLI

You can also run your tests directly using cucumber CLI

npx cucumber-js /Users/mswiss/Documents/Discovery/gqa-automation/projects/DTC/android/features/*
--parallel 0
--require-module /Users/mswiss/Documents/Discovery/gqa-automation/cucumber.js

From Github Actions

Test runs for your branch can be executed via github actions using the Run Tests job. Instructions can be found here

Orange Dot Integration

Tests can be integrated into your build and deploy pipeline for your external repo. Instructions can be found here

Release Tooling Event Bus

TODO


Patterns


Project Layout

Locator Definitions

HeadSpin Network capabilities

Best Practices

Debugging

Configuring IDE Debugger


Git remote reset

Checking for ssh setup

git remote -v will give you an output showing the repo with a git@github.com: prefix.

Example Screen Shot 2022-07-26 at 11 57 04 AM

If you see origin https://github.com please follow the instructions here to modify your remote settings


Frequently Asked Questions


  1. How to fix chromedriver version error?
SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 105 Current browser version is 107.0.5304.110 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
  • Raise a bug in jira and assign it to QE team
  • Unblock yourself locally by following these steps
    • Add latest chromedriver dependency which is compatible with latest chrome in package.json

      "dependencies": {
        ...
        "@wbd/gqa-core": "1.0.0",
        "chromedriver": "^107.0.3", // compatible with latest chrome version
      },
    • Add overrides object in package.json

      "dependencies": {
        ...
        "@wbd/gqa-core": "1.0.0",
        "chromedriver": "^107.0.3", // compatible with latest chrome version
      },
      "overrides": {
        "chromedriver": "$chromedriver"
      }
    • Finally, run these commands

      rm package-lock.json
      rm -rf ./node_modules/
      npm install
      

Guide to .env parameters


Required for Browser stack execution, Headspin-Suitest execution

Android TV .env params

Provide adequate values to excute test(s) for Android TV (Local/HeadSpin),. Mandatory params - *

  • PROJECT: * Project value DTC/ATVE
  • PLATFORM: * Platform name "appium"
  • DEBUG: Debug value for execution 'true/false'
  • GEO: * Geo location 'gb/us/ca,..'
  • DEVICE: * Device name "androidtv"
  • HS_TOKEN: * Headspin token used for doing any API calls to the Headspin APIs. It can be obtained from the settings page. (applicable for Headspin execution)
  • CUCUMBER_TAG: Cucumber tag to run specific scenarios.
  • LOCAL_EXECUTION: * Local execution value 'true/false'
  • DTC_ANDROID_APP_PACKAGE: * Android app package details
  • APP_ACTIVITY: * Application activity information
  • UDID: * Unique device ID.(to specify particular device)
  • SERVER_URL: * Local Appium server url (applicable for local execution)

Apple TV .env params

Provide adequate values to excute test(s) for Apple TV (Local/HeadSpin),. Mandatory params - *

  • PROJECT: * Project value DTC/ATVE
  • PLATFORM: * Platform name "appium"
  • DEBUG: Debug value for execution 'true/false'
  • GEO: * Geo location 'gb/us/ca,..'
  • DEVICE: * Device name "androidtv"
  • HS_TOKEN: * Headspin token used for doing any API calls to the Headspin APIs. It can be obtained from the settings page. (applicable for Headspin execution)
  • CUCUMBER_TAG: Cucumber tag to run specific scenarios.
  • LOCAL_EXECUTION: * Local execution value 'true/false'
  • BUNDLE_ID: * Bundle ID for aplication.
  • OS_VERSION: Platform Version for tvOS
  • UDID: * Unique device ID.(to specify particular device)
  • SERVER_URL: * Local Appium server url (applicable for local execution)

Fire Tab .env params

Provide adequate values to excute test(s) for Fire Tab (Local/HeadSpin),. Mandatory params - *

  • PROJECT: * Project value DTC/ATVE
  • PLATFORM: * Platform name "appium"
  • DEBUG: Debug value for execution 'true/false'
  • GEO: * Geo location 'gb/us/ca,..'
  • DEVICE: * Device name "firetab"
  • HS_TOKEN: * Headspin token used for doing any API calls to the Headspin APIs. It can be obtained from the settings page. (applicable for Headspin execution)
  • CUCUMBER_TAG: Cucumber tag to run specific scenarios.
  • LOCAL_EXECUTION: * Local execution value 'true/false'
  • DTC_ANDROID_APP_PACKAGE: * Android app package details
  • APP_ACTIVITY: * Application activity information
  • AUTO_ACCEPT_ALERTS: Auto accept alerts 'true/false'
  • UDID: * Unique device ID.(to specify particular device)
  • SERVER_URL: * Local Appium server url (applicable for local execution)

Fire TV .env params

Provide adequate values to excute test(s) for Fire TV (Local/HeadSpin),. Mandatory params - *

  • PROJECT: * Project value DTC/ATVE
  • PLATFORM: * Platform name "appium"
  • DEBUG: Debug value for execution 'true/false'
  • GEO: * Geo location 'gb/us/ca,..'
  • DEVICE: * Device name "firetv"
  • HS_TOKEN: * Headspin token used for doing any API calls to the Headspin APIs. It can be obtained from the settings page. (applicable for Headspin execution)
  • CUCUMBER_TAG: Cucumber tag to run specific scenarios.
  • LOCAL_EXECUTION: * Local execution value 'true/false'
  • DTC_ANDROID_APP_PACKAGE: * Android app package details
  • APP_ACTIVITY: * Application activity information
  • AUTO_ACCEPT_ALERTS: Auto accept alerts 'true/false'
  • UDID: * Unique device ID.(to specify particular device)
  • SERVER_URL: * Local Appium server url (applicable for local execution)

Web .env params

Provide adequate values to excute test(s) for Web. Mandatory params - *

  • PROJECT: * Project value DTC/ATVE
  • PLATFORM: * Platform name "webdriver"
  • DEBUG: Debug value for execution 'true/false'
  • GEO: * Geo location 'gb/us/ca,..'
  • DEVICE: * Device name "web"
  • CUCUMBER_TAG: Cucumber tag to run specific scenarios.
  • LOCAL_EXECUTION: * Local execution value 'true/false'
  • PARALLEL: * Cucumber parallel excution value (1-10)
  • SERVER_URL: * Browser stack server url / Local server url
  • BS_USER: * Browser stack user value
  • BS_KEY: * Browser stack password value
  • BROWSER: Browser type/name 'Chrome/..'
  • BROWSER_VERSION: Browser version '95.0/..'
  • PREFERRED_OS: OS preference 'Windows 11/OS X/...'
  • OS_VERSION: Version for preferred OS
  • NAME: Name for your session/test case
  • BS_PROJECT: Project Name in Browser Stack
  • BUILD: Build name - Executions/session will be listed under this name
  • URL: * Redirection URL -> prod/init url
  • LOGIN_DTC: * Web Server username
  • PASSWORD_DTC: * Web Server password
  • AUTO_ACCEPT_ALERTS: Auto accept alerts 'true/false'

Roku .env params(Appium)

Provide adequate values to excute test(s) for Web. Mandatory params - * Local Execution mandatory params #

  • HS_TOKEN Headspin token used for doing any API calls to the Headspin APIs. It can be obtained from the settings page. (applicable for Headspin execution)
  • PARALLEL: Set the number for parallel threads.
  • PROJECT: * Project value BEAM
  • PLATFORM: * Platform name "appium"
  • GEO: * Geo location 'gb/us/ca,..'
  • DEVICE: * Device name "roku"
  • CUCUMBER_TAG: Cucumber tag to run specific scenarios.
  • LOCAL_EXECUTION: * Local execution value 'true/false'
  • LOCAL_HOST: # Local appium server ip address
  • LOCAL_PORT: # Local appium server port
  • ROKU_HOST: # Local roku device ip address
  • ROKU_USER: # Local Roku developer user name
  • ROKU_PASS: # Local Roku developer password
  • ROKU_APP_PATH: # Local roku build path
  • HEADSPIN_APP: * App id for installing build in headspin
  • UDID: Unique device ID.(to specify particular device on headspin)
  • HS_SELECTOR: Headspin device selectors

Headspin - Suitest Execution

Please provide details for all the parameters listed below to execute on headspin using Suitest.

  • HS_TOKEN Headspin token used for doing any API calls to the Headspin APIs. It can be obtained from the settings page. (applicable for Headspin execution)

  • IS_HEADSPIN_SUITEST: Set it as true to execute on headspin else false for local execution.

  • PARALLEL: Set the number for parallel threads. Make sure number should match with remoteDevices.json file count for the specific region. Ex: PARALLEL=3 will run on 2 threads. Max limit is 5.

  • SUITEST_TOKEN_KEY: Suitest Token ID/Key

  • SUITESTS_TOKEN_PASSWORD: Suitest Token Password

  • SUITEST_APP_CONFIG_ID: App config id you would like to run a test against

  • SUITEST_LOG_LEVEL: Log level defined for Suitest logs, debug value recommended.

  • SUITEST_DEVICE_ID: suitest id of your local device, used for local execution then set IS_HEADSPIN_SUITEST = false

  • GEO: country code used to define the region in which devices in Headspin will be located, refer to devices.json file. This is also Required for getting the data from yml files

  • DEVICE: The Device to ensure which pageobject to fetch for execution while execution(eg. 'SAMSUNG','XBOX','LG' or 'ROKU')

  • MODEL: Here we provide the Device Model Year so that we can handle the keyboard operations from our code. (eg. "samsung21" or "lg")

  • Follow this wiki guide which goes through the process of obtaining each value in this file. Note: Make sure not to add comments into this file, they will create parsing issues.

For more details on Suitest API and SDK, the following links are official Suitest docs which are very helpful.

.env Enviromental variables used in the project


Support Model



Data validation support


Events Data Validation Automation wiki page

Usage/how to? refernce document


Multi-Region Object repo sample

Please find the sample object.yml for all type of input to maintain for multi org support.

  • sample Object.yml file
menuPage:
  focusedMenuBar: [{
      default: { xpath: "//*[@id='DTCMenuComponent' and @isFocused='true']" },
      us: { xpath: "sampleFocusedMenuBar_US" }
  }]
  accountMenu_lbl: [{
      default: { xpath: "//android.widget.FrameLayout[@content-desc='Account']" },
      gb: { xpath: "SampleAccountMenu_GB" }
  }]
  accountMenu_Btn: { xpath: "//android.widget.TextView[@text='Account']" }

Readme

Keywords

none

Package Sidebar

Install

npm i gqa-automation

Weekly Downloads

60

Version

1.0.0

License

ISC

Unpacked Size

127 MB

Total Files

2835

Last publish

Collaborators

  • nehagudisagar