Skip to content

eoikef/CodeceptJS-WebDriver

Repository files navigation

CodeceptJS-WebDriver

This project aims to create a sample E2E automated test framework using CodeceptJS with WebDriver.

  • Author: Robson Hamilton

Requirements


Technical Decisions

  • Architecture: I chose to use the closest to Screaming Architecture, because the intuitive names help anyone with no knowledge of the project to find what they need without hard work.
  • I tried to make the functions as small and granular as possible, to facilitate code reuse, create automated tests and facilitate possible debugging.
  • Also tried to reuse most of the steps.

To install the dependencies

  • Use this command in terminal, inside the root folder of the project $ npm install.

To run the tests

  • For run all tests, use this command in terminal, inside the root folder of the project $ npx codeceptjs run --verbose.
  • For run tests with specific tag use this command in terminal, inside the root folder of the project $ npx codeceptjs run --verbose --grep @YourTag.
  • For run tests with report generator, use this command in terminal, inside the root folder of the project $ npx codeceptjs run --verbose --plugins allure.

To run report

  • For build the report, use this command in terminal, inside the root folder of the project $ allure serve output.

WIP

  • Separate file for capabilities instead codecept.conf.js helpers section.

Tips

  • For generate steps for a new feature run this command $ npx codeceptjs gherkin:snippets.
  • Add your new page at "include" section in the codecept.conf.js file
  • Add your new step at "Gherkin" section in the codecept.conf.js file
  • Add comum methods at steps_file.js file, as it extends the "I"

If you want build from scratch on your own repo:

Configurations:

  • Run this command in terminal, inside the root folder of the project $ npx codeceptjs init

Then you will choose the helper to use (in this project, WebDriver), the folder for tests, page, and outputs for tests.

  • Run this command to download selenium standalone serve $ npm i @wdio/selenium-standalone-service --save-dev

Now, in the codecept.conf.js, add the following content in the plugins section:

wdio: {
enabled: true,
services: ['selenium-standalone']
}

Also in the codecept.conf.js, we must now configure the WebDriver, add the following content in the helpers section:

WebDriver: {
url: 'https://myapp.com',
browser: 'chrome',
host: '127.0.0.1',
port: 4444,
restart: false,
windowSize: '1920x1680',
desiredCapabilities: {
chromeOptions: {
args: [ /"--headless",/ "--disable-gpu", "--no-sandbox" ] } } }


References:

CodeceptJS Installation

CodeceptJS - What is Selenium WebDriver?

CodeceptJS - Configuring WebDriver

CodeceptJS - Basics

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors