/TestCafe-Docker-Automation-Framework

TestCafe with Docker Automation Framework

Primary LanguageJavaScript

TestCafe: Test Automation Framework

An example project demonstrating automated UI tests with Node.js and JavaScript using TestCafe with Page Object Design Framework.

Application Under Test

We are using https://www.opencart.com/ as the Application Under Test.

Installation

Install the dependencies and devDependencies to run the test.

  • Clone or Download this repo on your local machine
  • Navigate to project's directory on terminal and run the following commands:
npm install

Clean Allure Report

Run on Terminal

 npm run clean

Execute Tests

Run the following command on Terminal to execute tests in Chrome Headless mode

npm run test:chrome:headless

Run the following command on Terminal to execute tests on Chrome, Firefox and Safari

npm run test:chrome
npm run test:firefox
npm run test:safari

Run the following command on Terminal to execute tests in parallel with Chrome and Firefox

npm run test:parallel

Folder Structure

Top - Level Directory Layout

├── pageobjects                        # Selectors CSS identifier for elements to test
│       ├── data .js                   # Test Data
│       ├── locators .js               # Selectors          
│
│
├── pages                               # Generic functionality for tests|
│   ├── basePage.js                     # Base page testing functionality
│   ├── accountPage.js                  # Account details page testing functionality
│   ├── marketPlacePage.js              # Market Place page testing functionality
│
│
├── tests                               # Test suite
│    ├── downloadFreeProduct.test.js    # Automated Test Script
│    ├── searchBox.test.js              # Automated Test Script
│    ├── sortByFeature.test.js          # Automated Test Script
│
├── prettierrc                          # Code Formatting              
│
├── testcaferc                          # TestCafe config file for screenshots on failed tests           
│
├── allure-report                       # Allure Test Report    
│
└─── screenshots                        # Screenshots captured for failed tests

Generate Test Report

Run the following command on Terminal

npm run clean
npm run test:chrome
npm run allure-report

Docker

Run on firefox headless in Docker container

docker build -t testcafe:v1 .
docker run -it testcafe:v1