Skip to content

Commit 17a2e53

Browse files
Merge pull request #1940 from NativeScript/svetoslavtsenov/update-appium-tests
chore: update appium tests to support ns-dev-appium 6.0.0
2 parents 6a71b62 + 6a7679e commit 17a2e53

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

Diff for: e2e/animation-examples/e2e/pages/animations-with-default-options-page.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ export class AnimationsWithDefaultOptionsPage extends BasePage {
2929
}
3030

3131
private getItem(item) {
32-
return this._driver.findElementByXPathIfExists(`${this._elementHelper.getXPathByTextAtributes("//*", "itemsContainer", true)}${this._elementHelper.getXPathByTextAtributes("//*", item, false)}`);
32+
return this._driver.findElementByXPathIfExists(`${this._elementHelper.getXPathByTextAttributes("//*", "itemsContainer", true)}${this._elementHelper.getXPathByTextAttributes("//*", item, false)}`);
3333
}
3434

35-
async awaitItemToDissapear(item: string, wait: number = 3000) {
35+
async awaitItemToDisappear(item: string, wait: number = 3000) {
3636
const startTime = Date.now();
3737
let btn = await this.getItem(item);
3838
while (btn && await btn.isDisplayed() && Date.now() - startTime <= wait) {
@@ -53,16 +53,16 @@ export class AnimationsWithDefaultOptionsPage extends BasePage {
5353
}
5454

5555
async getChildren() {
56-
const children: Array<UIElement> = await this._driver.findElementsByXPath(`${this._elementHelper.getXPathByTextAtributes("//*", "itemsContainer", true)}/*`);
56+
const children: Array<UIElement> = await this._driver.findElementsByXPath(`${this._elementHelper.getXPathByTextAttributes("//*", "itemsContainer", true)}/*`);
5757
const orderedList: Array<UIElement> = await sort(children);
5858

5959
return orderedList;
6060
}
6161

62-
async assertItemPosition(text: string, itemIndex: number, expctedElementsCount: number) {
62+
async assertItemPosition(text: string, itemIndex: number, expectedElementsCount: number) {
6363
const children = this._children;
6464

65-
assert.isTrue(children.length === expctedElementsCount, `Expected items count: ${expctedElementsCount} is not as actual: ${children.length}`);
65+
assert.isTrue(children.length === expectedElementsCount, `Expected items count: ${expectedElementsCount} is not as actual: ${children.length}`);
6666
const element = children[itemIndex];
6767
console.log("Element text: ", await element.text());
6868
const currentElementText = await element.text();

Diff for: e2e/animation-examples/e2e/pages/query-stagger-page.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ export class QueryWithStaggerPage extends BasePage {
2121
}
2222

2323
async getChildren() {
24-
const children: Array<UIElement> = await this._driver.findElementsByXPath(`${this._elementHelper.getXPathByTextAtributes("//*", "container", true)}/*`);
24+
const children: Array<UIElement> = await this._driver.findElementsByXPath(`${this._elementHelper.getXPathByTextAttributes("//*", "container", true)}/*`);
2525
const orderedList: Array<UIElement> = await sort(children);
2626

2727
return orderedList;
2828
}
2929

30-
async assertItemPosition(text: string, itemIndex: number, expctedElementsCount: number) {
30+
async assertItemPosition(text: string, itemIndex: number, expectedElementsCount: number) {
3131
const startTime = Date.now();
3232
let item = await this._driver.findElementByTextIfExists(text)
3333
while ((!item || !(await item.isDisplayed())) && Date.now() - startTime <= 3000) { }
3434
const children = await this.getChildren();
35-
assert.isTrue(children.length === expctedElementsCount);
35+
assert.isTrue(children.length === expectedElementsCount);
3636
const element = children[itemIndex];
3737
const elementText = await element.text();
3838
console.log("Element text: ", elementText);

Diff for: e2e/animation-examples/e2e/pages/selector-page.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class SelectorPage extends BasePage {
1010

1111
constructor(_driver: AppiumDriver) {
1212
super(_driver);
13-
this._itemsContainerXpath = this._elementHelper.getXPathByTextAtributes("//*", "itemsContainer", true);
13+
this._itemsContainerXpath = this._elementHelper.getXPathByTextAttributes("//*", "itemsContainer", true);
1414
this._itemsContainerChildrenXpath = `${this._itemsContainerXpath}/*`
1515
}
1616

@@ -41,18 +41,18 @@ export class SelectorPage extends BasePage {
4141
return orderedList;
4242
}
4343

44-
async assertElementPossition(expctedElementsCount: number) {
44+
async assertElementPosition(expectedElementsCount: number) {
4545
const children = await this.getChildren();
46-
assert.isTrue(children.length === expctedElementsCount)
46+
assert.isTrue(children.length === expectedElementsCount)
4747
for (let index = 0; index < children.length - 1; index++) {
4848
const element = children[index];
49-
const el = await (<any>element.driver()).elementByXPathIfExists(this._elementHelper.getXPathByTextAtributes("//*", `Item No.${index}`, true));
49+
const el = await (<any>element.driver()).elementByXPathIfExists(this._elementHelper.getXPathByTextAttributes("//*", `Item No.${index}`, true));
5050
console.log(await el.text());
5151
assert.isTrue(el && el !== null);
5252
}
5353
}
5454

5555
private itemXpath(item) {
56-
return `${this._itemsContainerXpath}${this._elementHelper.getXPathByTextAtributes("//*", item, false)}`;
56+
return `${this._itemsContainerXpath}${this._elementHelper.getXPathByTextAttributes("//*", item, false)}`;
5757
}
5858
}

Diff for: e2e/animation-examples/e2e/smoke.e2e-spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ describe("smoke-tests", async function () {
5555
await selectorPage.enterExample();
5656
await selectorPage.addItem();
5757
await selectorPage.waitItemToToggleVisibility("Item No.2", true);
58-
await selectorPage.assertElementPossition(4);
58+
await selectorPage.assertElementPosition(4);
5959

6060
await selectorPage.clickOnItem("second");
6161
await selectorPage.waitItemToToggleVisibility("second", false);
62-
await selectorPage.assertElementPossition(3);
62+
await selectorPage.assertElementPosition(3);
6363
});
6464

65-
it("querry with stagger", async function () {
65+
it("query with stagger", async function () {
6666
const queryWithStaggerPage = new QueryWithStaggerPage(driver);
6767
await queryWithStaggerPage.enterExample();
6868
await queryWithStaggerPage.addItem();
@@ -103,7 +103,7 @@ describe("smoke-tests", async function () {
103103

104104
await animationWithOptionsPage.clickOnItem("Harley Quinn");
105105
examplesCount--;
106-
await animationWithOptionsPage.awaitItemToDissapear("Harley Quinn");
106+
await animationWithOptionsPage.awaitItemToDisappear("Harley Quinn");
107107
await animationWithOptionsPage.assertItemPosition("Wonder Woman", 1, examplesCount);
108108
await animationWithOptionsPage.assertItemPosition("Joker", 2, examplesCount);
109109
await animationWithOptionsPage.assertItemPosition("Aquaman", 3, examplesCount);

Diff for: tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@angular/platform-browser-dynamic": "~8.1.0",
3030
"@angular/router": "~8.1.0",
3131
"nativescript-angular": "../nativescript-angular",
32-
"nativescript-unit-test-runner": "~0.6.3",
32+
"nativescript-unit-test-runner": "0.7.0",
3333
"rxjs": "~6.3.3",
3434
"tns-core-modules": "next",
3535
"zone.js": "^0.9.1"

0 commit comments

Comments
 (0)