Skip to content

Commit

Permalink
Cypress tests (adobe#66)
Browse files Browse the repository at this point in the history
* setup

* update

* update

* update

* update

* update

* update

* update

* update

* update

* ignore lint on cypress

* exclude from edge delivery deployment

* update

* update

* update

* update

* update

* update

* update

* save screenshots on fail

* test failure

* update

* update

* run on local

* update

* update

* update

* update

* update feedback

* remove possible static waits

* debug first run failures

* update

* fix flakyness

* retry moode reset
  • Loading branch information
dpatil-magento authored Jul 15, 2024
1 parent 94ad90b commit 9413f8b
Show file tree
Hide file tree
Showing 20 changed files with 13,120 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ scripts/commerce-events-collector.js
scripts/commerce-events-sdk.js
scripts/widgets
plugins/
cypress/
25 changes: 25 additions & 0 deletions .github/workflows/run-e2e-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Cypress E2E Tests
on: push
jobs:
cypress-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install root dependencies
run: npm ci
- name: Start server in the background
run: npm start &

- name: Install Cypress and run tests
uses: cypress-io/github-action@v6
with:
working-directory: cypress
browser: chrome
wait-on: 'http://localhost:3000'
config: baseUrl=http://localhost:3000
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore
1 change: 1 addition & 0 deletions .hlxignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ package-lock.json
test/*
postinstall.js
tools/picker/src/*
cypress/
10 changes: 10 additions & 0 deletions cypress/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules
.DS_Store
.idea
reports/*
cypress-test-results.json
cypress-test-results.html
src/snapshots/*/**
screenshots/*
yarn-error.log
downloads
11 changes: 11 additions & 0 deletions cypress/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Running E2E tests

Note - Following commands expects local server is running at http://127.0.0.1:3000/.

1. Clone the repo and change directory to `cypress`
2. Run `npm install`
3. Run `npm run cypress:open`
4. Click on E2E Testing in cypress UI window.
5. Click on Start E2E Testing on Chrome button.
5. Now select respective test to Run from Cypress UI.
6. To run all tests use `npm run cypress:run`
32 changes: 32 additions & 0 deletions cypress/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const { defineConfig } = require('cypress')


module.exports = defineConfig({
defaultCommandTimeout: 60000,
screenshotsFolder: 'screenshots',
downloadsFolder: 'downloads',
fixturesFolder: 'src/fixtures',
video: false,
pageLoadTimeout: 60000,
requestTimeout: 60000,
viewportHeight: 900,
viewportWidth: 1440,
scrollBehavior: 'nearest',
trashAssetsBeforeRuns: false,
chromeWebSecurity: false,
retries: {
runMode: 2,
},
e2e: {
baseUrl: 'http://localhost:3000/',
supportFile: 'src/support/index.js',
specPattern: 'src/tests/**/*.spec.js',
},
env: {
graphqlEndPoint: 'https://integration-5ojmyuq-7yvbzwvtkgerq.us-4.magentosite.cloud/graphql',
},
reporter: 'cypress-multi-reporters',
reporterOptions: {
configFile: 'reporter-config.json',
},
});
Loading

0 comments on commit 9413f8b

Please sign in to comment.