FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test: update test samples by SvetoslavTsenov · Pull Request #7016 · NativeScript/NativeScript · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension .ts  (8) .xml  (10) All 2 file types selected
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion apps/app/ui-tests-app/action-bar/icons.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</ActionBar>
</Page.actionBar>
<StackLayout>
<Button text="go to cleared page" tap="navigate"/>
<Button text="go to cleared page" automationText="goToClearedPage" tap="navigate"/>
<Button text="undefined" tap="onChangeRenderingMode"/>
</StackLayout>
</Page>
2 changes: 1 addition & 1 deletion apps/app/ui-tests-app/action-bar/local-icons.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</ActionBar>
</Page.actionBar>
<StackLayout>
<Button text="go to cleared page" tap="navigate"/>
<Button text="go to cleared page" automationText="goToClearedPage" tap="navigate"/>
<Button text="undefined" tap="onChangeRenderingMode"/>
</StackLayout>
</Page>
17 changes: 0 additions & 17 deletions apps/app/ui-tests-app/intent/main-page.ts

This file was deleted.

6 changes: 0 additions & 6 deletions apps/app/ui-tests-app/intent/main-page.xml

This file was deleted.

5 changes: 0 additions & 5 deletions apps/app/ui-tests-app/intent/open-file.xml

This file was deleted.

