Skip to content

Commit

Permalink
test: fix cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed Dec 11, 2018
1 parent 6c2e57d commit 4ea7b2c
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions cypress/integration/combobox.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// the combobox happens to be in the center of the page.
// without specifying an x and y for the body events
// we actually wind up firing events on the combobox.
const bodyX = 100
const bodyY = 300

describe('combobox', () => {
before(() => {
cy.visit('/tests/combobox')
Expand Down Expand Up @@ -36,7 +42,7 @@ describe('combobox', () => {
.type('{downarrow}{enter}') // open and select first item
.should('have.value', 'Black')
.get('body')
.click()
.click(bodyX, bodyY)
.getByTestId('combobox-input')
.should('have.value', 'Black')
})
Expand All @@ -61,12 +67,12 @@ describe('combobox', () => {
.should('have.value', 'R')
.click()
.get('body')
.trigger('mouseup')
.trigger('mouseup', bodyX, bodyY)
.getByTestId('combobox-input')
.should('have.value', 'R')
.blur()
.get('body')
.trigger('click')
.trigger('click', bodyX, bodyY)
.getByTestId('combobox-input')
.should('have.value', 'Red')
})
Expand Down Expand Up @@ -107,8 +113,8 @@ describe('combobox', () => {
cy.getByTestId('combobox-input')
.type('re')
.get('body')
.trigger('touchstart')
.trigger('touchend')
.trigger('touchstart', bodyX, bodyY)
.trigger('touchend', bodyX, bodyY)
.queryByTestId('downshift-item-0', {timeout: 10})
.should('not.be.visible')
})
Expand All @@ -117,9 +123,9 @@ describe('combobox', () => {
cy.getByTestId('combobox-input')
.type('re')
.get('body')
.trigger('touchstart')
.trigger('touchmove')
.trigger('touchend')
.trigger('touchstart', bodyX, bodyY)
.trigger('touchmove', bodyX, bodyY + 20)
.trigger('touchend', bodyX, bodyY + 20)
.queryByTestId('downshift-item-0', {timeout: 10})
.should('be.visible')
})
Expand Down

0 comments on commit 4ea7b2c

Please sign in to comment.