Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(driver): fix integration test retry configuration #18643

Merged
merged 24 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d243a15
test(driver): fix integration test retry configuration
emilyrohrbough Oct 26, 2021
973f354
add assetions
emilyrohrbough Oct 26, 2021
f24ec80
Merge branch 'develop' into fix-driver-retries
emilyrohrbough Oct 26, 2021
66c2fd8
move debug code to running test.
emilyrohrbough Oct 26, 2021
2eb8ef1
Merge branch 'develop' into fix-driver-retries
emilyrohrbough Oct 28, 2021
e1cdde4
Merge branch 'develop' into fix-driver-retries
emilyrohrbough Oct 29, 2021
891567a
pr feedback
emilyrohrbough Oct 29, 2021
15ffd2f
add log context when failures occur
emilyrohrbough Nov 2, 2021
f741ecb
revert change
emilyrohrbough Nov 2, 2021
55e70e1
.
emilyrohrbough Nov 2, 2021
f987fac
try increasing retry just to see
emilyrohrbough Nov 3, 2021
14cc8a6
Update navigation_spec.js
emilyrohrbough Nov 4, 2021
f6bb5df
fix this test
emilyrohrbough Nov 4, 2021
358b844
for fun, lets try these flaky tests
emilyrohrbough Nov 4, 2021
717c8dc
Merge branch 'develop' into fix-driver-retries
emilyrohrbough Nov 4, 2021
5edf0ee
Update navigation_spec.js
emilyrohrbough Nov 4, 2021
e89ab54
lint
emilyrohrbough Nov 4, 2021
a9d0d81
lint
emilyrohrbough Nov 5, 2021
37b8892
Merge branch 'develop' into fix-driver-retries
emilyrohrbough Nov 8, 2021
952dda3
Merge branch 'develop' into fix-driver-retries
emilyrohrbough Nov 9, 2021
c1f9ae1
Merge branch 'develop' into fix-driver-retries
emilyrohrbough Nov 9, 2021
6c25eb5
Apply suggestions from code review
emilyrohrbough Nov 9, 2021
e19d176
don't timeout passing tests
flotwig Nov 9, 2021
11f5c14
Merge branch 'develop' into fix-driver-retries
emilyrohrbough Nov 9, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 10 additions & 9 deletions packages/driver/cypress/integration/commands/actions/check_spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { assertLogLength } = require('../../../support/utils')
const { _, Promise, $ } = Cypress

