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(webkit): fix WebKit network-related driver tests #23232

Merged
merged 46 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
de8e6c3
detect playwright-webkit browser
flotwig Mar 16, 2021
d0d1736
fix: use stdio for CDP instead of TCP (#14348)
flotwig Jan 19, 2021
818c7de
wip: begin launchin webkit
flotwig Mar 16, 2021
a7279e5
Merge remote-tracking branch 'origin/develop' into cy-webkit
flotwig Aug 2, 2022
45b5286
run mode works w webkit in 10.0
flotwig Aug 4, 2022
ecd6f0f
reset previous cdp changes
flotwig Aug 4, 2022
505c0dd
run driver webkit tests
flotwig Aug 4, 2022
35b4039
always detect webkit in non-prod
flotwig Aug 5, 2022
ceba06f
fix version detection
flotwig Aug 5, 2022
68ebaca
actually run new job
flotwig Aug 4, 2022
a5a0fc6
Merge remote-tracking branch 'origin/develop' into cy-webkit
flotwig Aug 5, 2022
f974e99
cleanup
flotwig Aug 5, 2022
25b8fc9
fix run
flotwig Aug 5, 2022
411a2f1
try caching pw binary
flotwig Aug 5, 2022
83c58d5
npx install pw binary
flotwig Aug 5, 2022
def14cc
install-deps
flotwig Aug 5, 2022
e85025c
add experimentalSessionAndOrigin wk tests
flotwig Aug 5, 2022
53db500
wk experimentalSessionAndOrigin tests
flotwig Aug 5, 2022
12b3cab
browser icon
flotwig Aug 8, 2022
37de56a
fix some tests
flotwig Aug 8, 2022
32ed232
reset browsers.ts change
flotwig Aug 8, 2022
3acc19b
fix more tests
flotwig Aug 8, 2022
0681f0a
fix even more tests, skip driver CI for now
flotwig Aug 8, 2022
67fdd2d
comma
flotwig Aug 8, 2022
58b2d39
fix server-unit-test
flotwig Aug 8, 2022
406d8ec
fix websockets_spec
flotwig Aug 8, 2022
8fb785a
refactor wkautomation to initialize self from static async method
flotwig Aug 9, 2022
b997ff0
fix(proxy/prerequests): fix duplicate key behavior, fallthrough
flotwig Aug 9, 2022
14270e1
Apply suggestions from code review
flotwig Aug 9, 2022
43b2f0a
simpler name for StackMap
flotwig Aug 9, 2022
ad863e2
fix proxy-logging spec, some xhr specs
flotwig Aug 9, 2022
ebc6335
fix last xhr test
flotwig Aug 9, 2022
6620008
update testConfigOverrides
flotwig Aug 9, 2022
c8c7ac7
skip webcam.cy.js
flotwig Aug 9, 2022
fb66f8f
reenable driver tests
flotwig Aug 9, 2022
71639e2
ci?
flotwig Aug 9, 2022
9ac53fd
Suggestions from code review
flotwig Aug 15, 2022
b7117fe
skip remaining failures which won't be fixed here
flotwig Aug 15, 2022
f6f2513
Merge branch 'cy-webkit' into webkit-prerequests
flotwig Aug 15, 2022
f4a432b
Merge remote-tracking branch 'origin/develop' into webkit-prerequests
flotwig Aug 15, 2022
8ca3edc
fix/skip a couple tests
flotwig Aug 15, 2022
82950c5
fix tests
flotwig Aug 17, 2022
cb3821c
skip crashy specs
flotwig Aug 17, 2022
50c5ae6
skip hidden suites
flotwig Aug 17, 2022
bd3606c
Merge branch 'develop' into webkit-prerequests
flotwig Aug 17, 2022
8b1f855
Update packages/server/lib/browsers/webkit-automation.ts
flotwig Aug 17, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2379,11 +2379,10 @@ linux-x64-workflow: &linux-x64-workflow
context: test-runner:cypress-record-key
requires:
- build
# TODO: Fix keyboard tests to fix the majority of these tests before re-enabling
# - driver-integration-tests-webkit:
# context: test-runner:cypress-record-key
# requires:
# - build
- driver-integration-tests-webkit:
context: test-runner:cypress-record-key
requires:
- build
- driver-integration-tests-chrome-experimentalSessionAndOrigin:
context: test-runner:cypress-record-key
requires:
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/cypress/e2e/commands/actions/check.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,9 @@ describe('src/cy/commands/actions/check', () => {
})
})

