Skip to content

Commit 5704914

Browse files
chore: fix modal navigation tests (#1630)
1 parent 6c91167 commit 5704914

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

Diff for: e2e/modal-navigation-ng/e2e/screens/screen.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class Screen {
4444
}
4545

4646
loadedHome = async () => {
47-
const lblHome = await this._driver.findElementByAutomationText(home);
47+
const lblHome = await this._driver.waitForElement(home);
4848
assert.isTrue(await lblHome.isDisplayed());
4949
console.log(home + " loaded!");
5050
}
@@ -149,7 +149,7 @@ export class Screen {
149149
}
150150

151151
loadedModalFrame = async () => {
152-
const lblModal = await this._driver.findElementByAutomationText(modal, 1000);
152+
const lblModal = await this._driver.waitForElement(modal, 5000);
153153
assert.isTrue(await lblModal.isDisplayed(), `${modal} is not displayed!`);
154154
console.log(modal + " loaded!");
155155
}
@@ -226,7 +226,7 @@ export class Screen {
226226
}
227227

228228
loadedSecondPage = async () => {
229-
const lblModalSecond = await this._driver.findElementByAutomationText(modalSecond);
229+
const lblModalSecond = await this._driver.waitForElement(modalSecond, 5000);
230230
assert.isTrue(await lblModalSecond.isDisplayed());
231231
console.log(modalSecond + " loaded!");
232232
}
@@ -259,7 +259,7 @@ export class Screen {
259259
}
260260

261261
loadedNestedModalFrame = async () => {
262-
const lblModalNested = await this._driver.findElementByAutomationText(modalNested);
262+
const lblModalNested = await this._driver.waitForElement(modalNested, 5000);
263263
assert.isTrue(await lblModalNested.isDisplayed());
264264
console.log(modalNested + " loaded!");
265265
}

Diff for: e2e/renderer/e2e/action-bar.e2e-spec.ts

+5-10
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
} from "nativescript-dev-appium";
77

88
import { isOnTheLeft } from "./helpers/location";
9+
import { assert } from "chai";
910

1011
describe("Action Bar scenario", () => {
1112
let driver: AppiumDriver;
@@ -132,16 +133,10 @@ describe("Action Bar scenario", () => {
132133
conditional = await driver.findElementByAutomationText("conditional");
133134
});
134135

135-
it("should detach conditional action item when its condition is false", done => {
136-
(async () => {
137-
await toggle();
138-
139-
try {
140-
await driver.findElementByAutomationText("conditional");
141-
} catch (e) {
142-
done();
143-
}
144-
})();
136+
it("should detach conditional action item when its condition is false", async () => {
137+
await toggle();
138+
const conditionalBtn = await driver.waitForElement("conditional", 1000);
139+
assert.isUndefined(conditionalBtn, "Conditional button should not be visible!");
145140
});
146141

147142
it("should reattach conditional action item at correct place", async () => {
Loading

0 commit comments

Comments
 (0)