Skip to content

trannguyenhung011086/autotest_ava_testcafe

Repository files navigation

E2E test for API & UI

Approach: dockerize all test files and environments to run test via docker container

Precondition

  • Install latest node version
  • Install yarn
  • Run yarn install to install all dependencies specified in package.json

E2E API testing

Use GOT http request library (https://github.com/sindresorhus/got) and AVA framework (https://github.com/avajs/ava) to test APIs

Structure

  • common/utils: store API and DB methods
  • common/interface: store type or interface
  • tests/e2e_api/checkout: API test cases for checkout flow
  • tests/e2e_api/non_checkout: API test cases for non-checkout flow

Example test command NODE_ENV=stg ./node_modules/.bin/ava tests/e2e_api/non_checkout/account.*.ts will run all test cases related to account API

Note:

  • to export ava report to xml, use ./node_modules/.bin/ava tests/e2e_api/non_checkout/sale_relate/bestSellers.info.spec.ts --tap | ./node_modules/.bin/tap-xunit | tee report/test.xml

E2E UI testing

Use Testcafe framework (https://github.com/DevExpress/testcafe) to test web application

Structure

  • tests/testcafe/page_objects: prepare page objects to use in test cases
  • tests/testcafe/e2e_ui/desktop: test cases for desktop theme
  • tests/testcafe/e2e_ui/mobile: test cases for mobile theme (emulated)

Example test command: ./node_modules/.bin/testcafe chromium tests/testcafe/desktop/ --fixture-meta type=regression --test-meta function=signin

Run with Gitlab CI

Add living documentation for features

  • use ./node_modules/.bin/featurebook serve features/ to generate HTML for feature documentation

TO-DO

Integrate test result with reportportal dashboard http://reportportal.io/ e.g. $ ls foo.xml foo.xml $ zip foo.zip foo.xml adding: foo.xml (deflated 47%) $ curl -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --header 'Authorization: bearer aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee' -F file=@foo.zip 'http://192.168.1.224:8080/api/v1/foo/launch/import' {"msg":"Launch with id = 5be4de6842eba40001b30534 is successfully imported."}

Need to configure UAT (authorization), API, JIRA, RALLY in docker-compose.yml for reportportal

  • rp.mongo.host=XXX
  • rp.mongo.port=27017
  • rp.mongo.dbName=reportportal
  • rp.mongo.user=XXX
  • rp.mongo.password=XXX

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages