10000 tests: include tests action bar (#7596) · NativeScript/NativeScript@e35bda2 · GitHub
[go: up one dir, main page]

Skip to content

Commit e35bda2

Browse files
tests: include tests action bar (#7596)
* tests: update action bar tests * revert: widgets version in modules * fix tslint
1 parent 6340781 commit e35bda2

32 files changed

+376
-41
lines changed

e2e/ui-tests-app/README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,29 @@
11
***e2e tests execution***
22

33
1. Local setup
4-
- install appium and all requirments related to how to use `nativescript-dev-appium` plugin
4+
- install appium and all requirments related to `nativescript-dev-appium` plugin usage
55
- download images:
66

7-
```npm run load-images Emulator-Api23-Default```
7+
```npm run load-images Emulator-Api23-Default "iPhone X 12"```
88

99
or load multiple folders:
1010

11-
``` npm run load-images Emulator-Api23-Default Emulator-Google-Api28```
11+
``` npm run load-images Emulator-Api23-Default Emulator-Google-Api28 "iPhone X 12"```
1212

13-
This command will download https://github.com/NativeScript/functional-tests-images/tree/master/uitestsapp and sparse all passed directories [emulator-name|simulator-name] [emulator-name|simulator-name] [emulator-name|simulator-name]
14-
- name your device so that it matches folder name, respectively api level and density of emulators.
13+
or load all folders:
14+
15+
``` npm run load-images all```
16+
17+
This command will download https://github.com/NativeScript/functional-tests-images/tree/master/uitestsapp and sparse all passed directories [emulator-name|simulator-name]
18+
- rename/ create your device so that it matches folder name, respectively api level and density of emulators.
1519

1620
You can also use scripts:
1721

1822
`npm run update-emulators` to update your emulator density.
1923

2024
If you need to download system image and create emulator use:
2125

22-
`npm run update-emulators -u`
26+
`npm run update-emulators -- --update-system-images`
2327
2. Test execution
2428
- Run test compilation in separate terminal and don't kill it.
2529

@@ -31,8 +35,8 @@
3135
3. Debug test.
3236
- Run:
3337

34-
`npm run test-debug [android|ios]`
35-
in separate console and don't kill it. This command will start appium server and driver and use the installed app on the device but it will not execute tests.
38+
`npm run e2e-debug [android|ios]`
39+
run in separate console and don't kill it. This command will start appium server and driver and use the installed app on the device but it will not execute tests.
3640
- Go to vs code debugging and use a config like:
3741

3842
```
@@ -48,13 +52,15 @@ in separate console and don't kill it. This command will start appium server and
4852
"--opts",
4953
"../config/mocha.opts",
5054
"--attachToDebug",
55+
"--grpe",
56+
"button"
5157
],
5258
"internalConsoleOptions": "openOnSessionStart"
5359
}
5460

5561
***mocha options***
5662

57-
mocha opt file is plased in "../config/mocha.opts".
63+
mocha opt file is located at "../config/mocha.opts".
5864

5965
--timeout 999999
6066
--recursive e2e
@@ -63,4 +69,8 @@ mocha opt file is plased in "../config/mocha.opts".
6369
--exit
6470

6571

66-
- grep particular suites: "--grep=tabs-tab(s-\\w+)-suite"
72+
***grep particular suit or test***
73+
74+
` npm run e2e ios -- --grep=tabs-tab(s-\\w+)-suite`
75+
76+

e2e/ui-tests-app/app/action-bar/action-item-position-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Page
22
xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
33
<Page.actionBar>
4-
<ActionBar>
4+
<ActionBar automationText="actionBar">
55
<ActionItem ios.position="right" tap="{{ change }}">
66
<Button text="{{ text }}" backgroundColor="red" />
77
</ActionItem>

e2e/ui-tests-app/app/action-bar/action-view-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page>
22
<Page.actionBar>
3-
<ActionBar>
3+
<ActionBar automationText="actionBar">
44
<ActionBar.actionItems>
55
<ActionItem tap="navigate">
66
<ActionItem.actionView>

e2e/ui-tests-app/app/action-bar/all-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page>
22
<Page.actionBar>
3-
<ActionBar title="Page Title" style="background-color: blue; color: yellow;">
3+
<ActionBar title="Page Title" style="background-color: blue; color: yellow;" automationText="actionBar">
44
<NavigationButton text="go back"/>
55
<ActionBar.actionItems>
66
<ActionItem text="ITEM" tap="navigate"/>

e2e/ui-tests-app/app/action-bar/background-css-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Page>
2-
<ActionBar title="This is RED" class="action" />
2+
<ActionBar title="This is RED" class="action" automationText="actionBar"/>
33
<StackLayout>
44
<Button text="go to cleared page" tap="navigate"/>
55
</StackLayout>

e2e/ui-tests-app/app/action-bar/background-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page>
22
<Page.actionBar>
3-
<ActionBar title="Page Title" style="background-color: green;">
3+
<ActionBar title="Page Title" style="background-color: green;" automationText="actionBar">
44
<NavigationButton text="go back"/>
55
<ActionBar.actionItems>
66
<ActionItem text="ITEM" tap="navigate"/>

e2e/ui-tests-app/app/action-bar/clean-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page>
22
<Page.actionBar>
3-
<ActionBar title="Page Title">
3+
<ActionBar title="Page Title" automationText="actionBar">
44
<NavigationButton text="go back"/>
55
<ActionBar.actionItems>
66
<ActionItem text="ITEM" tap="navigate"/>

e2e/ui-tests-app/app/action-bar/color-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page>
22
<Page.actionBar>
3-
<ActionBar title="Page Title" style="color: green;">
3+
<ActionBar title="Page Title" style="color: green;" automationText="actionBar">
44
<NavigationButton text="go back"/>
55
<ActionBar.actionItems>
66
<ActionItem text="ITEM" tap="navigate"/>

e2e/ui-tests-app/app/action-bar/flat-layout-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" backgroundColor="yellow">
22

3-
<ActionBar flat="true" backgroundColor="blue">
3+
<ActionBar flat="true" backgroundColor="blue" automationText="actionBar">
44
<Label text="flat action bar"></Label>
55
</ActionBar>
66

e2e/ui-tests-app/app/action-bar/flat-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page navigatedTo="onNavigateTo" backgroundColor="yellow">
22

3-
<ActionBar backgroundColor="blue">
3+
<ActionBar backgroundColor="blue" automationText="actionBar">
44
<Label text="flat action bar"></Label>
55
</ActionBar>
66

e2e/ui-tests-app/app/action-bar/flat-scrollview-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" backgroundColor="yellow">
22

3-
<ActionBar flat="true" backgroundColor="blue">
3+
<ActionBar flat="true" backgroundColor="blue" automationText="actionBar">
44
<Label text="flat action bar"></Label>
55
</ActionBar>
66

e2e/ui-tests-app/app/action-bar/flat-tab-opaque-bar-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Page backgroundColor="yellow">
2-
<ActionBar flat="true" backgroundColor="blue">
2+
<ActionBar flat="true" backgroundColor="blue" automationText="actionBar">
33
<Label text="flat action bar"></Label>
44
</ActionBar>
55

e2e/ui-tests-app/app/action-bar/flat-tab-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd" backgroundColor="yellow">
22

3-
<ActionBar flat="true" backgroundColor="blue">
3+
<ActionBar flat="true" backgroundColor="blue" automationText="actionBar">
44
<Label text="flat action bar"></Label>
55
</ActionBar>
66

e2e/ui-tests-app/app/action-bar/font-icons-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page>
22
<Page.actionBar>
3-
<ActionBar>
3+
<ActionBar automationText="actionBar">
44
<ActionBar.actionItems>
55
<!-- font family + font size + color -->
66
<ActionItem icon="font://&#xF10B;" class="font-awesome font-size color" tap="navigate"/>

e2e/ui-tests-app/app/action-bar/icons-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page>
22
<Page.actionBar>
3-
<ActionBar>
3+
<ActionBar automationText="actionBar">
44
<ActionBar.actionItems>
55
<ActionItem icon="res://icon" tap="navigate"/>
66
<ActionItem icon="res://add_to_fav" tap="navigate"/>

e2e/ui-tests-app/app/action-bar/local-icons-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page>
22
<Page.actionBar>
3-
<ActionBar>
3+
<ActionBar automationText="actionBar">
44
<ActionBar.actionItems>
55
<ActionItem icon="~/resources/images/icon.png" tap="navigate"/>
66
<ActionItem icon="~/resources/images/add_to_fav@3x.png" tap="navigate"/>

e2e/ui-tests-app/app/action-bar/modal-page-hidden-action-bar-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Page showingModally="onShownModally" actionBarHidden="true">
1+
<Page showingModally="onShownModally" actionBarHidden="true" automationText="actionBar">
22
<StackLayout id="layout" >
33
<Button text="Close" tap="onTap" />
44
</StackLayout>

e2e/ui-tests-app/app/action-bar/modal-test-hidden-action-bar-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Page xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true">
1+
<Page xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true" automationText="actionBar">
22
<StackLayout>
33
<button text="Open Modal" tap="btnClick" />
44
<button text="Go Back" tap="btnBack" />

e2e/ui-tests-app/app/action-bar/modal-test-with-action-bar-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
22
<Page.actionBar>
3-
<ActionBar backgroundColor="green" title="Main View" icon="">
3+
<ActionBar backgroundColor="green" title="Main View" icon="" automationText="actionBar">
44
<NavigationButton text="Back" icon="" tap="" />
55
<ActionBar.actionItems>
66
<ActionItem icon="" text="Left" tap="" ios.position="left" />

e2e/ui-tests-app/app/action-bar/system-icons-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Page>
22
<Page.actionBar>
3-
<ActionBar>
3+
<ActionBar automationText="actionBar">
44
<ActionBar.actionItems>
55
<ActionItem ios.systemIcon="12" android.systemIcon="ic_menu_search" tap="navigate"/>
66
<ActionItem ios.systemIcon="15" android.systemIcon="ic_menu_camera" tap="navigate"/>

e2e/ui-tests-app/app/action-bar/transparent-bg-css-page.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Page>
2-
<ActionBar title="This is transparent" class="action" />
2+
<ActionBar title="This is transparent" class="action" automationText="actionBar"/>
33
<StackLayout>
44
<Button text="go to cleared page" tap="navigate"/>
55
</StackLayout>
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11

22
export const setImageName = (suite: string, spec: string, testsName: string) => {
3-
const testName = `${suite}-${spec}-${testsName.replace(suite, "").replace(spec, "")}`.replace(/(\-+)/ig, "-").replace(/(\_+)/ig, "_");
3+
let testName = testsName
4+
.replace(suite, "")
5+
.replace(spec, "");
6+
testName = `${suite}-${spec}-${testName}`
7+
.replace("should", "-")
8+
.replace(/\s+/g, "-")
9+
.replace(/\_+/ig, "_")
10+
.replace(/[!$%^&*()+|~=`{}\[\]:";'<>?,.\/]/g, "")
11+
.replace(/\-+/g, "-");
412

513
return testName;
614
};

e2e/ui-tests-app/e2e/helpers/navigation-helper.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ export class NavigationHelper {
107107
const endPoint = <Point>{};
108108

109109
if (this._driver.isIOS) {
110+
const rect = this._driver.getScreenActualViewPort();
110111
startPoint.x = 5;
111-
startPoint.y = this._driver.nsCapabilities.device.viewportRect.y / this._driver.nsCapabilities.device.config.density;
112-
endPoint.x = (this._driver.nsCapabilities.device.viewportRect.width / this._driver.nsCapabilities.device.config.density) - 5;
112+
startPoint.y = rect.y;
113+
endPoint.x = (rect.width / this._driver.nsCapabilities.device.deviceScreenDensity) - 5;
113114
endPoint.y = startPoint.y;
114115

115116
await this._driver.swipe(startPoint, endPoint);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { AppiumDriver } from "nativescript-dev-appium";
2+
import { PageObjectBaseModel } from "../../page-object-base-model";
3+
4+
export class ActionBarBasePage extends PageObjectBaseModel {
5+
private readonly automationText: string = "actionBar";
6+
constructor(_driver: AppiumDriver) {
7+
super(_driver, ["action-bar"]);
8+
}
9+
10+
get actionBar() {
11+
return this._driver.waitForElement(this.automationText);
12+
}
13+
}

0 commit comments

Comments
 (0)
0