// TODO(webkit): fix+unskip
// https://github.com/cypress-io/cypress/issues/4233
it('can check an element behind a sticky header', () => {
it('can check an element behind a sticky header', { browser: '!webkit' }, () => {
cy.viewport(400, 400)
cy.visit('./fixtures/sticky-header.html')
cy.get(':checkbox:first').check()
Expand Down
9 changes: 6 additions & 3 deletions packages/driver/cypress/e2e/commands/actions/click.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ const getMidPoint = (el) => {

const isFirefox = Cypress.isBrowser('firefox')

describe('src/cy/commands/actions/click', () => {
// TODO(webkit): fix+unskip for experimental webkit
describe('src/cy/commands/actions/click', { browser: '!webkit' }, () => {
beforeEach(() => {
cy.visit('/fixtures/dom.html')
})
Expand Down Expand Up @@ -3928,7 +3929,8 @@ describe('src/cy/commands/actions/click', () => {
})
})

describe('shadow dom', () => {
// TODO(webkit): fix+unskip for experimental webkit
Copy link
Contributor

@lmiller1990 lmiller1990 Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprised these tests don't "just work" - I would have thought basic browser APIs would be fairly uniform, since we trigger them with standard client side JS (assuming here, haven't looked at how cy.shadow actually works).

Edit: some actually do just work, or at least, it seems that way on my machine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this passed for me

image

Copy link
Contributor Author

@flotwig flotwig Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I skipped out the entire click.cy.js because of the large number of failures, I could've been more selective here. This will be unskipped by experimentalWebKitSupport release.

describe('shadow dom', { browser: '!webkit' }, () => {
beforeEach(() => {
cy.visit('/fixtures/shadow-dom.html')
})
Expand Down Expand Up @@ -3991,7 +3993,8 @@ describe('shadow dom', () => {
})
})

describe('mouse state', () => {
// TODO(webkit): fix+unskip for experimental webkit
describe('mouse state', { browser: '!webkit' }, () => {
describe('mouse/pointer events', () => {
beforeEach(() => {
cy.visit('http://localhost:3500/fixtures/dom.html')
Expand Down
6 changes: 4 additions & 2 deletions packages/driver/cypress/e2e/commands/actions/selectFile.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,8 @@ is being covered by another element:
cy.get('#hidden-basic-label').selectFile({ contents: '@foo' }, { force: true })
})

it('can scroll to input', () => {
// TODO(webkit): fix+unskip for experimental webkit
it('can scroll to input', { browser: '!webkit' }, () => {
const scrolled = []

cy.on('scrolled', ($el, type) => {
Expand Down Expand Up @@ -646,7 +647,8 @@ is being covered by another element:
})
})

it('can specify scrollBehavior in options', () => {
// TODO(webkit): fix+unskip for experimental webkit
it('can specify scrollBehavior in options', { browser: '!webkit' }, () => {
cy.get('#scroll').then((el) => {
cy.spy(el[0], 'scrollIntoView')
})
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/cypress/e2e/commands/actions/type.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const expectTextEndsWith = (expected) => {
}
}

describe('src/cy/commands/actions/type - #type', () => {
// TODO(webkit): fix+unskip for experimental webkit
describe('src/cy/commands/actions/type - #type', { browser: '!webkit' }, () => {
beforeEach(() => {
cy.visit('/fixtures/dom.html')
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const { assertLogLength } = require('../../../support/utils')
const { _, $ } = Cypress

describe('src/cy/commands/actions/type - #type errors', () => {
// TODO(webkit): fix+unskip for experimental webkit release
describe('src/cy/commands/actions/type - #type errors', { browser: '!webkit' }, () => {
beforeEach(() => {
cy.visit('/fixtures/dom.html')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const {
trimInnerText,
} = require('../../../support/utils')

describe('src/cy/commands/actions/type - #type special chars', () => {
// TODO(webkit): fix+unskip for experimental webkit release
describe('src/cy/commands/actions/type - #type special chars', { browser: '!webkit' }, () => {
before(function () {
cy
.visit('/fixtures/dom.html')
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/cypress/e2e/commands/cookies.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ describe('src/cy/commands/cookies', () => {
cy.setCookie('five', 'bar')

// @see https://bugzilla.mozilla.org/show_bug.cgi?id=1624668
if (Cypress.isBrowser('firefox')) {
// TODO(webkit): pw webkit has the same issue as firefox (no "unspecified" state), need a patched binary
if (Cypress.isBrowser('firefox') || Cypress.isBrowser('webkit')) {
cy.getCookie('five').should('include', { sameSite: 'no_restriction' })
} else {
cy.getCookie('five').should('not.have.property', 'sameSite')
Expand Down
6 changes: 4 additions & 2 deletions packages/driver/cypress/e2e/commands/navigation.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1906,7 +1906,8 @@ describe('src/cy/commands/navigation', () => {
})
})

context('#page load', () => {
// TODO(webkit): fix+unskip for experimental webkit release
context('#page load', { browser: '!webkit' }, () => {
it('sets initial=true and then removes', () => {
Cookie.remove('__cypress.initial')

Expand Down Expand Up @@ -2364,7 +2365,8 @@ describe('src/cy/commands/navigation', () => {
})
})

context('#url:changed', () => {
// TODO(webkit): fix+unskip for experimental webkit release
context('#url:changed', { browser: '!webkit' }, () => {
beforeEach(function () {
this.logs = []

Expand Down
27 changes: 20 additions & 7 deletions packages/driver/cypress/e2e/commands/net_stubbing.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ describe('network stubbing', function () {
// a different domain from the page own domain
// NOTE: this domain is redirected back to the local host test server
// using "hosts" setting in the "cypress.json" file
const corsUrl = 'http://diff.foobar.com:3501/no-cors'
let corsUrl = 'http://diff.foobar.com:3501/no-cors'

beforeEach(() => {
cy.visit('http://127.0.0.1:3500/fixtures/dom.html')
Expand Down Expand Up @@ -1043,14 +1043,20 @@ describe('network stubbing', function () {
})

it('can be overwritten', function () {
cy.intercept('OPTIONS', '/no-cors', (req) => {
if (Cypress.isBrowser('webkit')) {
// WebKit appears to cache successful OPTIONS responses that happen in quick succession
// so append a number to the corsUrl so the previous test doesn't cause this one to fail
corsUrl += 'v2'
}

cy.intercept('OPTIONS', '/no-cors*', (req) => {
req.reply({
headers: {
'access-control-allow-origin': 'http://wrong.invalid',
},
})
})
.intercept('/no-cors', (req) => {
.intercept('/no-cors*', (req) => {
req.reply(`intercepted ${req.method}`)
})
.then(() => {
Expand Down Expand Up @@ -2379,7 +2385,9 @@ describe('network stubbing', function () {
.and('include', 'content-type: application/json')
})

it('can forceNetworkError', function (done) {
// TODO(webkit): extremely flaky for some reason. need to figure out why and either fix
// or disable forceNetworkError for experimental release
it('can forceNetworkError', { browser: '!webkit' }, function (done) {
const url = uniqueRoute('/foo')

cy.intercept(`${url}*`, function (req) {
Expand Down Expand Up @@ -2609,7 +2617,9 @@ describe('network stubbing', function () {
})

it('intercepts cached responses as expected', {
browser: '!firefox', // TODO: why does firefox behave differently? transparently returns cached response
// TODO: why does firefox behave differently? transparently returns cached response
// TODO(webkit): fix+unskip. currently fails in WK because cache is disabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is disabling the cache in WebKit something Playwright automation does, or something we do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PW automation.

browser: { family: 'chromium' },
}, function () {
cy.visit('/fixtures/empty.html')

Expand Down Expand Up @@ -3062,7 +3072,9 @@ describe('network stubbing', function () {
.should('include', { foo: 1 })
})

it('can forceNetworkError', function (done) {
// TODO(webkit): extremely flaky for some reason. need to figure out why and either fix
// or disable forceNetworkError for experimental release
it('can forceNetworkError', { browser: '!webkit' }, function (done) {
const url = uniqueRoute('/foo')

cy.intercept(`${url}*`, function (req) {
Expand Down Expand Up @@ -3453,7 +3465,8 @@ describe('network stubbing', function () {
})

// @see https://github.com/cypress-io/cypress/issues/8934
it('can spy on a 304 not modified image response', function () {
// TODO(webkit): fix+unskip. currently fails in WK because cache is disabled
it('can spy on a 304 not modified image response', { browser: '!webkit' }, function () {
const url = `/fixtures/media/cypress.png?i=${Date.now()}`

cy.intercept(url).as('image')
Expand Down
12 changes: 9 additions & 3 deletions packages/driver/cypress/e2e/commands/xhr.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,9 @@ describe('src/cy/commands/xhr', () => {

try {
assertLogLength(this.logs, 1)
expect(lastLog.get('error').message).contain('foo is not defined')
const undefinedError = Cypress.browser.family === 'webkit' ? 'Can\'t find variable: foo' : 'foo is not defined'

expect(lastLog.get('error').message).contain(undefinedError)

done()
} catch (err) {
Expand Down Expand Up @@ -2695,7 +2697,10 @@ describe('src/cy/commands/xhr', () => {
})

context('Cypress.on(window:unload)', () => {
it('cancels all open XHR\'s', () => {
// TODO(webkit): fix+unskip. XHRs are at { readyState: 4 } when they are canceled
// leading to a failure when we check `xhr.canceled`. `xhr.canceled` is non-standard so a better
// test may be needed here?
it('cancels all open XHR\'s', { browser: '!webkit' }, () => {
const xhrs = []

cy
Expand Down Expand Up @@ -2750,7 +2755,8 @@ describe('src/cy/commands/xhr', () => {
.wait('@getFoo').its('url').should('include', '/foo')
})

it('reapplies server + route automatically during page transitions', () => {
// TODO(webkit): fix+unskip. seems to be related to `cy.click` event not firing on the <a>, not an actual issue in cy.route
it('reapplies server + route automatically during page transitions', { browser: '!webkit' }, () => {
// this tests that the server + routes are automatically reapplied
// after the 2nd visit - which is an example of the remote iframe
// causing an onBeforeLoad event
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/cypress/e2e/cy/timers.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ describe('driver/src/cy/timers', () => {
//
})

it('does not fire queued timers if page transitions while paused', () => {
// TODO(webkit): fix+unskip
it('does not fire queued timers if page transitions while paused', { browser: '!webkit' }, () => {
// at least in chrome... whenever the page is unloaded
// the browser WILL CANCEL outstanding macrotasks automatically
// and invoking them does nothing
Expand Down
9 changes: 6 additions & 3 deletions packages/driver/cypress/e2e/cypress/cy.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ describe('driver/src/cypress/cy', () => {
})
})

it('stores invocation stack for first command', () => {
// TODO(webkit): fix+unskip for experimental webkit
it('stores invocation stack for first command', { browser: '!webkit' }, () => {
cy
.get('input:first')
.then(() => {
Expand All @@ -123,7 +124,8 @@ describe('driver/src/cypress/cy', () => {
})
})

it('stores invocation stack for chained command', () => {
// TODO(webkit): fix+unskip for experimental webkit
it('stores invocation stack for chained command', { browser: '!webkit' }, () => {
cy
.get('div')
.find('input')
Expand Down Expand Up @@ -173,7 +175,8 @@ describe('driver/src/cypress/cy', () => {
})
})

describe('invocation stack', () => {
// TODO(webkit): fix+unskip for experimental webkit
describe('invocation stack', { browser: '!webkit' }, () => {
beforeEach(() => {
Cypress.Commands.add('getInput', () => cy.get('input'))
Cypress.Commands.add('findInput', { prevSubject: 'element' }, (subject) => {
Expand Down
6 changes: 4 additions & 2 deletions packages/driver/cypress/e2e/cypress/error_utils.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ describe('driver/src/cypress/error_utils', () => {
expect(fn).to.throw('Simple error with a message')
})

it('removes internal stack lines from stack', () => {
// TODO(webkit): fix+unskip for experimental webkit
it('removes internal stack lines from stack', { browser: '!webkit' }, () => {
// this features relies on Error.captureStackTrace, which some
// browsers don't have (e.g. Firefox)
if (!Error.captureStackTrace) return
Expand Down Expand Up @@ -598,7 +599,8 @@ describe('driver/src/cypress/error_utils', () => {
})

context('Error.captureStackTrace', () => {
it('works - even where not natively support', () => {
// TODO(webkit): fix+unskip for experimental webkit
it('works - even where not natively support', { browser: '!webkit' }, () => {
function removeMe2 () {
const err: Record<string, any> = {}

Expand Down
3 changes: 2 additions & 1 deletion packages/driver/cypress/e2e/dom/visibility.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,8 @@ describe('src/cypress/dom/visibility', () => {
cy.wrap(this.$optionHiddenInSelect.find('#hidden-opt')).should('not.be.visible')
})

it('follows regular visibility logic if option outside of select', function () {
// TODO(webkit): fix+unskip
it('follows regular visibility logic if option outside of select', { browser: '!webkit' }, function () {
expect(this.$optionOutsideSelect.find('#option-hidden').is(':hidden')).to.be.true
expect(this.$optionOutsideSelect.find('#option-hidden')).to.be.hidden
cy.wrap(this.$optionOutsideSelect.find('#option-hidden')).should('be.hidden')
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/cypress/e2e/e2e/dom_hitbox.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const { clickCommandLog } = require('../../support/utils')
const { _ } = Cypress

// https://github.com/cypress-io/cypress/pull/5299/files
describe('rect highlight', () => {
// TODO(webkit): fix+unskip for experimental webkit
describe('rect highlight', { browser: '!webkit' }, () => {
beforeEach(() => {
cy.visit('/fixtures/dom.html')
})
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/cypress/e2e/e2e/focus_blur.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,8 @@ describe('polyfill programmatic blur events', () => {
})
})

describe('intercept blur methods correctly', () => {
// TODO(webkit): fix+unskip for experimental webkit release
describe('intercept blur methods correctly', { browser: '!webkit' }, () => {
beforeEach(() => {
cy.visit('http://localhost:3500/fixtures/active-elements.html').then(() => {
top.focus()
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/cypress/e2e/e2e/react-15.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
describe('react v15.6.0', () => {
// TODO(webkit): fix+unskip for experimental webkit release
describe('react v15.6.0', { browser: '!webkit' }, () => {
context('fires onChange events', () => {
beforeEach(() => {
cy.visit('/fixtures/react-15.html')
Expand Down
3 changes: 2 additions & 1 deletion packages/driver/cypress/e2e/e2e/react-16.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
describe('react v16.0.0', () => {
// TODO(webkit): fix+unskip for experimental webkit release
describe('react v16.0.0', { browser: '!webkit' }, () => {
context('fires onChange events', () => {
beforeEach(() => {
cy.visit('/fixtures/react-16.html')
Expand Down
Loading