Skip to content

Commit

Permalink
use test configuration to disable on webkit
Browse files Browse the repository at this point in the history
  • Loading branch information
astone123 committed Apr 6, 2023
1 parent e6ab6a0 commit 932b4e0
Showing 1 changed file with 35 additions and 45 deletions.
80 changes: 35 additions & 45 deletions packages/driver/cypress/e2e/commands/actions/type_events.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const { _, $ } = Cypress

const isWebkit = Cypress.isBrowser('webkit')

describe('src/cy/commands/actions/type - #type events', () => {
beforeEach(() => {
cy.visit('fixtures/dom.html')
Expand Down Expand Up @@ -95,32 +93,28 @@ describe('src/cy/commands/actions/type - #type events', () => {
cy.get(':text:first').type('a')
})

it('receives textInput event', (done) => {
// TODO fix this test in Webkit https://github.com/cypress-io/cypress/issues/26438
if (!isWebkit) {
const $txt = cy.$$(':text:first')
// TODO fix this test in Webkit https://github.com/cypress-io/cypress/issues/26438
it('receives textInput event', { browser: '!webkit' }, (done) => {
const $txt = cy.$$(':text:first')

$txt[0].addEventListener('textInput', (e) => {
$txt[0].addEventListener('textInput', (e) => {
// FIXME: (firefox) firefox cannot access window objects else throw cross-origin error
expect(Object.prototype.toString.call(e.view)).eq('[object Window]')
e.view = null
expect(_.toPlainObject(e)).to.include({
bubbles: true,
cancelable: true,
data: 'a',
detail: 0,
type: 'textInput',
// view: cy.state('window'),
which: 0,
})

done()
expect(Object.prototype.toString.call(e.view)).eq('[object Window]')
e.view = null
expect(_.toPlainObject(e)).to.include({
bubbles: true,
cancelable: true,
data: 'a',
detail: 0,
type: 'textInput',
// view: cy.state('window'),
which: 0,
})

cy.get(':text:first').type('a')
} else {
done()
}
})

cy.get(':text:first').type('a')
})

it('receives input event', (done) => {
Expand Down Expand Up @@ -600,33 +594,29 @@ describe('src/cy/commands/actions/type - #type events', () => {
]

targets.forEach((target) => {
it(target, () => {
// TODO fix this test in Webkit https://github.com/cypress-io/cypress/issues/26438
if (!isWebkit) {
cy.get(`#target-${target}`).focus().type('{enter}')

cy.get('li').should('have.length', 4)
cy.get('li').eq(0).should('have.text', 'keydown')
cy.get('li').eq(1).should('have.text', 'keypress')
cy.get('li').eq(2).should('have.text', 'click')
cy.get('li').eq(3).should('have.text', 'keyup')
}
// TODO fix this test in Webkit https://github.com/cypress-io/cypress/issues/26438
it(target, { browser: '!webkit' }, () => {
cy.get(`#target-${target}`).focus().type('{enter}')

cy.get('li').should('have.length', 4)
cy.get('li').eq(0).should('have.text', 'keydown')
cy.get('li').eq(1).should('have.text', 'keypress')
cy.get('li').eq(2).should('have.text', 'click')
cy.get('li').eq(3).should('have.text', 'keyup')
})
})

describe('keydown triggered on another element', () => {
targets.forEach((target) => {
it(target, () => {
// TODO fix this test in Webkit https://github.com/cypress-io/cypress/issues/26438
if (!isWebkit) {
cy.get('#focus-options').select(target)
cy.get('#input-text').focus().type('{enter}')

cy.get('li').should('have.length', 3)
cy.get('li').eq(0).should('have.text', 'keypress')
cy.get('li').eq(1).should('have.text', 'click')
cy.get('li').eq(2).should('have.text', 'keyup')
}
// TODO fix this test in Webkit https://github.com/cypress-io/cypress/issues/26438
it(target, { browser: '!webkit' }, () => {
cy.get('#focus-options').select(target)
cy.get('#input-text').focus().type('{enter}')

cy.get('li').should('have.length', 3)
cy.get('li').eq(0).should('have.text', 'keypress')
cy.get('li').eq(1).should('have.text', 'click')
cy.get('li').eq(2).should('have.text', 'keyup')
})
})
})
Expand Down

0 comments on commit 932b4e0

Please sign in to comment.