Skip to content

Commit

Permalink
feat: add Cypress v9 support (#29)
Browse files Browse the repository at this point in the history
* add v9 test

* run v9 test on CI

* update ci

* refactoring

* support v9

* feat: support Cypress versions before 10

* use parsed config when searching for specs

* correctly determine the version
  • Loading branch information
bahmutov authored Mar 2, 2023
1 parent 9f1b184 commit aaaa9a9
Show file tree
Hide file tree
Showing 15 changed files with 5,566 additions and 150 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v3
- name: check dependencies 📦
# only confirm the prod dependencies are good
run: npm audit --report --omit dev
run: npm run deps

# TODO: run all e2e tests against the expected results
test-one-tag:
Expand Down Expand Up @@ -129,6 +129,28 @@ jobs:
--env grepTags=@scrape \
--expect-exactly ./tests/required-tags-suite/expect-scrape.json
test-cypress-v9:
runs-on: ubuntu-20.04
steps:
- name: Checkout 🛎
uses: actions/checkout@v3

- name: Install dependencies 🧪
uses: cypress-io/github-action@v5
with:
runTests: false

- name: Install Cypress v9 dependencies 🧪
uses: cypress-io/github-action@v5
with:
working-directory: ./test-cy-v9
cache-key: cy-v9-${{ hashFiles('package-lock.json') }}
runTests: false

- name: Grep tags in Cypress v9 folder
run: npm run test-expects
working-directory: ./test-cy-v9

release:
needs:
[
Expand All @@ -140,6 +162,7 @@ jobs:
test-required-tags,
test-required-tags-only,
test-required-tags-parent-suite,
test-cypress-v9,
]
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node_modules/
cypress/videos/
cypress/screenshots/
test-cy-v9/cypress/videos/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ npm i -D @bahmutov/cy-grep
yarn add -D @bahmutov/cy-grep
```

**Note**: @bahmutov/cy-grep only works with Cypress version >= 10.
**Note**: @bahmutov/cy-grep should work with all Cypress versions, but I mostly test it on the newest versions.

### Support file

Expand Down
4 changes: 2 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ const { defineConfig } = require('cypress')
module.exports = defineConfig({
e2e: {
defaultCommandTimeout: 1000,
setupNodeEvents (on, config) {
setupNodeEvents(on, config) {
require('./src/plugin')(config)

return config
},
specPattern: '**/spec.js',
specPattern: 'cypress/**/spec.js',
},
fixturesFolder: false,
video: false,
Expand Down
Loading

0 comments on commit aaaa9a9

Please sign in to comment.