Created
April 11, 2022 04:08
-
-
Save xiongemi/f837311ea3639243c30be09dbfc3a87a to your computer and use it in GitHub Desktop.
example detox e2e tests for search flow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { device, element, by, expect } from 'detox'; | |
describe('Search', () => { | |
beforeEach(async () => { | |
await device.reloadReactNative(); | |
}); | |
it('should show a list of results and go to film details', async () => { | |
await waitFor(element(by.id('search-page'))) | |
.toBeVisible() | |
.withTimeout(5000); | |
await expect(element(by.id('search-input'))).toBeVisible(); | |
await element(by.id('search-input')).clearText(); | |
await element(by.id('search-input')).typeText('totoro'); | |
await element(by.id('search-button')).tap(); | |
await waitFor(element(by.id('results-page'))) | |
.toBeVisible() | |
.withTimeout(5000); | |
await element(by.id('result-list-item')).atIndex(0).tap(); | |
await waitFor(element(by.id('film-page'))) | |
.toBeVisible() | |
.withTimeout(5000); | |
await expect(element(by.id('title'))).toBeVisible(); | |
await expect(element(by.id('title'))).toHaveText( | |
'My Neighbor Totoro' | |
); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment