Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions example/e2e/renderItems.e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const SCREENS = {
};

const DELAY = 2 * 1000;
const ANIMATION_SETTLE_TIMEOUT = 500;

describe('example with renderItems and data', () => {
beforeAll(async () => {
Expand All @@ -31,54 +32,54 @@ describe('example with renderItems and data', () => {
.toBeVisible()
.withTimeout(DELAY);

await expect(element(by.id(SCREENS.one))).toBeNotVisible();
await expect(element(by.id(SCREENS.two))).toBeNotVisible();
await expect(element(by.id(SCREENS.three))).toBeNotVisible();
await expect(element(by.id(SCREENS.fourth))).toBeNotVisible();
await waitFor(element(by.id(SCREENS.one))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.two))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.three))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.fourth))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);

// after 2s => screen with one
await new Promise((_) => setTimeout(_, DELAY / 2));
await waitFor(element(by.id(SCREENS.one)))
.toBeVisible()
.withTimeout(DELAY);

await expect(element(by.id(SCREENS.zero))).toBeNotVisible();
await expect(element(by.id(SCREENS.two))).toBeNotVisible();
await expect(element(by.id(SCREENS.three))).toBeNotVisible();
await expect(element(by.id(SCREENS.fourth))).toBeNotVisible();
await waitFor(element(by.id(SCREENS.zero))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.two))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.three))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.fourth))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);

// after 4s => screen with two
await new Promise((_) => setTimeout(_, DELAY / 2));
await waitFor(element(by.id(SCREENS.two)))
.toBeVisible()
.withTimeout(DELAY);

await expect(element(by.id(SCREENS.zero))).toBeNotVisible();
await expect(element(by.id(SCREENS.one))).toBeNotVisible();
await expect(element(by.id(SCREENS.three))).toBeNotVisible();
await expect(element(by.id(SCREENS.fourth))).toBeNotVisible();
await waitFor(element(by.id(SCREENS.zero))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.one))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.three))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.fourth))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);

// after 6s => screen with three
await new Promise((_) => setTimeout(_, DELAY / 2));
await waitFor(element(by.id(SCREENS.three)))
.toBeVisible()
.withTimeout(DELAY);

await expect(element(by.id(SCREENS.zero))).toBeNotVisible();
await expect(element(by.id(SCREENS.one))).toBeNotVisible();
await expect(element(by.id(SCREENS.two))).toBeNotVisible();
await expect(element(by.id(SCREENS.fourth))).toBeNotVisible();
await waitFor(element(by.id(SCREENS.zero))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.one))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.two))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.fourth))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);

// after 8s => screen with fourth
await new Promise((_) => setTimeout(_, DELAY / 2));
await waitFor(element(by.id(SCREENS.fourth)))
.toBeVisible()
.withTimeout(DELAY);

await expect(element(by.id(SCREENS.zero))).toBeNotVisible();
await expect(element(by.id(SCREENS.one))).toBeNotVisible();
await expect(element(by.id(SCREENS.two))).toBeNotVisible();
await expect(element(by.id(SCREENS.three))).toBeNotVisible();
await waitFor(element(by.id(SCREENS.zero))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.one))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.two))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
await waitFor(element(by.id(SCREENS.three))).toBeNotVisible().withTimeout(ANIMATION_SETTLE_TIMEOUT);
});

// https://github.com/wix/Detox/blob/master/docs/APIRef.ActionsOnElement.md#swipedirection-speed-percentage
Expand Down