{"id":19852540,"url":"https://github.com/thesoftwarehouse/cypress-boilerplate","last_synced_at":"2025-05-02T00:31:23.950Z","repository":{"id":37976299,"uuid":"501723387","full_name":"TheSoftwareHouse/cypress-boilerplate","owner":"TheSoftwareHouse","description":null,"archived":false,"fork":false,"pushed_at":"2022-06-13T10:25:45.000Z","size":137,"stargazers_count":20,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-06T20:22:51.544Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheSoftwareHouse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-09T16:10:26.000Z","updated_at":"2025-02-03T13:17:14.000Z","dependencies_parsed_at":"2022-09-06T19:52:51.135Z","dependency_job_id":null,"html_url":"https://github.com/TheSoftwareHouse/cypress-boilerplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSoftwareHouse%2Fcypress-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSoftwareHouse%2Fcypress-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSoftwareHouse%2Fcypress-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheSoftwareHouse%2Fcypress-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheSoftwareHouse","download_url":"https://codeload.github.com/TheSoftwareHouse/cypress-boilerplate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251966431,"owners_count":21672666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T14:03:22.716Z","updated_at":"2025-05-02T00:31:18.937Z","avatar_url":"https://github.com/TheSoftwareHouse.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Getting started with Cypress E2E\n\nFast, easy and reliable testing for anything that runs in a browser.\n\n## System requirements\n\nCypress is a desktop application that is installed on your computer. The desktop application supports these operating systems:\n\n- **macOS** 10.9 and above _(64-bit only)_\n- **Linux** Ubuntu 12.04 and above, Fedora 21 and Debian 8 _(64-bit only)_\n- **Windows** 7 and above\n\n## Prerequisites:\n\n- node.js 8 and above\n- chrome browser\n- terminal\n\n## TL:DR\n\nInstall dependencies:\n\n- `npm install`\n\nInstall cypress:\n\n- `npm install cypress`\n\nRun tests on local machine:\n\n- `./cypress.sh`\n\nBuild and run tests from Docker:\n\n- `docker-compose build e2e`\n- `docker-compose run --rm e2e`\n\n## Before running new version\n\nSometimes there will be updated of npm packages, so tests can fail for some reasons.\n\nTo avoid this problem:\n\n- delete `node_modules` folder from `root` folder, using: `rm -rf node_modules` command\n- install dependencies `npm i`\n\n## Tests architecture\n\nFor automation tests architecture we use Page Object Pattern. All necessary files are placed in `cypress` directory, which primarily includes:\n\n- `config` with environment configuration,\n- `integration` directory with test cases for `ui` and `api` tests,\n- `pages` and `components` with implementation for pages and reusable components,\n- `endpoints` with implementation for API endpoints,\n- `fixtures` with some test data,\n- `utils` with helpers and data generators.\n\n## Environment variables\n\nTo use environment variables in `cypress/config` folder add json with excepted configuration. Then you can run simply `./cypress.sh \"newEnvironment\"`. If user doesn't provide any environment variable then the `cypress.staging.json` will be used. To change destination of the configs file, go to `cypress/plugins/index.ts` and edit method for configuration.\n\n## Reports\n\nUsing cypress in command line give as opportunity to make screenshots and records videos. I've turned off recording video to speed up tests, but to turn it on just open `cypress.json`, find `video` and change flag to `true`.\n\nRunning command `npm run cy:start` will run complete set of tests and generate report with Mochawesome generator. It will be added to `/cypress/reports/` directory.\n\nUsing commands: \n`npm run cy:start:chrome`, \n`npm run cy:start:firefox`, \n`npm run cy:start:edge`\n\ngive opportunity to run tests in other browsers than Electron\n\n## Running Cypress with Test Runner\n\nTo open `Test Runner`:\n\n- in terminal open `root` folder, then use `npm run cy:open` command\n\nAfter that the desktop application will open where you can select and run desired test suit.\n\n## Running Cypress from bash script\n\nThere is prepared dedicated script `cypress.sh` that provide running specific kind of tests on desired environment. You can run complete test suite but also only tests related to API or UI. Just run command with scheme: `./cypress.sh \"environment\" \"typeOfTests\" \"specFileName\"`. Parameters `\"typeOfTests\"` and `\"specFileName\"` are optional.\n\nExamples of usage:\n\n- to run complete test suite on develop environment use `./cypress.sh develop`,\n- to run UI tests on staging use `./cypress.sh staging ui`, for API `./cypress.sh staging api`,\n- to run tests related to static pages on prod, just run `./cypress.sh prod ui staticPages`.\n\n## Running Cypress in CLI\n\nTo run specific tests using terminal:\n\n- open `root` folder.\n- use command `$(npm bin)/cypress run --spec 'cypress/integration/sample-test.spec.ts'` - you can add in script `cypress: cypress run` and use command `npm run cypress`.\n\nExamples of usage:\n\n- to run all tests from testFolder folder use: `$(npm bin)/cypres --spec 'cypress/integration/*'`\n- to run one test from testFolder folder use: `$(npm bin)/cypres --spec 'cypress/integration/sample-test.spec.ts'`\n\n## Running tests from Docker\n\nTo build project: `docker build -t ${nameOfBuild} .` example: `docker build -t cypress .`\nTo run tests in docker `docker-compose run --rm e2e` it will run command `./cypress.sh staging` after that container will be removed. In case you want to use different environment use `docker-compose run --rm e2e prod` or `docker-compose run --rm e2e local`\n\nIn case you would like to delete docker image, use `docker images` then find IMAGE ID and use `docker image rm ${image}` - sometimes use --force flag.\n\nIn case you would like to remove docker-compose service type: `docker-compose ps e2e` if it return e2e type `docker-compose rm e2e`\n\n## Running test from CircleCI\n\nIn `.circleci` folder there is `config.yml` with configuration of the running test in CircleCI. After login in CCI add your repository. For more information read article with information about [full configuration](https://tsh.io/blog/continuous-integration-for-e2e-tests-2-4-circleci-configuration-for-test-automation/)\n\n## Running test from GitLab\nIn `.gitlab-ci.yml` file is a configuration of the running test in GitLab. This is a proposition for a scheduled CI pipeline with a division on specific browsers. Artifacts are always generated and GitLab will keep them per 1 month. After login in GitLab add your repository. For more information go to the CI/CD GitLab page [more configuration options](https://docs.gitlab.com/ee/ci/). If you need more information about pipelines schedules, you can find them here [pipeline schedules](https://docs.gitlab.com/ee/ci/pipelines/schedules.html). ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthesoftwarehouse%2Fcypress-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthesoftwarehouse%2Fcypress-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthesoftwarehouse%2Fcypress-boilerplate/lists"}