Skip to content

Svetoslavtsenov/update e2e tests #1580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 1, 2018
9 changes: 8 additions & 1 deletion e2e/config/appium.capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"android22": {
"platformName": "Android",
"platformVersion": "5.0",
"platformVersion": "5.1",
"deviceName": "Emulator-Api22-Default",
"avd": "Emulator-Api22-Default",
"lt": 60000,
Expand Down Expand Up @@ -155,6 +155,13 @@
"noReset": true,
"fullReset": false
},
"sim.iPhoneXS.latest": {
"platformName": "iOS",
"platformVersion": "12.1",
"deviceName": "iPhone XS",
"noReset": true,
"fullReset": false
},
"sim.iPhoneXR": {
"platformName": "iOS",
"platformVersion": "12.0",
Expand Down
3 changes: 2 additions & 1 deletion e2e/renderer/app/list.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Component } from "@angular/core";

@Component({
styles: ["Button { font-size: 10; margin: 0; padding: 0 }"],
template: `
<FlexboxLayout flexDirection="column">
<FlexboxLayout flexDirection="column" >
<Button text="ActionBar dynamic" [nsRouterLink]="['/action-bar-dynamic']"></Button>
<Button text="ActionBarExtension" [nsRouterLink]="['/action-bar-extension']"></Button>
<Button text="ActionBarVisibility Always" [nsRouterLink]="['/action-bar-visibility-always']"></Button>
Expand Down
36 changes: 24 additions & 12 deletions e2e/renderer/e2e/action-bar.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,27 @@ describe("Action Bar scenario", () => {
await driver.driver.resetApp();
});

afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logTestArtifacts(this.currentTest.title);
}
});

it("should navigate to page", async () => {
const navigationButton =
await driver.findElementByText("ActionBar dynamic", SearchOptions.exact);
await driver.findElementByAutomationText("ActionBar dynamic");
await navigationButton.click();

const actionBar =
await driver.findElementByText("Action Bar Dynamic Items", SearchOptions.exact);
await driver.findElementByAutomationText("Action Bar Dynamic Items");
});

it("should find elements", async () => {
firstActionItem = await driver.findElementByText("one");
secondActionItem = await driver.findElementByText("two");
firstActionItem = await driver.findElementByAutomationText("one");
secondActionItem = await driver.findElementByAutomationText("two");

toggleFirstButton = await driver.findElementByText("toggle 1");
toggleSecondButton = await driver.findElementByText("toggle 2");
toggleFirstButton = await driver.findElementByAutomationText("toggle 1");
toggleSecondButton = await driver.findElementByAutomationText("toggle 2");
});

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

try {
await driver.findElementByText("one", SearchOptions.exact);
await driver.findElementByAutomationText("one");
} catch (e) {
done();
}
Expand All @@ -64,7 +70,7 @@ describe("Action Bar scenario", () => {
await toggleSecond();

try {
await driver.findElementByText("two", SearchOptions.exact);
await driver.findElementByAutomationText("two");
} catch (e) {
done();
}
Expand Down Expand Up @@ -109,23 +115,29 @@ describe("Action Bar scenario", () => {
await driver.driver.resetApp();
});

afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logTestArtifacts(this.currentTest.title);
}
});

it("should navigate to page", async () => {
const navigationButton =
await driver.findElementByText("ActionBarExtension", SearchOptions.exact);
await driver.findElementByAutomationText("ActionBarExtension");
await navigationButton.click();
});

it("should find elements", async () => {
toggleButton = await driver.findElementByText("toggle");
conditional = await driver.findElementByText("conditional");
toggleButton = await driver.findElementByAutomationText("toggle");
conditional = await driver.findElementByAutomationText("conditional");
});

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

try {
await driver.findElementByText("conditional", SearchOptions.exact);
await driver.findElementByAutomationText("conditional");
} catch (e) {
done();
}
Expand Down
26 changes: 16 additions & 10 deletions e2e/renderer/e2e/ngfor.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,28 @@ describe("ngFor scenario", () => {
await driver.driver.resetApp();
});

afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logTestArtifacts(this.currentTest.title);
}
});

it("should navigate to page", async () => {
const navigationButton =
await driver.findElementByText("NgFor", SearchOptions.exact);
await driver.findElementByAutomationText("NgFor");
await navigationButton.click();

const actionBar =
await driver.findElementByText("ngFor", SearchOptions.exact);
await driver.findElementByAutomationText("ngFor");
});

it("should find elements", async () => {
const first = await driver.findElementByText(
lastAddedElementId.toString(), SearchOptions.exact);
const first = await driver.findElementByAutomationText(
lastAddedElementId.toString());
elements.push(first);

addButton = await driver.findElementByText("add", SearchOptions.exact);
removeButton = await driver.findElementByText("remove", SearchOptions.exact);
addButton = await driver.findElementByAutomationText("add");
removeButton = await driver.findElementByAutomationText("remove");

await isAbove(first, addButton);
});
Expand Down Expand Up @@ -75,8 +81,8 @@ describe("ngFor scenario", () => {
await addButton.click();

lastAddedElementId += 1;
const newElement = await driver.findElementByText(
lastAddedElementId.toString(), SearchOptions.exact);
const newElement = await driver.findElementByAutomationText(
lastAddedElementId.toString());

elements.push(newElement);
};
Expand All @@ -96,8 +102,8 @@ describe("ngFor scenario", () => {
};

const checkAppendedCorrectly = async () => {
const lastAdded = await driver.findElementByText(
lastAddedElementId.toString(), SearchOptions.exact);
const lastAdded = await driver.findElementByAutomationText(
lastAddedElementId.toString());

await isAbove(elements.slice(-2)[0], lastAdded);
await isAbove(lastAdded, addButton);
Expand Down
22 changes: 14 additions & 8 deletions e2e/renderer/e2e/ngforof.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,27 @@ describe("ngForOf scenario", function () {
await driver.driver.resetApp();
});

afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logTestArtifacts(this.currentTest.title);
}
});

it("should navigate to page", async () => {
const navigationButton =
await driver.findElementByText("NgForOf", SearchOptions.exact);
await driver.findElementByAutomationText("NgForOf");
await navigationButton.click();

const actionBar =
await driver.findElementByText("ngForOf", SearchOptions.exact);
await driver.findElementByAutomationText("ngForOf");
});

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

addButton = await driver.findElementByText("add", SearchOptions.exact);
removeButton = await driver.findElementByText("remove", SearchOptions.exact);
addButton = await driver.findElementByAutomationText("add");
removeButton = await driver.findElementByAutomationText("remove");

await elementTupleCorrectlyRendered(firstElement);
await isAbove(firstElement.button, addButton);
Expand Down Expand Up @@ -150,11 +156,11 @@ describe("ngForOf scenario", function () {
button = await driver.findElementByAccessibilityId(
id.toString());
} else {
label = await driver.findElementByText(
"label: " + id.toString(), SearchOptions.exact);
label = await driver.findElementByAutomationText(
"label: " + id.toString());

button = await driver.findElementByText(
id.toString(), SearchOptions.exact);
button = await driver.findElementByAutomationText(
id.toString());
}

return { label, button };
Expand Down
Loading