Skip to content

svalabs/e2e-testing

 
 

Repository files navigation

End-to-end testing solution for HobbyFarm

CI Nightly

Automated testing solution to validate HobbyFarm (API + web app), the Cloud Native e-learning platform!

Current state

This repository has been created in February 2023 and is under active development.

The design has been documented in ADRs (Architecture Decision Record): Solution init (Feb 2023).

How to run tests

The technical solution is based on Playwright. The following setup is required in order to run the tests on a machine:

# installs NPM packages
npm install

# installs Playwright dependencies
npx playwright install --with-deps

Environment variables needs to be set to target a specific environment. Locally, you can copy .env.example to create and edit .env file that will be used to configure the tests (thanks to dotenv).

Once the setup and configuration is completed, you can run several commands:

# runs the end-to-end tests (see https://playwright.dev/docs/running-tests)
npx playwright test

# run the tests from the test browser (really cool to see & debug!)
npx playwright test --ui

# opens last HTML report run
npx playwright show-report

# opens a browser to help generate tests (see https://playwright.dev/docs/codegen for options)
npx playwright codegen

How to run acceptance tests

Acceptance testing has been written in Gherkin languages and are mapped to the code thanks to Cucumber (code)

# runs features defined in acceptance folder
npx cucumber-js

How to contribute

You can start editing files in tests folders and look at examples in samples folder. For UI testing, the PageObject pattern has been followed and code is found in src/pages. For REST API testing, code is in src/resources.

To go further you can have a look at .\playwright.config.ts (Playwright Test configuration) and Playwright documentation.

If you use Visual Studio Code, you can install the extension Playwright Test for VSCode (repository).

How to check code quality

We use MegaLinter (code) to check all code from this repository. It will be automatically used in the CI pipeline but you can run it locally:

npx mega-linter-runner

You can also run specific linters:

npx eslint .

How to operate

About

end-to-end testing for HobbyFarm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 88.7%
  • Shell 5.7%
  • Gherkin 3.2%
  • JavaScript 2.4%