Skip to content

amalsgit/testcafe-curr-conveter

Repository files navigation

Build & Tests Percy.io for visual tests Quality Gate Status Known Vulnerabilities

TestCafe Sample Base Project

This is a sample automation project to demonstrate few features in TestCafe for UI automation. Tests are run against a sample web application with a functionality of currency conversion.

Visual Testing using Percy is also included to one of the tests.

CI is implemented using Github Actions and SonarCloud is used for static code analysis.

Snyk library vulnerability scans are also included as part of the CI.

Percy visual checks, SonarCloud checks & Snyk scans can be seen in any of the open or closed pull requests.

Test Summary

experiment.tests.ts : Tests without any page objects or best practices. Just a dirtly way of putting all stuff on a single page to check how things works.

currCoversion.tests.ts : Tests with all the best practices in place. Tests might fail since the backgroud API is not mocked. This means that the assertion might fail due to change in currency exchange rate as per the market.

mockedCurrConversion.tests.ts : Tests with best practices and backed API's mocked.

currConversionVisual.tests.ts : Tests incorporating visual tests using Percy

logger.tests.ts : Tests to check the API logging functionality

api.tests.ts : Tests to check the ability to perform Axios API calls with TestCafe

hooks.tests.ts : Tests to check the before and after hooks of TestCafe

Setup

Make sure node is installed on your alone.

Install Yarn and Typescript.

Run Commands

To install all the dependencies

$ yarn

Run the TestCafe end-to-end ui tests by:

$ yarn e2e

This is configured by default to run tests in chrome browsers.

$ yarn e2e:all

To run tests in chrome, Edge, IE & firefox browsers.

$ yarn testcafe chrome tests/filename --ts-config-path=tsconfig.json

TestCafe supports chrome,firefox,safari,edge and ie browsers. The only pre-requisite is that the browser should be installed in your machine.

Tests are configured by default to run on the dev environment. In order to change that user has to set the TEST_ENV variable from the terminal.

$ export TEST_ENV=stg

Test reports can be generated by running the below command after running the tests with yarn e2e

$ yarn reports

The above command generates a reports folder where all the reports are populated.

To run the tests for debugging or during test development with the live mode (hot reload) mode:

$ yarn testcafe chrome tests/filename --ts-config-path=tsconfig.json --live

About

A starter UI test automation project with TypeScript and TestCafe along with Percy, SonarCloud and Snyk integration.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published