Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 6f61890

Browse files
vchimevvchimev
vchimev
authored and
vchimev
committed
text(TypeScriptApp): update resources and tests
1 parent 7f2b264 commit 6f61890

File tree

7 files changed

+19
-22
lines changed

7 files changed

+19
-22
lines changed

Diff for: demo/TypeScriptApp/app/main-page.android.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ https://docs.nativescript.org/ui/components.
2424
class names available for styling your app at https://docs.nativescript.org/ui/theme.
2525
-->
2626
<StackLayout class="p-20">
27-
<GridLayout rows="auto, auto, auto" columns="auto, auto">
28-
<GridLayout row="0" automationText="styleInline" width="30px" height="30px" backgroundColor="#7F9" margin="10px" />
27+
<GridLayout rows="50px, 50px, 50px" columns="50px, auto">
28+
<GridLayout row="0" automationText="styleInline" width="30px" height="30px" backgroundColor="#7F9" />
2929
<Label row="0" col="1" text="inline style" verticalAlignment="center" />
30-
<GridLayout row="1" automationText="stylePage" width="30px" height="30px" class="page-class" margin="10px" />
30+
<GridLayout row="1" automationText="stylePage" width="30px" height="30px" class="page-class" />
3131
<Label row="1" col="1" text="page style" verticalAlignment="center" />
32-
<GridLayout row="2" automationText="styleApp" width="30px" height="30px" class="app-class" margin="10px" />
32+
<GridLayout row="2" automationText="styleApp" width="30px" height="30px" class="app-class" />
3333
<Label row="2" col="1" text="app style" verticalAlignment="center" />
3434
</GridLayout>
3535
<Label text="Tap the button" class="h1 text-center"/>

Diff for: demo/TypeScriptApp/app/main-page.ios.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ https://docs.nativescript.org/ui/components.
2424
class names available for styling your app at https://docs.nativescript.org/ui/theme.
2525
-->
2626
<StackLayout class="p-20">
27-
<GridLayout rows="auto, auto, auto" columns="auto, auto">
28-
<GridLayout row="0" automationText="styleInline" width="30px" height="30px" backgroundColor="#999" margin="10px" />
27+
<GridLayout rows="50px, 50px, 50px" columns="50px, auto">
28+
<GridLayout row="0" automationText="styleInline" width="30px" height="30px" backgroundColor="#999" />
2929
<Label row="0" col="1" text="inline style" verticalAlignment="center" />
30-
<GridLayout row="1" automationText="stylePage" width="30px" height="30px" class="page-class" margin="10px" />
30+
<GridLayout row="1" automationText="stylePage" width="30px" height="30px" class="page-class" />
3131
<Label row="1" col="1" text="page style" verticalAlignment="center" />
32-
<GridLayout row="2" automationText="styleApp" width="30px" height="30px" class="app-class" margin="10px" />
32+
<GridLayout row="2" automationText="styleApp" width="30px" height="30px" class="app-class" />
3333
<Label row="2" col="1" text="app style" verticalAlignment="center" />
3434
</GridLayout>
3535
<Label text="Tap the button" class="h1 text-center"/>

Diff for: demo/TypeScriptApp/app/views/second-page.xml

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="onNavigatingTo" class="page">
22
<Page.actionBar>
3-
<ActionBar title="Second Page" icon="" class="action-bar">
4-
</ActionBar>
3+
<ActionBar title="Second Page" icon="" class="action-bar"></ActionBar>
54
</Page.actionBar>
65
<GridLayout>
7-
<Button automationText="btn" text="0" width="110" height="110" tap="secondPageTap" />
6+
<Button text="0" width="110" height="110" tap="secondPageTap" />
87
</GridLayout>
9-
</Page>
8+
</Page>
Binary file not shown.
Loading

Diff for: demo/TypeScriptApp/e2e/tests.e2e-spec.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ describe("sample scenario", () => {
3434
await btnNav.tap();
3535

3636
const secondPage = await driver.findElementByText("Second Page");
37-
const btn = await driver.findElementByText("btn");
38-
39-
const result = await driver.compareElement(btn, getButtonImageName());
40-
assert.isTrue(result);
41-
42-
await btn.tap();
43-
assert.equal(await btn.text(), 1);
37+
const btnZero = await driver.findElementByText("0");
38+
await btnZero.tap();
4439

40+
// In iOS, the `automationText` property applies on both `name` and `label`:
41+
// https://github.com/NativeScript/NativeScript/issues/3150
42+
// <XCUIElementTypeButton type="XCUIElementTypeButton" name="0" label="0" enabled="true" visible="true" x="132" y="395" width="111" height="110"/>
43+
// <XCUIElementTypeButton type="XCUIElementTypeButton" name="btn" label="btn" enabled="true" visible="true" x="132" y="395" width="111" height="110"/>
44+
const btnOne = await driver.findElementByText("1");
4545
await driver.navBack();
4646
});
4747

@@ -63,12 +63,10 @@ describe("sample scenario", () => {
6363
for (let styleType in styleTypes) {
6464
it(`should find an element with ${styleType} style applied`, async function () {
6565
const element = await driver.findElementByText(styleTypes[styleType]);
66-
const result = await driver.compareElement(element, getPlatformImageName());
66+
const result = await driver.compareElement(element, "style");
6767
assert.isTrue(result);
6868
});
6969
}
7070

71-
const getButtonImageName = () => { return driver.isAndroid ? "btnAndroid" : "btnIOS"; }
72-
const getPlatformImageName = () => { return driver.isAndroid ? "styleAndroid" : "styleIOS"; }
7371
const getPlatformLabel = async () => { return driver.isAndroid ? await driver.findElementByText("android") : await driver.findElementByText("ios"); }
7472
});

0 commit comments

Comments
 (0)