From 29dc9a24f270039e3f81f3dddcd8e9dd9e4f9c9d Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Wed, 25 Oct 2017 01:03:43 +0300 Subject: [PATCH] tests: update mapping of elements in ngForOf scenario for ios (#1054) --- e2e/renderer/e2e/ngforof.e2e-spec.ts | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/e2e/renderer/e2e/ngforof.e2e-spec.ts b/e2e/renderer/e2e/ngforof.e2e-spec.ts index 23f6b0eee..e82406777 100644 --- a/e2e/renderer/e2e/ngforof.e2e-spec.ts +++ b/e2e/renderer/e2e/ngforof.e2e-spec.ts @@ -12,7 +12,8 @@ interface ElementTuple { button: UIElement, } -describe("ngForOf scenario", () => { +describe("ngForOf scenario", function () { + this.retries(2); let driver: AppiumDriver; let addButton: UIElement; let removeButton: UIElement; @@ -94,7 +95,11 @@ describe("ngForOf scenario", () => { await button.click(); } else { index = elements.length - 1; - await removeButton.click(); + if (driver.platformName.toLowerCase().includes("ios")) { + await removeButton.tap(); + } else { + await removeButton.click(); + } } elements.splice(index, 1); @@ -135,11 +140,22 @@ describe("ngForOf scenario", () => { }; const getElement = async (id: number) => { - const label = await driver.findElementByText( - "label: " + id.toString(), SearchOptions.exact); + let label = null; + let button = null; + + if (driver.platformName.toLowerCase().includes("ios")) { + label = await driver.findElementByAccessibilityId( + "label: " + id.toString()); + + button = await driver.findElementByAccessibilityId( + id.toString()); + } else { + label = await driver.findElementByText( + "label: " + id.toString(), SearchOptions.exact); - const button = await driver.findElementByText( - id.toString(), SearchOptions.exact); + button = await driver.findElementByText( + id.toString(), SearchOptions.exact); + } return { label, button }; };