This document describes how one can start working on a test cafe project from installtion of plugins, cloning the project to run tests and pipeline information.
Clone project in Visual Studio Code
- Create account in github.com
- Get write access to AltinnStudio - https://github.com/Altinn/altinn-studio
- Use windows 10 image with docker.
- Create a folder - C:\Repos
- Open Visual Studio Code
- Ctrl + Shift + P -> Create New Integrated Terminal
- Terminal opens down of Visual Studio Code.
- Navigate to the folder create in step 4 using “cd”
- Clone the project- git clone https://github.com/Altinn/altinn-studio.git
- File -> Add Folder to Workspace -> Select the cloned project: C:\Altinn Studio
- Checkout branch: master
Code for Testcafe tests in altinn.studio
1. Open PowerShell -> Verify Node and Npm version npm -v (6.9.0) node -v (9.5.0) 2. Install npm a. npm install -g npm 3. Install npm in the Altinn Studio project a. Navigate to the folder - C:\Altinn Studio\altinn-studio\src\test\Testcafe b. Run command – npm install 4. Ensure that the environment variables has the path of npm a. C:\Users\UserName\AppData\Roaming\npm 5. Navigate to the folder of the testcafe tests in command line (altinn-studio\src\test\Testcafe) a. Run command - npm install testcafe
Run a Test Locally from PowerShell
- Open testRunner.js in Visual Studio Code
- Set the browser as: Chrome
- Speed controls the speed of the execution
- Open a test fixture .js file (e.x., designer_tests -> navigation-tests.js)
- ‘.only’ can be used to run a specific fixture or a test case
- Save the project
- Open PowerShell and navigate to C:\Altinn Studio\altinn-studio\src\test\Testcafe
- Set environment to run the test using: set ENV=dev
- Set password for the test users of Studio using: set “username from config.json”=password
- Run the command – ‘node .\testRunner.js’ to run general tests
- Run the command - ‘node .\WCAGRunner.js’ to run wcag tests
- Create a new branch with addition or changing of a new test from master.
- Do necessary changes and commit the same to the new branch.
- Create a new pull request from Github with the commits created.
- Once PR is approved, merge the branch to master and delete the branch.