Skip to content

chore: add new test for #1771 #1791

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 2 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ ng-sample/app/**/*.js
# Webpack configuration files
webpack.config.js
tsconfig.esm.json
tsconfig.tns.json

# IDEs and editors
/.idea
Expand Down
2 changes: 1 addition & 1 deletion e2e/config/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--timeout 140000
--timeout 60000
--recursive e2e
--reporter mocha-multi
--reporter-options spec=-,mocha-junit-reporter=test-results.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { ModalViewComponent } from "~/modal-shared/modal-view.component";
<Button text="Show Modal Without Frame" (tap)="onModalNoFrame()" textAlignment="left"></Button>
<Button text="Show Modal Page With Frame" (tap)="onModalFrame()" textAlignment="left"></Button>
<Button text="Show Shared Modal" (tap)="onRootModalTap()" textAlignment="left"></Button>
<Button #popoverButtonComp text="Show shared 'popover' modal" (tap)="onPopoverModal()" textAlignment="left"></Button>
<Button text="Show Dialog" (tap)="onShowDialog()" textAlignment="left"></Button>
<Button #popoverButtonComp text="Show 'popover' modal" (tap)="onPopoverModal()" textAlignment="left"></Button>
</StackLayout>`
})

Expand Down
7 changes: 6 additions & 1 deletion e2e/modal-navigation-ng/e2e/modal.shared.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("modal-shared:", () => {
});

roots.forEach(root => {
describe("Shared modal from second and back", () => {
describe("Shared modal from home component and back", () => {

before(async () => {
await screen[root]();
Expand Down Expand Up @@ -46,6 +46,11 @@ describe("modal-shared:", () => {
await screen.closeModal();
});

it("should open/close shared modal with presentation style from home component", async () => {
await screen.loadSharedModalWithPresentationStyle(true);
await screen.closeModal();
});

it("should find home component again", async () => {
await screen.loadedHome();
});
Expand Down
17 changes: 16 additions & 1 deletion e2e/modal-navigation-ng/e2e/screens/screen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AppiumDriver } from "nativescript-dev-appium";
import { AppiumDriver, SearchOptions } from "nativescript-dev-appium";
import { assert } from "chai";

const home = "Home Component"
Expand Down Expand Up @@ -165,6 +165,11 @@ export class Screen {
await btnTap.click();
}

private showSharedModalPresentationStyle = async () => {
const btnTap = await this._driver.findElementByText("popover", SearchOptions.contains);
await btnTap.click();
}

loadedModalPage = async () => {
const btnShowNestedModalPage = await this._driver.findElementByAutomationText(showNestedModalPage);
assert.isTrue(await btnShowNestedModalPage.isDisplayed(), `${showNestedModalPage} is not displayed`);
Expand Down Expand Up @@ -212,6 +217,7 @@ export class Screen {
}

loadedModalNoFrame = async () => {
await this._driver.wait(2000);
const btnShowDialogConfirm = await this._driver.waitForElement(showDialog);
const btnCloseModal = await this._driver.waitForElement(closeModal);
assert.isTrue(await btnShowDialogConfirm.isDisplayed());
Expand Down Expand Up @@ -309,4 +315,13 @@ export class Screen {
const lbl = await this._driver.waitForElement(sharedModalView, 5000);
assert.isTrue(await lbl.isDisplayed());
}

loadSharedModalWithPresentationStyle = async (loadShowModalPageWithFrame: boolean) => {
if (loadShowModalPageWithFrame) {
await this.showSharedModalPresentationStyle();
}

const lbl = await this._driver.waitForElement(sharedModalView, 5000);
assert.isTrue(await lbl.isDisplayed());
}
}