1 change: 1 addition & 0 deletions apps/app/ui-tests-app/issues/main-page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function loadExamples() {
examples.set("ng-repo-1599", "issues/issue-ng-repo-1599");
examples.set("ng-repo-1626", "issues/issue-ng-repo-1626");
examples.set("6439", "issues/issue-6439");
examples.set("open-file-6895", "issues/open-file-6895")

return examples;
}
5 changes: 5 additions & 0 deletions apps/app/ui-tests-app/issues/open-file-6895.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Page navigatingTo="navigatingTo">
<GridLayout id="root">
<Button text="Open File" automationText="openFile" tap="openFile" height="40"></Button>
</GridLayout>
</Page>
39 changes: 28 additions & 11 deletions apps/app/ui-tests-app/layouts/passThroughParent.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
export function onOuterWrapLayoutTap() {
console.log("on outer wrap layout tap");
import { EventData, Page } from "tns-core-modules/ui/page/page";
import { Label } from "tns-core-modules/ui/label/label";

const setLabelTextAndLog = (args, text: string) => {
const page = <Page>args.object.page;
const label = <Label>page.getViewById("resultLabel");
label.set("text", text);
console.log("on button tap");
}

export function onStackLayoutThrowTap() {
throw new Error("Should not tap layout with IsPassThroughParentEnabled=true");
export function onTap(args: EventData) {
setLabelTextAndLog(args, "onButtonTapResult");
}

export function onUserInteractionDisabledTap() {
throw new Error("Should not tap button with IsUserInteractionEnabled=false");
export function clearResult(args: EventData) {
setLabelTextAndLog(args, "none");
}

export function onDisabledThrowTap() {
throw new Error("Should not tap button with IsEnabled=false");
export function onOuterWrapLayoutTap(args) {
setLabelTextAndLog(args, "onOuterWrapLayoutTapResult");
}

export function onTap() {
console.log("on button tap");
}
export function onStackLayoutThrowTap(args: EventData) {
setLabelTextAndLog(args, "Should not tap layout with IsPassThroughParentEnabled=true");
// throw new Error("Should not tap layout with IsPassThroughParentEnabled=true");
}

export function onUserInteractionDisabledTap(args: EventData) {
setLabelTextAndLog(args, "Should not tap button with IsUserInteractionEnabled=false");
// throw new Error("Should not tap button with IsUserInteractionEnabled=false");
}

export function onDisabledThrowTap(args: EventData) {
setLabelTextAndLog(args, "Should not tap button with IsEnabled=false");
// throw new Error("Should not tap button with IsEnabled=false");
}
36 changes: 20 additions & 16 deletions apps/app/ui-tests-app/layouts/passThroughParent.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
<Page class="page" actionBarHidden="true" xmlns="http://schemas.nativescript.org/tns.xsd">
<Page class="page" actionBarHidden="true"
xmlns="http://schemas.nativescript.org/tns.xsd">

<WrapLayout tap="onOuterWrapLayoutTap" backgroundColor="#bed3f4">

<StackLayout tap="onStackLayoutThrowTap" backgroundColor="#f3f9db" height="200" isPassThroughParentEnabled="true">
<Label text="isPassThroughParentEnabled='true'" isUserInteractionEnabled="false" />
<Button isUserInteractionEnabled="false" tap="onUserInteractionDisabledThrowTap" text="isUserInteractionEnabled='false'"></Button>
<Button isEnabled="false" tap="onDisabledThrowTap" text="isEnabled='false'"></Button>
<Button tap="onTap" text="TAP"></Button>
<WrapLayout tap="onOuterWrapLayoutTap" automationText="onOuterWrapLayoutTap" backgroundColor="#bed3f4" padding="5">
<StackLayout tap="onStackLayoutThrowTap" automationText="stackLayout1" backgroundColor="#f3f9db" height="180" isPassThroughParentEnabled="true">
<Label automationText="label1" text="isPassThroughParentEnabled='true'" isUserInteractionEnabled="false" />
<Button automationText="onUserInteractionDisabledThrowTap1" isUserInteractionEnabled="false" tap="onUserInteractionDisabledThrowTap" text="isUserInteractionEnabled='false'"></Button>
<Button automationText="onDisabledThrowTap1" isEnabled="false" tap="onDisabledThrowTap" text="isEnabled='false'"></Button>
<Button tap="onTap" text="TAP" automationText="btn1"></Button>
</StackLayout>

<StackLayout tap="onStackLayoutThrowTap" style.margin="20" height="300" width="300" backgroundColor="#f5edf7" isPassThroughParentEnabled="true">
<Label text="isPassThroughParentEnabled='true'" isUserInteractionEnabled="false" />
<StackLayout tap="onStackLayoutThrowTap" backgroundColor="#f3f9db" height="200" isPassThroughParentEnabled="true">
<Label text="isPassThroughParentEnabled='true'" isUserInteractionEnabled="false" />
<Button isUserInteractionEnabled="false" tap="onUserInteractionDisabledThrowTap" text="isUserInteractionEnabled='false'"></Button>
<Button isEnabled="false" tap="onDisabledThrowTap" text="isEnabled='false'"></Button>
<Button tap="onTap" text="TAP"></Button>
<StackLayout tap="onStackLayoutThrowTap" automationText="stackLayout2" style.margin="20" height="250" width="300" backgroundColor="#f5edf7" isPassThroughParentEnabled="true">
<Label automationText="label2" text="isPassThroughParentEnabled='true'" isUserInteractionEnabled="false" />
<StackLayout tap="onStackLayoutThrowTap" automationText="stackLayout3" backgroundColor="#f3f9db" height="200" isPassThroughParentEnabled="true">
<Label automationText="label3" text="isPassThroughParentEnabled='true'" isUserInteractionEnabled="false" />
<Button automationText="onUserInteractionDisabledThrowTap2" isUserInteractionEnabled="false" tap="onUserInteractionDisabledThrowTap" text="isUserInteractionEnabled='false'"></Button>
<Button automationText="onDisabledThrowTap2" isEnabled="false" tap="onDisabledThrowTap" text="isEnabled='false'"></Button>
<Button automationText="btn2" tap="onTap" text="TAP"></Button>
</StackLayout>
</StackLayout>

</WrapLayout>
<Button text="x" automationText="clearResult" tap="clearResult" height="35" width="40" padding="0" />

<StackLayout>
<Label id="resultLabel" textWrap="true" />
</StackLayout>
</WrapLayout>
</Page>
1 change: 0 additions & 1 deletion apps/app/ui-tests-app/main-page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export function pageLoaded(args: EventData) {
examples.set("progress-bar", "progress-bar/main-page");
examples.set("date-picker", "date-picker/date-picker");
examples.set("nested-frames", "nested-frames/main-page");
examples.set("intent", "intent/main-page");
page.bindingContext = new MainPageViewModel(wrapLayout, examples);

const parent = page.getViewById("parentLayout");
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<ScrollView id="scroll-view">
<StackLayout>
<GridLayout rows="auto, auto, auto" backgroundColor="lightgray">
<Button row="0" text="Change w/ Visibility" tap="{{ onChangeVisibility }}"></Button>
<Button row="1" text="Scroll To Bottom" tap="{{ onScrollToBottom }}"></Button>
<Button row="0" text="Change w/ Visibility" automationText="changeVisibilityTop" tap="{{ onChangeVisibility }}"></Button>
<Button row="1" text="Scroll To Bottom" automationText="scrollToBottom" tap="{{ onScrollToBottom }}"></Button>
<Label row="2" visibility="{{ isVisible ? 'visible' : 'collapsed' }}" text="{{ content }}" color="black"></Label>
</GridLayout>

<GridLayout height="2000" backgroundColor="yellow"></GridLayout>

<GridLayout rows="auto, auto, auto" backgroundColor="lightgray">
<Button row="0" text="Change w/ Visibility" tap="{{ onChangeVisibility }}"></Button>
<Button row="1" text="Scroll To Top" tap="{{ onScrollToTop }}"></Button>
<Button row="0" text="Change w/ Visibility" automationText="changeVisibilityBottom" tap="{{ onChangeVisibility }}"></Button>
<Button row="1" text="Scroll To Top" automationText="scrollToTop" tap="{{ onScrollToTop }}"></Button>
<Label row="2" visibility="{{ isVisible ? 'visible' : 'collapsed' }}" text="{{ content }}" color="black"></Label>
</GridLayout>
</StackLayout>
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<Page>
<TabView style="color: green;">
<TabView.items>
<TabViewItem title="Title" iconSource="res://add_to_fav">
<TabViewItem title="Title" automationText="tab1" iconSource="res://add_to_fav">
<TabViewItem.view>
<GridLayout>
<Label text="Title and icon" verticalAlignment="center" horizontalAlignment="center"/>
</GridLayout>
</TabViewItem.view>
</TabViewItem>
<TabViewItem iconSource="res://add_to_fav">
<TabViewItem iconSource="res://add_to_fav" automationText="tab2" >
<TabViewItem.view>
<GridLayout>
<Label text="Only icon" verticalAlignment="center" horizontalAlignment="center"/>
</GridLayout>
</TabViewItem.view>
</TabViewItem>
<TabViewItem title="Title">
<TabViewItem title="Title" automationText="tab3">
<TabViewItem.view>
<GridLayout>
<Label text="Only title" verticalAlignment="center" horizontalAlignment="center"/>
Expand Down
4 changes: 2 additions & 2 deletions apps/app/ui-tests-app/tab-view/issue-5470.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

<TabView id="tabViewContainer">
<TabView.items>
<TabViewItem title="Tab 1">
<TabViewItem title="Tab1" >
<TabViewItem.view>
<GridLayout rows="*, auto" columns="*">
<StackLayout row="0" backgroundColor="lightblue"></StackLayout>
<StackLayout row="1" backgroundColor="green" height="50"></StackLayout>
</GridLayout>
</TabViewItem.view>
</TabViewItem>
<TabViewItem title="Tab 2">
<TabViewItem title="Tab2" >
<TabViewItem.view>
<GridLayout rows="*, auto" columns="*">
<StackLayout row="0" backgroundColor="lightblue"></StackLayout>
Expand Down
5 changes: 5 additions & 0 deletions e2e/nested-frame-navigation/app/home/home-page.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export function onNavigateToTabsBottomRoot(args: EventData) {
application._resetRootView({ moduleName: "tab-root/tab-bottom-root" });
}

export function onNavigateToSomePage(args: EventData) {
const button = <Button>args.object;
button.page.frame.navigate("some-page/some-page");
}

export function onFrameToNestedFrame(args: EventData) {
const button = <Button>args.object;
button.page.frame.navigate({
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<Button text="Page w/ tabs (bottom)" tap="onNavigateToTabsBottomPage" />
<Button text="Root tabs (top)" tap="onNavigateToTabsTopRoot" />
<Button text="Root tabs (bottom)" tap="onNavigateToTabsBottomRoot" />
<Button text="Some page on root" automationText="somePageOnRoot" tap="onNavigateToSomePage" />
<Button text="Frame to NestedFrame (non-default transition)" tap="onFrameToNestedFrame" />
</StackLayout>
</GridLayout>
Expand Down
55 changes: 55 additions & 0 deletions e2e/nested-frame-navigation/e2e/issues.e2e.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { AppiumDriver, createDriver } from "nativescript-dev-appium";
import { Screen } from "./screen";
import { suspendTime, dontKeepActivities } from "./config";

describe("issues", () => {
let driver: AppiumDriver;
let screen: Screen;

before(async () => {
driver = await createDriver();
screen = new Screen(driver);
if (dontKeepActivities) {
await driver.setDontKeepActivities(true);
}
});

after(async () => {
if (dontKeepActivities) {
await driver.setDontKeepActivities(false);
}
await driver.quit();
console.log("Quit driver!");
});

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

it("issue-6488", async () => {
await screen.loadedHome();
const showSomePage = async () => {
const somePageBtn = await driver.waitForElement("somePageOnRoot");
await somePageBtn.tap();
await screen.loadedSomePage();
}

await showSomePage();

await driver.navBack();
await screen.loadedHome();

await driver.backgroundApp(suspendTime);

await showSomePage();
await driver.navBack();

await showSomePage();
await driver.navBack();

await screen.loadedHome();
});
});
14 changes: 7 additions & 7 deletions e2e/nested-frame-navigation/e2e/screen.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export class Screen {

loadedHome = async () => {
const lblHome = await this._driver.waitForElement(home);
assert.isNotNull(lblHome);
assert.isDefined(lblHome);
console.log(home + " loaded!");
};

Expand Down Expand Up @@ -329,7 +329,7 @@ export class Screen {

loadedPlayersList = async () => {
const lblPlayerOne = await this._driver.waitForElement(playersData["playerOneDefault"].name);
assert.isNotNull(lblPlayerOne);
assert.isDefined(lblPlayerOne);
console.log(players + " loaded!");
}

Expand All @@ -339,7 +339,7 @@ export class Screen {

loadedTeamsList = async () => {
const lblTeamOne = await this._driver.waitForElement(teamsData["teamOneDefault"].name);
assert.isNotNull(lblTeamOne);
assert.isDefined(lblTeamOne);
console.log(teams + " loaded!");
}

Expand All @@ -349,7 +349,7 @@ export class Screen {

loadedElement = async (element: string) => {
const el = await this._driver.waitForElement(element);
assert.isNotNull(el);
assert.isDefined(el);
console.log(`${element} loaded!`);
};

Expand All @@ -361,7 +361,7 @@ export class Screen {

private loadedPage = async (page: string) => {
const lblPage = await this._driver.waitForElement(page);
assert.isNotNull(lblPage);
assert.isDefined(lblPage);
console.log(page + " loaded!");
};

Expand All @@ -373,10 +373,10 @@ export class Screen {

private loadedItem = async (item: Item) => {
const lblItemName = await this._driver.waitForElement(item.name);
assert.isNotNull(lblItemName);
assert.isDefined(lblItemName);

const lblItemDescription = await this._driver.waitForElement(item.description);
assert.isNotNull(lblItemDescription);
assert.isDefined(lblItemDescription);

console.log(item.name + " loaded!");
}
Expand Down

Back | FazBrowse Home | New Git URL