Skip to content

Commit

Permalink
Check required tags (#32)
Browse files Browse the repository at this point in the history
* adding test for required tags and Cypress v9

* run required tags tests for v9 on CI

* fix the name of the script
  • Loading branch information
bahmutov authored Mar 2, 2023
1 parent 76bae5e commit 7f2c938
Show file tree
Hide file tree
Showing 12 changed files with 3,529 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,32 @@ jobs:
run: npm run test-expects-both
working-directory: ./test-cy-v9

test-cypress-v9-required-tags:
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-required-tags
cache-key: cy-v9-${{ hashFiles('package-lock.json') }}
runTests: false

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

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

release:
needs:
[
Expand All @@ -171,6 +197,7 @@ jobs:
test-required-tags-only,
test-required-tags-parent-suite,
test-cypress-v9,
test-cypress-v9-required-tags,
]
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/main'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules/
cypress/videos/
cypress/screenshots/
test-cy-v9/cypress/videos/
*/cypress/videos/
8 changes: 8 additions & 0 deletions test-cy-v9-required-tags/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"fixturesFolder": false,
"video": false,
"env": {
"grepOmitFiltered": true,
"grepFilterSpecs": true
}
}
5 changes: 5 additions & 0 deletions test-cy-v9-required-tags/cypress/integration/spec1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('spec1', () => {
it('first test', { requiredTags: '@misc' }, () => {})

it('second test', () => {})
})
5 changes: 5 additions & 0 deletions test-cy-v9-required-tags/cypress/integration/spec2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('spec2', { requiredTags: '@second' }, () => {
it('test A')

it('test B', () => {})
})
7 changes: 7 additions & 0 deletions test-cy-v9-required-tags/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
require('../../../src/plugin')(config)
// IMPORTANT: return the config object
return config
}
1 change: 1 addition & 0 deletions test-cy-v9-required-tags/cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('../../..')()
11 changes: 11 additions & 0 deletions test-cy-v9-required-tags/expects/misc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"cypress": {
"integration": {
"spec1.js": {
"spec1": {
"first test": "pass"
}
}
}
}
}
12 changes: 12 additions & 0 deletions test-cy-v9-required-tags/expects/second.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"cypress": {
"integration": {
"spec2.js": {
"spec2": {
"test A": "pending",
"test B": "pass"
}
}
}
}
}
Loading

0 comments on commit 7f2c938

Please sign in to comment.