describe('src/cy/commands/actions/check', () => {
Expand Down Expand Up @@ -469,7 +470,7 @@ describe('src/cy/commands/actions/check', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(chk.length + 1)
assertLogLength(this.logs, chk.length + 1)
expect(lastLog.get('error')).to.eq(err)
expect(err.message).to.include('`cy.check()` failed because this element is not visible')

Expand Down Expand Up @@ -501,7 +502,7 @@ describe('src/cy/commands/actions/check', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(chk.length + 1)
assertLogLength(this.logs, chk.length + 1)
expect(lastLog.get('error')).to.eq(err)
expect(err.message).to.include('`cy.check()` failed because this element is not visible')

Expand All @@ -515,7 +516,7 @@ describe('src/cy/commands/actions/check', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(1)
assertLogLength(this.logs, 1)
expect(lastLog.get('error')).to.eq(err)

done()
Expand All @@ -530,7 +531,7 @@ describe('src/cy/commands/actions/check', () => {
$('<span>span on button</span>').css({ position: 'absolute', left: checkbox.offset().left, top: checkbox.offset().top, padding: 5, display: 'inline-block', backgroundColor: 'yellow' }).prependTo($('body'))

cy.on('fail', (err) => {
expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(err.message).to.include('`cy.check()` failed because this element')
expect(err.message).to.include('is being covered by another element')

Expand Down Expand Up @@ -559,7 +560,7 @@ describe('src/cy/commands/actions/check', () => {

it('does not log an additional log on failure', function (done) {
cy.on('fail', () => {
expect(this.logs.length).to.eq(3)
assertLogLength(this.logs, 3)

done()
})
Expand Down Expand Up @@ -1016,7 +1017,7 @@ describe('src/cy/commands/actions/check', () => {
const { lastLog } = this
const len = (chk.length * 2) + 6

expect(this.logs.length).to.eq(len)
assertLogLength(this.logs, len)
expect(lastLog.get('error')).to.eq(err)
expect(err.message).to.include('`cy.uncheck()` failed because this element is not visible')

Expand All @@ -1032,7 +1033,7 @@ describe('src/cy/commands/actions/check', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(1)
assertLogLength(this.logs, 1)
expect(lastLog.get('error')).to.eq(err)

done()
Expand Down Expand Up @@ -1068,7 +1069,7 @@ describe('src/cy/commands/actions/check', () => {
$('<span>span on button</span>').css({ position: 'absolute', left: checkbox.offset().left, top: checkbox.offset().top, padding: 5, display: 'inline-block', backgroundColor: 'yellow' }).prependTo($('body'))

cy.on('fail', (err) => {
expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(err.message).to.include('`cy.uncheck()` failed because this element')
expect(err.message).to.include('is being covered by another element')

Expand Down Expand Up @@ -1122,7 +1123,7 @@ describe('src/cy/commands/actions/check', () => {

it('does not log an additional log on failure', function (done) {
cy.on('fail', () => {
expect(this.logs.length).to.eq(3)
assertLogLength(this.logs, 3)

done()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { _, $ } = Cypress
const {
assertLogLength,
attachKeyListeners,
shouldBeCalledOnce,
shouldNotBeCalled,
Expand Down Expand Up @@ -286,7 +287,7 @@ describe('src/cy/commands/actions/type - #clear', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(3)
assertLogLength(this.logs, 3)
expect(lastLog.get('error')).to.eq(err)
expect(err.message).to.include('`cy.clear()` failed because it requires a valid clearable element.')
expect(err.message).to.include('The element cleared was:')
Expand Down Expand Up @@ -381,7 +382,7 @@ describe('src/cy/commands/actions/type - #clear', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(1)
assertLogLength(this.logs, 1)
expect(lastLog.get('error')).to.eq(err)

done()
Expand All @@ -408,7 +409,7 @@ describe('src/cy/commands/actions/type - #clear', () => {
.prependTo(cy.$$('body'))

cy.on('fail', (err) => {
expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(err.message).to.include('`cy.clear()` failed because this element')
expect(err.message).to.include('is being covered by another element')

Expand Down Expand Up @@ -442,7 +443,7 @@ describe('src/cy/commands/actions/type - #clear', () => {
})

cy.on('fail', () => {
expect(this.logs.length).to.eq(3)
assertLogLength(this.logs, 3)

done()
})
Expand Down
18 changes: 10 additions & 8 deletions packages/driver/cypress/integration/commands/actions/click_spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { _, $, Promise } = Cypress
const { getCommandLogWithText,
const {
assertLogLength,
getCommandLogWithText,
findReactInstance,
withMutableReporterState,
clickCommandLog,
Expand Down Expand Up @@ -2163,7 +2165,7 @@ describe('src/cy/commands/actions/click', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(1)
assertLogLength(this.logs, 1)
expect(lastLog.get('error')).to.eq(err)

done()
Expand Down Expand Up @@ -2356,7 +2358,7 @@ describe('src/cy/commands/actions/click', () => {

it('throws when attempting to click a <select> element', function (done) {
cy.on('fail', (err) => {
expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(err.message).to.eq('`cy.click()` cannot be called on a `<select>` element. Use `cy.select()` command instead to change the value.')
expect(err.docsUrl).to.eq('https://on.cypress.io/select')

Expand All @@ -2368,7 +2370,7 @@ describe('src/cy/commands/actions/click', () => {

it('throws when provided invalid position', function (done) {
cy.on('fail', (err) => {
expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(err.message).to.eq('Invalid position argument: `foo`. Position may only be topLeft, top, topRight, left, center, right, bottomLeft, bottom, bottomRight.')

done()
Expand Down Expand Up @@ -2416,7 +2418,7 @@ describe('src/cy/commands/actions/click', () => {

it('does not log an additional log on failure', function (done) {
cy.on('fail', () => {
expect(this.logs.length).to.eq(3)
assertLogLength(this.logs, 3)

done()
})
Expand Down Expand Up @@ -3293,7 +3295,7 @@ describe('src/cy/commands/actions/click', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(1)
assertLogLength(this.logs, 1)
expect(lastLog.get('error')).to.eq(err)

done()
Expand Down Expand Up @@ -3731,7 +3733,7 @@ describe('src/cy/commands/actions/click', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(1)
assertLogLength(this.logs, 1)
expect(lastLog.get('error')).to.eq(err)

done()
Expand All @@ -3747,7 +3749,7 @@ describe('src/cy/commands/actions/click', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(4)
assertLogLength(this.logs, 4)
expect(lastLog.get('error')).to.eq(err)
expect(err.message).to.include('`cy.rightclick()` failed because this element is not visible')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { assertLogLength } = require('../../../support/utils')
const { _, $ } = Cypress

const getActiveElement = () => {
Expand Down Expand Up @@ -297,7 +298,7 @@ describe('src/cy/commands/actions/focus', () => {
cy
.get('input:first').focus()
.get('button:first').focus().then(function () {
expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
})
})

Expand Down Expand Up @@ -384,7 +385,7 @@ describe('src/cy/commands/actions/focus', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(1)
assertLogLength(this.logs, 1)
expect(lastLog.get('error')).to.eq(err)

done()
Expand Down Expand Up @@ -467,7 +468,7 @@ describe('src/cy/commands/actions/focus', () => {

it('does not log an additional log on failure', function (done) {
cy.on('fail', () => {
expect(this.logs.length).to.eq(3)
assertLogLength(this.logs, 3)

done()
})
Expand Down Expand Up @@ -738,7 +739,7 @@ describe('src/cy/commands/actions/focus', () => {

it('logs 1 blur event', () => {
cy.get('input:first').focus().blur().then(function () {
expect(this.logs.length).to.eq(1)
assertLogLength(this.logs, 1)
})
})

Expand Down Expand Up @@ -866,7 +867,7 @@ describe('src/cy/commands/actions/focus', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(1)
assertLogLength(this.logs, 1)
expect(lastLog.get('error')).to.eq(err)

done()
Expand All @@ -893,7 +894,7 @@ describe('src/cy/commands/actions/focus', () => {

it('does not log an additional log on failure', function (done) {
cy.on('fail', () => {
expect(this.logs.length).to.eq(4)
assertLogLength(this.logs, 4)

done()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { assertLogLength } = require('../../../support/utils')
const { _, $ } = Cypress

describe('src/cy/commands/actions/select', () => {
Expand Down Expand Up @@ -586,7 +587,7 @@ describe('src/cy/commands/actions/select', () => {

it('does not log an additional log on failure', function (done) {
cy.on('fail', () => {
expect(this.logs.length).to.eq(3)
assertLogLength(this.logs, 3)

done()
})
Expand All @@ -597,7 +598,7 @@ describe('src/cy/commands/actions/select', () => {
it('only logs once on failure', function (done) {
cy.on('fail', (err) => {
// 2 logs, 1 for cy.get, 1 for cy.select
expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)

done()
})
Expand Down Expand Up @@ -702,7 +703,7 @@ describe('src/cy/commands/actions/select', () => {
})

cy.get('#select-maps').select('de_dust2').then(function () {
expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(types.length).to.eq(1)
})
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { _, $ } = Cypress
const { Promise } = Cypress
const { assertLogLength } = require('../../../support/utils')
const { _, $, Promise } = Cypress

describe('src/cy/commands/actions/submit', () => {
before(() => {
Expand Down Expand Up @@ -242,7 +242,7 @@ describe('src/cy/commands/actions/submit', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(lastLog.get('error')).to.eq(err)
expect(err.message).to.include('`cy.submit()` can only be called on a `<form>`. Your subject contains a: `<input id="input">`')
expect(err.docsUrl).to.eq('https://on.cypress.io/submit')
Expand Down Expand Up @@ -293,7 +293,7 @@ describe('src/cy/commands/actions/submit', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(1)
assertLogLength(this.logs, 1)
expect(lastLog.get('error')).to.eq(err)

done()
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('src/cy/commands/actions/submit', () => {
})

cy.on('fail', () => {
expect(this.logs.length).to.eq(3)
assertLogLength(this.logs, 3)

done()
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { assertLogLength } = require('../../../support/utils')
const { _, $ } = Cypress

describe('src/cy/commands/actions/trigger', () => {
Expand Down Expand Up @@ -1060,7 +1061,7 @@ describe('src/cy/commands/actions/trigger', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(lastLog.get('error')).to.eq(err)

done()
Expand All @@ -1075,7 +1076,7 @@ describe('src/cy/commands/actions/trigger', () => {
cy.on('fail', (err) => {
const { lastLog } = this

expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(lastLog.get('error')).to.eq(err)
expect(err.message).to.include('`cy.trigger()` failed because this element is not visible')

Expand Down Expand Up @@ -1114,7 +1115,7 @@ describe('src/cy/commands/actions/trigger', () => {

it('throws when provided invalid position', function (done) {
cy.on('fail', (err) => {
expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(err.message).to.eq('Invalid position argument: `foo`. Position may only be topLeft, top, topRight, left, center, right, bottomLeft, bottom, bottomRight.')

done()
Expand All @@ -1125,7 +1126,7 @@ describe('src/cy/commands/actions/trigger', () => {

it('throws when provided invalid event type', function (done) {
cy.on('fail', (err) => {
expect(this.logs.length).to.eq(2)
assertLogLength(this.logs, 2)
expect(err.message).to.eq('Timed out retrying after 100ms: `cy.trigger()` `eventConstructor` option must be a valid event (e.g. \'MouseEvent\', \'KeyboardEvent\'). You passed: `FooEvent`')

done()
Expand Down Expand Up @@ -1175,7 +1176,7 @@ describe('src/cy/commands/actions/trigger', () => {

it('does not log an additional log on failure', function (done) {
cy.on('fail', () => {
expect(this.logs.length).to.eq(3)
assertLogLength(this.logs, 3)

done()
})
Expand Down