From 08244a30eff0715f5ea3ba19b58644b81969b215 Mon Sep 17 00:00:00 2001 From: SvetoslavTsenov Date: Thu, 8 Aug 2019 18:52:43 +0300 Subject: [PATCH 1/2] chore: update appium tests to support ns-dev-appium 6.0.0 --- .../e2e/pages/animations-with-default-options-page.ts | 10 +++++----- e2e/animation-examples/e2e/pages/query-stagger-page.ts | 6 +++--- e2e/animation-examples/e2e/pages/selector-page.ts | 10 +++++----- e2e/animation-examples/e2e/smoke.e2e-spec.ts | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/e2e/animation-examples/e2e/pages/animations-with-default-options-page.ts b/e2e/animation-examples/e2e/pages/animations-with-default-options-page.ts index f3a13e351..76e34ae04 100644 --- a/e2e/animation-examples/e2e/pages/animations-with-default-options-page.ts +++ b/e2e/animation-examples/e2e/pages/animations-with-default-options-page.ts @@ -29,10 +29,10 @@ export class AnimationsWithDefaultOptionsPage extends BasePage { } private getItem(item) { - return this._driver.findElementByXPathIfExists(`${this._elementHelper.getXPathByTextAtributes("//*", "itemsContainer", true)}${this._elementHelper.getXPathByTextAtributes("//*", item, false)}`); + return this._driver.findElementByXPathIfExists(`${this._elementHelper.getXPathByTextAttributes("//*", "itemsContainer", true)}${this._elementHelper.getXPathByTextAttributes("//*", item, false)}`); } - async awaitItemToDissapear(item: string, wait: number = 3000) { + async awaitItemToDisappear(item: string, wait: number = 3000) { const startTime = Date.now(); let btn = await this.getItem(item); while (btn && await btn.isDisplayed() && Date.now() - startTime <= wait) { @@ -53,16 +53,16 @@ export class AnimationsWithDefaultOptionsPage extends BasePage { } async getChildren() { - const children: Array = await this._driver.findElementsByXPath(`${this._elementHelper.getXPathByTextAtributes("//*", "itemsContainer", true)}/*`); + const children: Array = await this._driver.findElementsByXPath(`${this._elementHelper.getXPathByTextAttributes("//*", "itemsContainer", true)}/*`); const orderedList: Array = await sort(children); return orderedList; } - async assertItemPosition(text: string, itemIndex: number, expctedElementsCount: number) { + async assertItemPosition(text: string, itemIndex: number, expectedElementsCount: number) { const children = this._children; - assert.isTrue(children.length === expctedElementsCount, `Expected items count: ${expctedElementsCount} is not as actual: ${children.length}`); + assert.isTrue(children.length === expectedElementsCount, `Expected items count: ${expectedElementsCount} is not as actual: ${children.length}`); const element = children[itemIndex]; console.log("Element text: ", await element.text()); const currentElementText = await element.text(); diff --git a/e2e/animation-examples/e2e/pages/query-stagger-page.ts b/e2e/animation-examples/e2e/pages/query-stagger-page.ts index a7a20581f..354428624 100644 --- a/e2e/animation-examples/e2e/pages/query-stagger-page.ts +++ b/e2e/animation-examples/e2e/pages/query-stagger-page.ts @@ -21,18 +21,18 @@ export class QueryWithStaggerPage extends BasePage { } async getChildren() { - const children: Array = await this._driver.findElementsByXPath(`${this._elementHelper.getXPathByTextAtributes("//*", "container", true)}/*`); + const children: Array = await this._driver.findElementsByXPath(`${this._elementHelper.getXPathByTextAttributes("//*", "container", true)}/*`); const orderedList: Array = await sort(children); return orderedList; } - async assertItemPosition(text: string, itemIndex: number, expctedElementsCount: number) { + async assertItemPosition(text: string, itemIndex: number, expectedElementsCount: number) { const startTime = Date.now(); let item = await this._driver.findElementByTextIfExists(text) while ((!item || !(await item.isDisplayed())) && Date.now() - startTime <= 3000) { } const children = await this.getChildren(); - assert.isTrue(children.length === expctedElementsCount); + assert.isTrue(children.length === expectedElementsCount); const element = children[itemIndex]; const elementText = await element.text(); console.log("Element text: ", elementText); diff --git a/e2e/animation-examples/e2e/pages/selector-page.ts b/e2e/animation-examples/e2e/pages/selector-page.ts index 97d5b99d6..612bb18db 100644 --- a/e2e/animation-examples/e2e/pages/selector-page.ts +++ b/e2e/animation-examples/e2e/pages/selector-page.ts @@ -10,7 +10,7 @@ export class SelectorPage extends BasePage { constructor(_driver: AppiumDriver) { super(_driver); - this._itemsContainerXpath = this._elementHelper.getXPathByTextAtributes("//*", "itemsContainer", true); + this._itemsContainerXpath = this._elementHelper.getXPathByTextAttributes("//*", "itemsContainer", true); this._itemsContainerChildrenXpath = `${this._itemsContainerXpath}/*` } @@ -41,18 +41,18 @@ export class SelectorPage extends BasePage { return orderedList; } - async assertElementPossition(expctedElementsCount: number) { + async assertElementPosition(expectedElementsCount: number) { const children = await this.getChildren(); - assert.isTrue(children.length === expctedElementsCount) + assert.isTrue(children.length === expectedElementsCount) for (let index = 0; index < children.length - 1; index++) { const element = children[index]; - const el = await (element.driver()).elementByXPathIfExists(this._elementHelper.getXPathByTextAtributes("//*", `Item No.${index}`, true)); + const el = await (element.driver()).elementByXPathIfExists(this._elementHelper.getXPathByTextAttributes("//*", `Item No.${index}`, true)); console.log(await el.text()); assert.isTrue(el && el !== null); } } private itemXpath(item) { - return `${this._itemsContainerXpath}${this._elementHelper.getXPathByTextAtributes("//*", item, false)}`; + return `${this._itemsContainerXpath}${this._elementHelper.getXPathByTextAttributes("//*", item, false)}`; } } \ No newline at end of file diff --git a/e2e/animation-examples/e2e/smoke.e2e-spec.ts b/e2e/animation-examples/e2e/smoke.e2e-spec.ts index ce345059f..a325a73e1 100644 --- a/e2e/animation-examples/e2e/smoke.e2e-spec.ts +++ b/e2e/animation-examples/e2e/smoke.e2e-spec.ts @@ -55,14 +55,14 @@ describe("smoke-tests", async function () { await selectorPage.enterExample(); await selectorPage.addItem(); await selectorPage.waitItemToToggleVisibility("Item No.2", true); - await selectorPage.assertElementPossition(4); + await selectorPage.assertElementPosition(4); await selectorPage.clickOnItem("second"); await selectorPage.waitItemToToggleVisibility("second", false); - await selectorPage.assertElementPossition(3); + await selectorPage.assertElementPosition(3); }); - it("querry with stagger", async function () { + it("query with stagger", async function () { const queryWithStaggerPage = new QueryWithStaggerPage(driver); await queryWithStaggerPage.enterExample(); await queryWithStaggerPage.addItem(); @@ -103,7 +103,7 @@ describe("smoke-tests", async function () { await animationWithOptionsPage.clickOnItem("Harley Quinn"); examplesCount--; - await animationWithOptionsPage.awaitItemToDissapear("Harley Quinn"); + await animationWithOptionsPage.awaitItemToDisappear("Harley Quinn"); await animationWithOptionsPage.assertItemPosition("Wonder Woman", 1, examplesCount); await animationWithOptionsPage.assertItemPosition("Joker", 2, examplesCount); await animationWithOptionsPage.assertItemPosition("Aquaman", 3, examplesCount); From 6a7679ee62c5a87ef424a091acaefea4e9b3cc6e Mon Sep 17 00:00:00 2001 From: SvetoslavTsenov Date: Thu, 8 Aug 2019 20:09:04 +0300 Subject: [PATCH 2/2] chore: update "nativescript-unit-test-runner": "0.7.0", --- tests/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/package.json b/tests/package.json index 13557aaaa..1f02808aa 100644 --- a/tests/package.json +++ b/tests/package.json @@ -29,7 +29,7 @@ "@angular/platform-browser-dynamic": "~8.1.0", "@angular/router": "~8.1.0", "nativescript-angular": "../nativescript-angular", - "nativescript-unit-test-runner": "~0.6.3", + "nativescript-unit-test-runner": "0.7.0", "rxjs": "~6.3.3", "tns-core-modules": "next", "zone.js": "^0.9.1"