portal-automation-2
v1.0.0
Published
Test Automation for new version of MAX
Readme
MAX 2 Portal-Automation
Instalation
- Clone the repo into a local project folder
- Run
npx playwright installto install playwright - Run
yarn installto handle any missing dependencies npx playwright testto run an example test to see if everything is setup properly
For additional information on playwright setup: https://playwright.dev/docs/intro
Uses:
Playwright 1.35.1
Mailosaur 8.4.0
Dotenv 16.0.1
Graphql 16.2.0
CI / CD
Circle CI pipeline can be found here: https://app.circleci.com/pipelines/github/morsco-reece
The Yaml configuration can be found at: .circleci/config.yml
Currently, there are three jobs that are triggered daily using cron:
All times listed below are in 24-hour server-side time
Prod smoke tests : "0 10 * * *" or at 10:00 daily
Safari will run at: "0 19 * * *" or at 19:00 daily
Chrome will run at: "0 12 * * *" or at 12:00 daily For more information on understanding cron job schedules: https://crontab.guru/
Environment variables configuration can be found here: Enviroment Variables
CONFLUENCE_TOKEN - is the variable used by the customer reporter class. This needs to be tied to an active user in confluence for the reporting to be posted.
The automation test runs confluence page can be found here: https://reeceusa.atlassian.net/wiki/spaces/TAF/pages/1664843816/Automation+Test+Runs The custom-reporter-confluence class is responsible for handling the creation of new subpages when Circle CI has finished its' run they are then posted to these sub-pages per day.
Project structure
|___ circleci. - CICD Integration configuration
|___ docs - Documentation
|___ e2e
|___ actions
|___ fixtures
|___ helpers
|___ page
|___ plugins - Contains utilities such as constants, baseUtils, apiUtils
|___ setup - Global setup for playwright
|___ specs - Test casesCommands
A list of common commands can be found in the package.json file.
The most common command will be:
yarn pw:test-chrome -g 'Test name'To run a test the command will follow a pattern of:
yarn pw: {Enviroment Name} -g {test grouping} 'name of test'-gis used for test grouping which allows you to specify a single test or a group of tests to runexport GLOBAL_SETUP=is used to toggle global setup on or off (true/false)graphql-codegen --config codegen.tsis used to update the graphQL file with new types.
- if there is an issue with updating check the secret token found in the codegen file as this might need to be updated.
npx playwright show-trace- used to view trace reports that are generated. You will need to follow this command up with the path to the trace. For example when a user fails to log in through global setup , this will genrate a .zip file , you can copy the path to it and use this command to view the trace to debug.yarn pw:test-chrome -g 'Test name' --debug
Adding a new user
- There is a new way to add the users but i will document it later (Alejandro's comment)
