This is seed project for TestCafe E2E testing, this seed rich with lots of features (ex- Data Handling, Config Handling and etc) which helps engineers to continue their tasks easily.
We use TestCafe as our UI automation framework.
This testcafe project contains following code/folder structure.
components/
- contains all the reusable entitiescomponents/
- all the reusable test-case components, eg - loginComponent.jscomponents/BaseComponent.js
- abstract class which provide the blueprint for reusable component. This always extends in all child components.
config/
- contains all the configurations, each environment include separate configuration file.libs/helpers/
- contains all reusable helper classeslibs/helpers/configHelper.js
- contains all the methods which use for handling configurationslibs/helpers/dataHelper.js
- include methods which use for handling data from remote data resource(eg - Google Spreadsheet)
login/
- contains login related all the test-case filesuiObjects/
- include all the Uiobjects which stored as json files
Initially clone the project from this repository.
$ git clone https://github.com/hasithaishere/TestCafe-Seed.git
Then go in to the to the cloned directory and install dependencies and build the project by running the following commands
$ cd TestCafe-Seed
$ npm install
you can install TestCafe globally using following command.
$ npm install -g testcafe
After installation you can execute following command to run end-to-end(E2E) test in all browsers.
$ npm run e2e
If you only need to run in specific browser please execute with browser name as following command.
$ BROWSER=chrome npm run e2e
$ BROWSER=firefox npm run e2e
$ BROWSER="chrome:emulation:device=iphone 6" npm run e2e
If you are unable to execute npm commands, you can execute TestCafe directly.
$ node node_modules/testcafe/bin/testcafe.js $BROWSER tests/e2e/**/index.spec.js
If you need to run test cases in mobile or remote devices please execute following command, it will generate QR code then you can scan that and run test in your mobile device.
$ npm run e2e-remote