Skip to content

Instantly share code, notes, and snippets.

@ddikodroid
Forked from xiongemi/search.spec.ts
Created November 14, 2022 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddikodroid/ced5f1f447569863ced0805864a48234 to your computer and use it in GitHub Desktop.
Save ddikodroid/ced5f1f447569863ced0805864a48234 to your computer and use it in GitHub Desktop.
example detox e2e tests for search flow
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