Skip to content
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
30 changes: 20 additions & 10 deletions e2e/ui-tests-app/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
***e2e tests execution***

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

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

or load multiple folders:

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

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]
- name your device so that it matches folder name, respectively api level and density of emulators.
or load all folders:

``` npm run load-images all```

This command will download https://github.com/NativeScript/functional-tests-images/tree/master/uitestsapp and sparse all passed directories [emulator-name|simulator-name]
- rename/ create your device so that it matches folder name, respectively api level and density of emulators.

You can also use scripts:

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

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

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

Expand All @@ -31,8 +35,8 @@
3. Debug test.
- Run:

`npm run test-debug [android|ios]`
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.
`npm run e2e-debug [android|ios]`
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.
- Go to vs code debugging and use a config like:

```
Expand All @@ -48,13 +52,15 @@ in separate console and don't kill it. This command will start appium server and
"--opts",
"../config/mocha.opts",
"--attachToDebug",
"--grpe",
"button"
],
"internalConsoleOptions": "openOnSessionStart"
}

***mocha options***

mocha opt file is plased in "../config/mocha.opts".
mocha opt file is located at "../config/mocha.opts".

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


- grep particular suites: "--grep=tabs-tab(s-\\w+)-suite"
***grep particular suit or test***

` npm run e2e ios -- --grep=tabs-tab(s-\\w+)-suite`


Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Page
xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
<Page.actionBar>
<ActionBar>
<ActionBar automationText="actionBar">
<ActionItem ios.position="right" tap="{{ change }}">
<Button text="{{ text }}" backgroundColor="red" />
</ActionItem>
Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/action-view-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page>
<Page.actionBar>
<ActionBar>
<ActionBar automationText="actionBar">
<ActionBar.actionItems>
<ActionItem tap="navigate">
<ActionItem.actionView>
Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/all-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page>
<Page.actionBar>
<ActionBar title="Page Title" style="background-color: blue; color: yellow;">
<ActionBar title="Page Title" style="background-color: blue; color: yellow;" automationText="actionBar">
<NavigationButton text="go back"/>
<ActionBar.actionItems>
<ActionItem text="ITEM" tap="navigate"/>
Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/background-css-page.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Page>
<ActionBar title="This is RED" class="action" />
<ActionBar title="This is RED" class="action" automationText="actionBar"/>
<StackLayout>
<Button text="go to cleared page" tap="navigate"/>
</StackLayout>
Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/background-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page>
<Page.actionBar>
<ActionBar title="Page Title" style="background-color: green;">
<ActionBar title="Page Title" style="background-color: green;" automationText="actionBar">
<NavigationButton text="go back"/>
<ActionBar.actionItems>
<ActionItem text="ITEM" tap="navigate"/>
Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/clean-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page>
<Page.actionBar>
<ActionBar title="Page Title">
<ActionBar title="Page Title" automationText="actionBar">
<NavigationButton text="go back"/>
<ActionBar.actionItems>
<ActionItem text="ITEM" tap="navigate"/>
Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/color-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page>
<Page.actionBar>
<ActionBar title="Page Title" style="color: green;">
<ActionBar title="Page Title" style="color: green;" automationText="actionBar">
<NavigationButton text="go back"/>
<ActionBar.actionItems>
<ActionItem text="ITEM" tap="navigate"/>
Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/flat-layout-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" backgroundColor="yellow">

<ActionBar flat="true" backgroundColor="blue">
<ActionBar flat="true" backgroundColor="blue" automationText="actionBar">
<Label text="flat action bar"></Label>
</ActionBar>

Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/flat-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page navigatedTo="onNavigateTo" backgroundColor="yellow">

<ActionBar backgroundColor="blue">
<ActionBar backgroundColor="blue" automationText="actionBar">
<Label text="flat action bar"></Label>
</ActionBar>

Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/flat-scrollview-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" backgroundColor="yellow">

<ActionBar flat="true" backgroundColor="blue">
<ActionBar flat="true" backgroundColor="blue" automationText="actionBar">
<Label text="flat action bar"></Label>
</ActionBar>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Page backgroundColor="yellow">
<ActionBar flat="true" backgroundColor="blue">
<ActionBar flat="true" backgroundColor="blue" automationText="actionBar">
<Label text="flat action bar"></Label>
</ActionBar>

Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/flat-tab-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" backgroundColor="yellow">

<ActionBar flat="true" backgroundColor="blue">
<ActionBar flat="true" backgroundColor="blue" automationText="actionBar">
<Label text="flat action bar"></Label>
</ActionBar>

Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/font-icons-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page>
<Page.actionBar>
<ActionBar>
<ActionBar automationText="actionBar">
<ActionBar.actionItems>
<!-- font family + font size + color -->
<ActionItem icon="font://&#xF10B;" class="font-awesome font-size color" tap="navigate"/>
Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/icons-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page>
<Page.actionBar>
<ActionBar>
<ActionBar automationText="actionBar">
<ActionBar.actionItems>
<ActionItem icon="res://icon" tap="navigate"/>
<ActionItem icon="res://add_to_fav" tap="navigate"/>
Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/local-icons-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page>
<Page.actionBar>
<ActionBar>
<ActionBar automationText="actionBar">
<ActionBar.actionItems>
<ActionItem icon="~/resources/images/icon.png" tap="navigate"/>
<ActionItem icon="~/resources/images/add_to_fav@3x.png" tap="navigate"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Page showingModally="onShownModally" actionBarHidden="true">
<Page showingModally="onShownModally" actionBarHidden="true" automationText="actionBar">
<StackLayout id="layout" >
<Button text="Close" tap="onTap" />
</StackLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true">
<Page xmlns="http://schemas.nativescript.org/tns.xsd" actionBarHidden="true" automationText="actionBar">
<StackLayout>
<button text="Open Modal" tap="btnClick" />
<button text="Go Back" tap="btnBack" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
<Page.actionBar>
<ActionBar backgroundColor="green" title="Main View" icon="">
<ActionBar backgroundColor="green" title="Main View" icon="" automationText="actionBar">
<NavigationButton text="Back" icon="" tap="" />
<ActionBar.actionItems>
<ActionItem icon="" text="Left" tap="" ios.position="left" />
Expand Down
2 changes: 1 addition & 1 deletion e2e/ui-tests-app/app/action-bar/system-icons-page.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Page>
<Page.actionBar>
<ActionBar>
<ActionBar automationText="actionBar">
<ActionBar.actionItems>
<ActionItem ios.systemIcon="12" android.systemIcon="ic_menu_search" tap="navigate"/>
<ActionItem ios.systemIcon="15" android.systemIcon="ic_menu_camera" tap="navigate"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Page>
<ActionBar title="This is transparent" class="action" />
<ActionBar title="This is transparent" class="action" automationText="actionBar"/>
<StackLayout>
<Button text="go to cleared page" tap="navigate"/>
</StackLayout>
Expand Down
10 changes: 9 additions & 1 deletion e2e/ui-tests-app/e2e/helpers/image-helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@

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

return testName;
};
5 changes: 3 additions & 2 deletions e2e/ui-tests-app/e2e/helpers/navigation-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ export class NavigationHelper {
const endPoint = <Point>{};

if (this._driver.isIOS) {
const rect = this._driver.getScreenActualViewPort();
startPoint.x = 5;
startPoint.y = this._driver.nsCapabilities.device.viewportRect.y / this._driver.nsCapabilities.device.config.density;
endPoint.x = (this._driver.nsCapabilities.device.viewportRect.width / this._driver.nsCapabilities.device.config.density) - 5;
startPoint.y = rect.y;
endPoint.x = (rect.width / this._driver.nsCapabilities.device.deviceScreenDensity) - 5;
endPoint.y = startPoint.y;

await this._driver.swipe(startPoint, endPoint);
Expand Down
13 changes: 13 additions & 0 deletions e2e/ui-tests-app/e2e/suites/action-bar/action-bar-base-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { AppiumDriver } from "nativescript-dev-appium";
import { PageObjectBaseModel } from "../../page-object-base-model";

export class ActionBarBasePage extends PageObjectBaseModel {
private readonly automationText: string = "actionBar";
constructor(_driver: AppiumDriver) {
super(_driver, ["action-bar"]);
}

get actionBar() {
return this._driver.waitForElement(this.automationText);
}
}
Loading