npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

msg-wdio-cucumber-framework

v1.0.0

Published

## Install

Downloads

20

Readme

MSG WDIO Automated Tests

Install

run npm i in root directory after git clone [email protected]:MSGTech/msg-wdio-automated-tests.git to install all product dependencies from package.json

Webdriver IO

This project is a NodeJS project built with WebdriverIO v5

Cucumber

This project leverages Cucumber JS as a testing framework

Architecture

Component Object Model

Similar to Page Object Model paradigm, this project uses what we call Component Object Model where each Component Object contains selectors and functions of a specific React Component on msg.com. Files can be seen in /src/component-objects directory

Suites

In both /wdio.LOCAL.conf.js and /wdio.SAUCE.conf.js, there is a suites object that contains suites or groupings of tests. We can add any number of any type of suite depending on our test needs. Currently are Suites are groupings of tests by pages but we plan on extending this to include groupings of tests by components as well

Interact

We leverage the Webdriver IO API in our /src/support/interact.js file. In this file contains all methods we need to create WDIO Elements and call actions on them. This file supports both static and dynamic element interactions.

Feed Selectors

Found in /src/support/feed-selectors, these files contain all the methods we use to destructure our fetched JSON files. We then dynamically pass this data to our XPath selectors during test execution.

Required Environment Variables

  • ENV = Environent to run tests against e.g. prod, staging, dev, test, uat
  • AUTH_TOKEN = The Event Engine API token required to interact with our backend
  • SEND_TO_SLACK = If true, will send test information to the Slack channel msg-web-msgcom-update upon start and finish of test run
  • UPLOAD_REPORT_TO_S3 = If true, will upload the Cucumber HTML Report to AWS S3
  • RUN_VISUAL_TESTS = If true, will run our Applitools Visual Tests

Add the following to your ~/.bash_profile

export ENV="prod" 
export AUTH_TOKEN="Bearer ${TOKEN}" (ask someone on team to provide token)
export SEND_TO_SLACK="false"
export UPLOAD_REPORT_TO_S3="false"
export RUN_VISUAL_TESTS="false"

The only variable you should be changing when running from your local machine is ENV

Test Execution

There is currently three different ways you can execute tests in this framework depending on your needs.

Running tests locally

We run tests locally when building or debugging single tests. You can run a single test by passing the path to that test in the debug array inside of wdio.LOCAL.conf suites object. An example of this looks like debug: ["./src/features/lost*/msgcom-1051*.feature"] where a single test is passed to our debug suite. We can then run this suite with the following command from the root of our project directory - ./node_modules/.bin/wdio wdio.LOCAL.conf.js --suite debug.

I recommend you create an alias to this command in your ~/.bash_profile so you don't need to type this everytime you debug a test. You can do so as such alias localDebug="./node_modules/.bin/wdio wdio.LOCAL.conf.js --suite debug". By doing so, you can simply type localDebug in your terminal.

Running test in Sauce

We can run tests in sauce by running wdio.SAUCE.conf config in our root directory with ./node_modules/.bin/wdio wdio.LOCAL.conf.js. This will run all of our tests from your local machine in Sauce using all of the browsers specified in the capabilities array of objects in that config. capabilities: [{ }] We currently test Chrome (latest), FireFox (latest), IE 11, Edge 17 and Safari 12. You can also specific a group to run against as mentioned above and can also create an alias as well if you want to debug tests on certain browsers - alias sauceDebug="./node_modules/.bin/wdio wdio.SAUCE.conf.js --suite debug"

Running tests in Jenkins

We can also run tests on Jenkins so we don't consume resources on our local environment. The job is located here. Once there:

  • Click Build with Parameters
  • Select the Environment you want to run against
  • Select the Suite you want to run against
  • Select the Location you want to run against
  • Select if you want to run Visual Tests with Applitools
  • Select if you want to send slack notifications with test run information
  • Select if you want upload the report to S3
  • Specifiy the branch you want to run against