-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathjavascript.jasmine.sample.e2e-spec.js
40 lines (32 loc) · 1.27 KB
/
javascript.jasmine.sample.e2e-spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const nsAppium = require("nativescript-dev-appium");
describe("sample scenario", () => {
let driver;
beforeAll(async () => {
driver = await nsAppium.createDriver();
});
afterAll(async () => {
await driver.quit();
console.log("Quit driver!");
});
afterEach(async function () {
await driver.logTestArtifacts("failure");
});
it("should find an element by text", async () => {
const btnTap = await driver.findElementByAutomationText("TAP");
await btnTap.click();
const message = " taps left";
const lblMessage = await driver.findElementByText(message, nsAppium.SearchOptions.contains);
expect(await lblMessage.text()).toContain("41");
// Image verification
// const screen = await driver.compareScreen("hello-world-41");
// assert.isTrue(screen);
// expect(screen).toBeTruthy();
});
it("should find an element by type", async () => {
const btnTap = await driver.findElementByClassName(driver.locators.button);
await btnTap.click();
const message = " taps left";
const lblMessage = await driver.findElementByText(message, nsAppium.SearchOptions.contains);
expect(await lblMessage.text()).toContain("40");
});
});