This the a Selenium framework used to test the 'HospitalRun' website. Built on webdriverIO, browserstack and allure report generator
Clone the folder into your local machine and execute the following commands. Ensure you have a browserstack username and access key to be able to switch browsers and platforms on Browserstack
npm install
to install all the dependenciesnpm run test
to run all the test cases . To run a specific test case , use the --spec flag like sonpx wdio run wdio.conf.js --spec ./test/specs/logout.e2e.js
- This step action also generates a screenshot of the last step if a test was successful and stores it in the root directory
- You can configure the
capabilities
in the config file to either run the tests on your local browser or on BrowserStack. Supported capabilites are commented out, all you need to do is uncomment depending on what you want to use. - To integrate browserstack, all you need to do is set your username and access key as environment variables. e.g in Mac
export BROWSERSTACK_USERNAME='your_username'
,export BROWSERSTACK_ACCESS_KEY='your_access_key'
- Once the tests are done, you should be able to see this on browserstack with an attached recording of the execution.
6.To generate an allure report for the completed test cases, run the following command npm run report
. This will open a webpage showing you a report with all the steps, the status and a screenshot at the end of the test.
-
Using the terminal, you can switch browsers on Windows OS in BrowserStack easily between chrome,firefox and edge. Follow these steps for MacOs users:
- Install gsed for
brew install gnu-sed
- Run the chrome/firefox/edge script depending on which browser you want to switch to
npm run firefox
ornpm run chrome
ornpm run edge
- Run the test cases as per step 2
- Install gsed for
-
For windows or linux, you can use any text finder and replacer and modify the
chrome
andfirefox
scripts inpackage.json
accordingly.
To switch capabilities, i.e Browsers and Device OS types, you can add the capability you want in the wdio.conf.js
file. Currently, it picks up the last capability on the list and uses only that if multiple options are provided.