This guide assumes that you have been provided with the BCDE Automation Starter Master set of tests. These instructions will only make sense in context of that package. Please contact BCDE Support for further information.
The aim of this guide is to assist you in quickly getting to a point where you can run the tests on your BCDE server. From there, you will be able to explore how the tests work and build up your own automated test suite.
- Download the zip file containing the BCDE Automation starter.
- To get things started on day one, extract the zip file into a folder on your own computer. Remember the location. For the purposes of this quickstart guide, I’m assuming that you are the only one working on these files.
- If only one person is working on and maintaining the tests, then they can continue to work this way.
- However, if several people will be working on the tests, then at some point you will need to look at a way that you can collaborate on the files so that you can all get the latest updates but without your changes conflicting with each other. In BCDE’s environment we use GIT to manage source/version control.
- Download and install NodeJS https://nodejs.org/en/download/
- You don't need to "automatically install the necessary tools" (when you reach that step in the wizard).
- Download and install VS Code (https://code.visualstudio.com/download)
- Complete the Welcome process (no particular settings required) by clicking “Mark Done”
- Open the project. Under “Start” choose “open folder”
- Select the folder containing the starter kit and double click to open it – make sure you go down to the level where you can see the subfolders “tests”, “src” and so on appearing before you choose Select Folder.
- This should provide a browsable folder structure in the left hand panel of your VS Code window
- Install the required extensions in VS Code
- Click on the Extensions icon in the left hand toolbar (it looks like a set of blocks stacked together)
- Search for and install the following extensions:
- Playwright Test for VS Code
- ESLint
- Prettier – Code formatter
- Document This
- Install the dependencies
- Click on Terminal | New Terminal on the top bar menu
- Type npm install and hit enter. Wait for the command prompt to appear again.
- Type npx playwright install and hit enter. Wait for the command prompt to appear again.
- Set up the tests to work with your server and user account.
- Find the file called .env in the explorer panel on the left.
- Click on it to edit it
- Fill in the URL of the server you want to test against
- Fill in the username and password of the test user you want to use
- It’s recommended that you create a new test user that is only used for this purpose and is not used by an actual person.
- For the tests to work on the first run you will need to ensure:
- Your test user is not assigned to any company
- Your user’s full name is the same as its bc username
- You have logged in as the test user once to complete the welcome process
- Your test user has the ability to create spaces in its home
- The tests can be changed to allow these things, but the tests provided as part of this pack must be set up in this way.
- Save using File | Save or by holding CTRL and pressing S.
- You can now try running the tests. There are two ways to do this – through the “Test Runner” or using the command line. Either way you should get some output on whether your tests have passed or failed.
- Using the Test Runner UI
- Click on the test tube/flask icon in the left hand toolbar
- You may need to tick the “show browser” box and click the “refresh” icon to make the tests appear
- If you have the sidebar set wide enough you should see a “play” button to the right of the “tests” heading that will appear. Click on it to run all the tests.
- Using the command line
- Open a terminal by clicking on Terminal | New Terminal in the top bar menu
- Type npx playwright test and hit enter to run all the tests.
- What happens if one of my tests has failed?
- First, try to work out what has gone wrong. Try comparing the information in the test results about what the test was trying to do (its expected result) with what you can see in the screenshot. For example, is the test looking for a menu option that isn’t there? Or is the value that it’s checking for not the one that it received back during the test?
- Once you understand what happened, you can work out whether you need to adjust your test, or whether there is a genuine problem/bug that needs to be solved.