Skip to content

Commit 129e1f9

Browse files
Svetoslavtsenov/update e2e tests (#1580)
1 parent 4fbc56a commit 129e1f9

File tree

113 files changed

+290
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+290
-204
lines changed

Diff for: e2e/config/appium.capabilities.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
},
3838
"android22": {
3939
"platformName": "Android",
40-
"platformVersion": "5.0",
40+
"platformVersion": "5.1",
4141
"deviceName": "Emulator-Api22-Default",
4242
"avd": "Emulator-Api22-Default",
4343
"lt": 60000,
@@ -155,6 +155,13 @@
155155
"noReset": true,
156156
"fullReset": false
157157
},
158+
"sim.iPhoneXS.latest": {
159+
"platformName": "iOS",
160+
"platformVersion": "12.1",
161+
"deviceName": "iPhone XS",
162+
"noReset": true,
163+
"fullReset": false
164+
},
158165
"sim.iPhoneXR": {
159166
"platformName": "iOS",
160167
"platformVersion": "12.0",

Diff for: e2e/renderer/app/list.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { Component } from "@angular/core";
22

33
@Component({
4+
styles: ["Button { font-size: 10; margin: 0; padding: 0 }"],
45
template: `
5-
<FlexboxLayout flexDirection="column">
6+
<FlexboxLayout flexDirection="column" >
67
<Button text="ActionBar dynamic" [nsRouterLink]="['/action-bar-dynamic']"></Button>
78
<Button text="ActionBarExtension" [nsRouterLink]="['/action-bar-extension']"></Button>
89
<Button text="ActionBarVisibility Always" [nsRouterLink]="['/action-bar-visibility-always']"></Button>

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

+24-12
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,27 @@ describe("Action Bar scenario", () => {
2121
await driver.driver.resetApp();
2222
});
2323

24+
afterEach(async function () {
25+
if (this.currentTest.state === "failed") {
26+
await driver.logTestArtifacts(this.currentTest.title);
27+
}
28+
});
29+
2430
it("should navigate to page", async () => {
2531
const navigationButton =
26-
await driver.findElementByText("ActionBar dynamic", SearchOptions.exact);
32+
await driver.findElementByAutomationText("ActionBar dynamic");
2733
await navigationButton.click();
2834

2935
const actionBar =
30-
await driver.findElementByText("Action Bar Dynamic Items", SearchOptions.exact);
36+
await driver.findElementByAutomationText("Action Bar Dynamic Items");
3137
});
3238

3339
it("should find elements", async () => {
34-
firstActionItem = await driver.findElementByText("one");
35-
secondActionItem = await driver.findElementByText("two");
40+
firstActionItem = await driver.findElementByAutomationText("one");
41+
secondActionItem = await driver.findElementByAutomationText("two");
3642

37-
toggleFirstButton = await driver.findElementByText("toggle 1");
38-
toggleSecondButton = await driver.findElementByText("toggle 2");
43+
toggleFirstButton = await driver.findElementByAutomationText("toggle 1");
44+
toggleSecondButton = await driver.findElementByAutomationText("toggle 2");
3945
});
4046

4147
it("should initially render the action items in the correct order", async () => {
@@ -47,7 +53,7 @@ describe("Action Bar scenario", () => {
4753
await toggleFirst();
4854

4955
try {
50-
await driver.findElementByText("one", SearchOptions.exact);
56+
await driver.findElementByAutomationText("one");
5157
} catch (e) {
5258
done();
5359
}
@@ -64,7 +70,7 @@ describe("Action Bar scenario", () => {
6470
await toggleSecond();
6571

6672
try {
67-
await driver.findElementByText("two", SearchOptions.exact);
73+
await driver.findElementByAutomationText("two");
6874
} catch (e) {
6975
done();
7076
}
@@ -109,23 +115,29 @@ describe("Action Bar scenario", () => {
109115
await driver.driver.resetApp();
110116
});
111117

118+
afterEach(async function () {
119+
if (this.currentTest.state === "failed") {
120+
await driver.logTestArtifacts(this.currentTest.title);
121+
}
122+
});
123+
112124
it("should navigate to page", async () => {
113125
const navigationButton =
114-
await driver.findElementByText("ActionBarExtension", SearchOptions.exact);
126+
await driver.findElementByAutomationText("ActionBarExtension");
115127
await navigationButton.click();
116128
});
117129

118130
it("should find elements", async () => {
119-
toggleButton = await driver.findElementByText("toggle");
120-
conditional = await driver.findElementByText("conditional");
131+
toggleButton = await driver.findElementByAutomationText("toggle");
132+
conditional = await driver.findElementByAutomationText("conditional");
121133
});
122134

123135
it("should detach conditional action item when its condition is false", done => {
124136
(async () => {
125137
await toggle();
126138

127139
try {
128-
await driver.findElementByText("conditional", SearchOptions.exact);
140+
await driver.findElementByAutomationText("conditional");
129141
} catch (e) {
130142
done();
131143
}

Diff for: e2e/renderer/e2e/ngfor.e2e-spec.ts

+16-10
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,28 @@ describe("ngFor scenario", () => {
1919
await driver.driver.resetApp();
2020
});
2121

22+
afterEach(async function () {
23+
if (this.currentTest.state === "failed") {
24+
await driver.logTestArtifacts(this.currentTest.title);
25+
}
26+
});
27+
2228
it("should navigate to page", async () => {
2329
const navigationButton =
24-
await driver.findElementByText("NgFor", SearchOptions.exact);
30+
await driver.findElementByAutomationText("NgFor");
2531
await navigationButton.click();
2632

2733
const actionBar =
28-
await driver.findElementByText("ngFor", SearchOptions.exact);
34+
await driver.findElementByAutomationText("ngFor");
2935
});
3036

3137
it("should find elements", async () => {
32-
const first = await driver.findElementByText(
33-
lastAddedElementId.toString(), SearchOptions.exact);
38+
const first = await driver.findElementByAutomationText(
39+
lastAddedElementId.toString());
3440
elements.push(first);
3541

36-
addButton = await driver.findElementByText("add", SearchOptions.exact);
37-
removeButton = await driver.findElementByText("remove", SearchOptions.exact);
42+
addButton = await driver.findElementByAutomationText("add");
43+
removeButton = await driver.findElementByAutomationText("remove");
3844

3945
await isAbove(first, addButton);
4046
});
@@ -75,8 +81,8 @@ describe("ngFor scenario", () => {
7581
await addButton.click();
7682

7783
lastAddedElementId += 1;
78-
const newElement = await driver.findElementByText(
79-
lastAddedElementId.toString(), SearchOptions.exact);
84+
const newElement = await driver.findElementByAutomationText(
85+
lastAddedElementId.toString());
8086

8187
elements.push(newElement);
8288
};
@@ -96,8 +102,8 @@ describe("ngFor scenario", () => {
96102
};
97103

98104
const checkAppendedCorrectly = async () => {
99-
const lastAdded = await driver.findElementByText(
100-
lastAddedElementId.toString(), SearchOptions.exact);
105+
const lastAdded = await driver.findElementByAutomationText(
106+
lastAddedElementId.toString());
101107

102108
await isAbove(elements.slice(-2)[0], lastAdded);
103109
await isAbove(lastAdded, addButton);

Diff for: e2e/renderer/e2e/ngforof.e2e-spec.ts

+14-8
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,27 @@ describe("ngForOf scenario", function () {
2525
await driver.driver.resetApp();
2626
});
2727

28+
afterEach(async function () {
29+
if (this.currentTest.state === "failed") {
30+
await driver.logTestArtifacts(this.currentTest.title);
31+
}
32+
});
33+
2834
it("should navigate to page", async () => {
2935
const navigationButton =
30-
await driver.findElementByText("NgForOf", SearchOptions.exact);
36+
await driver.findElementByAutomationText("NgForOf");
3137
await navigationButton.click();
3238

3339
const actionBar =
34-
await driver.findElementByText("ngForOf", SearchOptions.exact);
40+
await driver.findElementByAutomationText("ngForOf");
3541
});
3642

3743
it("should find elements", async () => {
3844
const firstElement = await getElement(lastAddedElementId);
3945
elements.push(firstElement);
4046

41-
addButton = await driver.findElementByText("add", SearchOptions.exact);
42-
removeButton = await driver.findElementByText("remove", SearchOptions.exact);
47+
addButton = await driver.findElementByAutomationText("add");
48+
removeButton = await driver.findElementByAutomationText("remove");
4349

4450
await elementTupleCorrectlyRendered(firstElement);
4551
await isAbove(firstElement.button, addButton);
@@ -150,11 +156,11 @@ describe("ngForOf scenario", function () {
150156
button = await driver.findElementByAccessibilityId(
151157
id.toString());
152158
} else {
153-
label = await driver.findElementByText(
154-
"label: " + id.toString(), SearchOptions.exact);
159+
label = await driver.findElementByAutomationText(
160+
"label: " + id.toString());
155161

156-
button = await driver.findElementByText(
157-
id.toString(), SearchOptions.exact);
162+
button = await driver.findElementByAutomationText(
163+
id.toString());
158164
}
159165

160166
return { label, button };

0 commit comments

Comments
 (0)