-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9a2c870
Showing
74 changed files
with
2,334 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const { defineConfig } = require('cypress') | ||
|
||
module.exports = defineConfig({ | ||
e2e: { | ||
defaultCommandTimeout: 1000, | ||
setupNodeEvents (on, config) { | ||
require('./src/plugin')(config) | ||
|
||
return config | ||
}, | ||
specPattern: '**/spec.js', | ||
}, | ||
fixturesFolder: false, | ||
video: false, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
describe('Runs before and beforeEach when first test is skipped', () => { | ||
let count = 0 | ||
|
||
before(() => { | ||
count++ | ||
}) | ||
|
||
beforeEach(() => { | ||
count++ | ||
}) | ||
|
||
it('A', { tags: ['@core'] }, () => {}) | ||
|
||
it('B', { tags: ['@core', '@staging'] }, () => { | ||
expect(count).to.equal(2) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/// <reference types="cypress" /> | ||
|
||
// if we specify just the burn parameter | ||
// then this test will be repeated N times | ||
describe('burning a test N times', () => { | ||
it('repeats', () => {}) | ||
|
||
it('second test', () => {}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// @ts-check | ||
/// <reference types="cypress" /> | ||
describe('tests that use config object', () => { | ||
it('still works @config', { baseUrl: 'http://localhost:8000' }, () => { | ||
expect(Cypress.config('baseUrl')).to.equal('http://localhost:8000') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// @ts-check | ||
/// <reference path="../../src/index.d.ts" /> | ||
describe('tags in the config object', () => { | ||
it('works as an array', { tags: ['config', 'some-other-tag'] }, () => { | ||
expect(true).to.be.true | ||
}) | ||
|
||
it('works as a string', { tags: 'config' }, () => { | ||
expect(true).to.be.true | ||
}) | ||
|
||
it('does not use tags', () => { | ||
// so it fails | ||
expect(true).to.be.false | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path="../../src/index.d.ts" /> | ||
|
||
// @ts-check | ||
|
||
describe('block with no tags', () => { | ||
it('inside describe 1', () => {}) | ||
|
||
it('inside describe 2', () => {}) | ||
}) | ||
|
||
describe('block with tag smoke', { tags: '@smoke' }, () => { | ||
it('inside describe 3', () => {}) | ||
|
||
it('inside describe 4', () => {}) | ||
}) | ||
|
||
describe('block without any tags', () => { | ||
// note the parent suite has no tags | ||
// so this test should run when using --env grepTags=@smoke | ||
it('test with tag smoke', { tags: '@smoke' }, () => {}) | ||
}) | ||
|
||
it('is a test outside any suites', () => {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/// <reference types="cypress" /> | ||
|
||
// https://github.com/bahmutov/cypress-each | ||
import 'cypress-each' | ||
|
||
describe('tests that use .each work', () => { | ||
// creating tests dynamically works with "cypress-grep" | ||
it.each([1, 2, 3])('test for %d', (x) => { | ||
expect(x).to.be.oneOf([1, 2, 3]) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Screen A', { tags: ['@sanity', '@screen-a'] }, () => { | ||
it('loads', { tags: ['@screen-b'] }, () => { | ||
// do something that eventually sends the page to screen b. | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// <reference types="cypress" /> | ||
|
||
// register the plugin multiple times | ||
// to simulate including from support and spec files | ||
// https://github.com/cypress-io/cypress-grep/issues/59 | ||
require('../../src/support')() | ||
require('../../src/support')() | ||
require('../../src/support')() | ||
|
||
it('hello world', () => {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/// <reference path="../../src/index.d.ts" /> | ||
|
||
// @ts-check | ||
describe('grand', () => { | ||
context('outer', { tags: '@smoke' }, () => { | ||
describe('inner', () => { | ||
it('runs', () => {}) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('top', { tags: '@smoke' }, () => { | ||
describe('middle', () => { | ||
context('bottom', { tags: ['@integration', '@fast'] }, () => { | ||
it('runs too', () => {}); | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// <reference path="../../src/index.d.ts" /> | ||
|
||
// @ts-check | ||
describe('Page', () => { | ||
describe('List', { tags: ['@us1'] }, () => { | ||
it.skip('first test', () => {}) | ||
it('second test', () => {}) | ||
it('third test', () => {}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/// <reference types="cypress" /> | ||
describe('tests that use .skip', () => { | ||
// use a template literal | ||
it(`works`, () => {}) | ||
|
||
it.skip('is pending', () => {}) | ||
|
||
it.skip('is pending again', () => {}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/// <reference types="cypress" /> | ||
|
||
it('hello world', () => {}) | ||
|
||
it('works', () => {}) | ||
|
||
it('works 2 @tag1', { tags: '@tag1' }, () => {}) | ||
|
||
it('works 2 @tag1 @tag2', { tags: ['@tag1', '@tag2'] }, () => {}) | ||
|
||
it('works @tag2', { tags: '@tag2' }, () => {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/// <reference types="cypress" /> | ||
|
||
// specify is the same as it() | ||
|
||
specify('hello world', () => {}) | ||
|
||
specify('works', () => {}) | ||
|
||
specify('works 2 @tag1', { tags: '@tag1' }, () => {}) | ||
|
||
specify('works 2 @tag1 @tag2', { tags: ['@tag1', '@tag2'] }, () => {}) | ||
|
||
specify('works @tag2', { tags: '@tag2' }, () => {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="cypress" /> | ||
|
||
it('Test 1', { tags: ['smoke', 'regression'] }, () => { | ||
expect(true).to.be.true | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="cypress" /> | ||
|
||
it('Test 2', { tags: ['high', 'smoke'] }, () => { | ||
expect(true).to.be.true | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="cypress" /> | ||
|
||
it('Test 3', { tags: ['smoke'] }, () => { | ||
expect(true).to.be.true | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/// <reference types="cypress" /> | ||
describe('this context', () => { | ||
beforeEach(() => { | ||
cy.wrap(42).as('life') | ||
}) | ||
|
||
it('preserves the test context', function () { | ||
expect(this).to.be.an('object') | ||
expect(this.life).to.equal(42) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
describe('TypeScript spec', () => { | ||
it('works', () => { | ||
type Person = { | ||
name: string | ||
} | ||
|
||
const person: Person = { | ||
name: 'Joe', | ||
} | ||
|
||
cy.wrap(person).should('have.property', 'name', 'Joe') | ||
}) | ||
|
||
it('loads', () => { | ||
const n: number = 1 | ||
cy.wrap(n).should('eq', 1) | ||
}) | ||
|
||
it('loads interfaces', () => { | ||
interface Person { | ||
name: string | ||
} | ||
|
||
const p: Person = { | ||
name: 'Joe', | ||
} | ||
cy.wrap(p).should('have.property', 'name', 'Joe') | ||
}) | ||
}) |
Oops, something went wrong.