-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
address_search.cy.js
41 lines (30 loc) · 1.27 KB
/
address_search.cy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
context('Address search', () => {
beforeEach(() => {
cy.symfonyConsole('coopcycle:fixtures:load -f cypress/fixtures/checkout.yml')
})
it('search address with useless address details', () => {
cy.visit('/fr/')
// Start typing "4 av victoria paris 4"
cy.get('[data-search="address"] input[type="search"]')
.type('4 av victoria paris 4', { timeout: 5000, delay: 30 })
cy.get('[data-search="address"]')
.find('ul[role="listbox"] li', { timeout: 5000 })
.invoke('text')
.should('include', '4 Avenue Victoria, 75004 Paris, France')
// Lose focus
cy.get('.react-autosuggest__input.address-autosuggest__input').blur()
// Set focus again
cy.get('.react-autosuggest__input.address-autosuggest__input').focus()
cy.get('[data-search="address"]')
.find('ul[role="listbox"] li', { timeout: 5000 })
.invoke('text')
.should('include', '4 Avenue Victoria, 75004 Paris, France')
// Delete 2 chars
cy.get('[data-search="address"] input[type="search"]')
.type('{backspace}{backspace}', { timeout: 5000, delay: 30 })
cy.get('[data-search="address"]')
.find('ul[role="listbox"] li', { timeout: 5000 })
.invoke('text')
.should('include', '4 Avenue Victoria, 75004 Paris, France')
})
})