-
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathqrcodeCamera.test.ts
More file actions
100 lines (78 loc) · 3.09 KB
/
qrcodeCamera.test.ts
File metadata and controls
100 lines (78 loc) · 3.09 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import "detox";
import { byWebDataTestId, waitForWebview } from "./helper";
import { expect } from "detox";
async function expectServerForm() {
await expect(element(by.id("@serverFormTitle/input"))).toHaveText(
"Local Auth",
);
await expect(element(by.id("@serverFormUrl/input"))).toHaveText(
"http://localhost:7080",
);
await expect(element(by.id("@serverFormAuthUser/input"))).toHaveText("admin");
await expect(element(by.id("@serverFormAuthPassword/input"))).toHaveText(
"secret",
);
}
describe("QRCode", () => {
it("onboarding: open and close", async () => {
await device.launchApp({ resetAppState: true });
await element(by.id("manualEntry")).tap();
await element(by.id("scanQrcodeButtonAddserverform")).tap();
await element(by.id("headerCloseIcon")).tap();
await element(by.id("headerCloseIcon")).tap();
await expect(element(by.id("serverScreenTitle"))).toExist();
});
it("onboarding: add server by qrcode button", async () => {
await device.launchApp({ resetAppState: true });
await element(by.id("manualEntry")).tap();
await element(by.id("scanQrcodeButtonAddserverform")).tap();
await element(by.id("testQrCodeDetected")).tap();
await expectServerForm();
await element(by.id("serverFormCheckAndSave")).tap();
await waitForWebview();
});
it("onboarding: add server by serverform button", async () => {
await device.launchApp({ resetAppState: true });
await element(by.id("scanQrcodeButtonOnboarding")).tap();
await element(by.id("testQrCodeDetected")).tap();
await expectServerForm();
await element(by.id("serverFormCheckAndSave")).tap();
await waitForWebview();
});
it("switchserver: open and close", async () => {
await device.launchApp({
url: "evcc://server?url=localhost:7070&title=siteTitle",
resetAppState: true,
});
await element(by.id("serverFormCheckAndSave")).tap();
await waitForWebview();
await byWebDataTestId("tab-more").tap();
await byWebDataTestId("tab-more-app").tap();
await element(by.id("addServerIcon")).tap();
await element(by.id("scanQrcodeButtonAddserverform")).tap();
await element(by.id("headerCloseIcon")).tap();
await element(by.id("headerBackIcon")).tap();
await waitFor(element(by.id("server0")))
.toExist()
.withTimeout(20000);
await expect(element(by.id("server1"))).not.toExist();
});
it("switchserver: add server by serverform button", async () => {
await device.launchApp({
url: "evcc://server?url=localhost:7070&title=siteTitle",
resetAppState: true,
});
await element(by.id("serverFormCheckAndSave")).tap();
await waitForWebview();
await byWebDataTestId("tab-more").tap();
await byWebDataTestId("tab-more-app").tap();
await element(by.id("addServerIcon")).tap();
await element(by.id("scanQrcodeButtonAddserverform")).tap();
await element(by.id("testQrCodeDetected")).tap();
await expectServerForm();
await element(by.id("serverFormCheckAndSave")).tap();
await waitFor(element(by.id("server1")))
.toExist()
.withTimeout(20000);
});
});