From a31e75b1291e1c9254caabbdeb188c5f6f1a5770 Mon Sep 17 00:00:00 2001 From: Svetoslav Date: Tue, 12 Mar 2019 09:59:43 +0200 Subject: [PATCH 1/2] test: separate suites to optimize execute time on CI (#7017) * test: separate suites to optimize execute time on CI --- .../e2e/frame-root.e2e-spec.ts | 20 +++++++++--- .../e2e/frame-tab-root.e2e-spec.ts | 31 +++++++++---------- .../e2e/layout-root.e2e-spec.ts | 22 +++++++------ .../e2e/tab-root.e2e-spec.ts | 27 ++++++++-------- 4 files changed, 57 insertions(+), 43 deletions(-) diff --git a/e2e/nested-frame-navigation/e2e/frame-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/frame-root.e2e-spec.ts index 1ff0e1b66..fa1759e80 100644 --- a/e2e/nested-frame-navigation/e2e/frame-root.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/frame-root.e2e-spec.ts @@ -1,10 +1,11 @@ import { AppiumDriver, createDriver } from "nativescript-dev-appium"; -import { Screen, playersData, home, somePage, teamsData, driverDefaultWaitTime } from "./screen"; -import * as shared from "./shared.e2e-spec"; +import { Screen, playersData, teamsData, driverDefaultWaitTime, Item } from "./screen"; import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config"; +import * as shared from "./shared.e2e-spec"; -describe("frame-root:", () => { +const rootType = "frame-root"; +describe(rootType, () => { let driver: AppiumDriver; let screen: Screen; @@ -38,7 +39,18 @@ describe("frame-root:", () => { const teamOne = teamsData[`teamOne${transition}`]; const teamTwo = teamsData[`teamTwo${transition}`]; - describe(`transition: ${transition} scenarios:`, () => { + describe(`${rootType}-transition-${transition}-scenarios:`, () => { + before(async function () { + logWarn(`==== Transition ${transition}`); + + if (transition === "Flip" && + driver.isAndroid && parseInt(driver.platformVersion) === 19) { + // TODO: known issue https://github.com/NativeScript/NativeScript/issues/6798 + console.log("skipping flip transition tests on api level 19"); + this.skip(); + } + }); + it("loaded home page", async () => { await screen.loadedHome(); }); diff --git a/e2e/nested-frame-navigation/e2e/frame-tab-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/frame-tab-root.e2e-spec.ts index b20f86cde..965008083 100644 --- a/e2e/nested-frame-navigation/e2e/frame-tab-root.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/frame-tab-root.e2e-spec.ts @@ -7,15 +7,13 @@ import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from " // NOTE: TabTop is Android only scenario (for iOS we will essentially execute 2x TabBottom) const roots = ["TabTop", "TabBottom"]; -function hyphenate(s: string) { - return s.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase(); -} - -describe("frame-tab-root:", () => { +const rootType = "frame-tab-root"; +describe(rootType, () => { let driver: AppiumDriver; let screen: Screen; before(async () => { + logWarn(`====== ${rootType} ========`); driver = await createDriver(); screen = new Screen(driver); if (dontKeepActivities) { @@ -39,24 +37,25 @@ describe("frame-tab-root:", () => { } }); - roots.forEach(root => { - const rootWithHyphen = hyphenate(root); + for (let index = 0; index < roots.length; index++) { + const root = roots[index]; - describe(`${rootWithHyphen} scenarios:`, () => { + describe(`${rootType}-${root} scenarios:`, () => { + logWarn(`===== Root: ${root}`); + for (let trIndex = 0; trIndex < transitions.length; trIndex++) { + const transition = transitions[trIndex]; + const playerOne: Item = playersData[`playerOne${transition}`]; + const playerTwo: Item = playersData[`playerTwo${transition}`]; + const teamOne: Item = teamsData[`teamOne${transition}`]; + const teamTwo: Item = teamsData[`teamTwo${transition}`]; - transitions.forEach(transition => { - const playerOne = playersData[`playerOne${transition}`]; - const playerTwo = playersData[`playerTwo${transition}`]; - const teamOne = teamsData[`teamOne${transition}`]; - const teamTwo = teamsData[`teamTwo${transition}`]; - - describe(`transition: ${transition} scenarios:`, () => { + describe(`${rootType}-${root}-transition-${transition}-scenarios:`, () => { it("loaded home page", async () => { await screen.loadedHome(); }); - it(`loaded frame ${rootWithHyphen} root with nested frames`, async () => { + it(`loaded frame ${root} root with nested frames`, async () => { await screen[`navigateToPage${root}WithFrames`](); await screen[`loadedPage${root}WithFrames`](); }); diff --git a/e2e/nested-frame-navigation/e2e/layout-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/layout-root.e2e-spec.ts index 34e1ebc70..47f239437 100644 --- a/e2e/nested-frame-navigation/e2e/layout-root.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/layout-root.e2e-spec.ts @@ -1,16 +1,18 @@ -import { AppiumDriver, createDriver } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium"; import { Screen, playersData, home, somePage, otherPage, teamsData, driverDefaultWaitTime } from "./screen"; import * as shared from "./shared.e2e-spec"; import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from "./config"; -describe("layout-root:", () => { +const rootType = "layout-root"; +describe(rootType, () => { let driver: AppiumDriver; let screen: Screen; before(async () => { driver = await createDriver(); screen = new Screen(driver); + logWarn("====== layout-root ========") if (dontKeepActivities) { await driver.setDontKeepActivities(true); } @@ -32,12 +34,14 @@ describe("layout-root:", () => { } }); - transitions.forEach(transition => { + for (let index = 0; index < transitions.length; index++) { + const transition = transitions[index]; + const playerOne = playersData[`playerOne${transition}`]; const playerTwo = playersData[`playerTwo${transition}`]; const teamOne = teamsData[`teamOne${transition}`]; - describe(`transition: ${transition} scenarios:`, () => { + describe(`${rootType}-transition-${transition}-scenarios:`, () => { it("loaded home page", async () => { await screen.loadedHome(); @@ -291,9 +295,9 @@ describe("layout-root:", () => { await screen.loadedHome(); }); }); - }); + }; - describe("players list slide transition with parent frame default transition:", () => { + describe(`${rootType}-players-list-slide-transition with parent frame default transition:`, () => { const playerOne = playersData["playerOneSlide"]; const playerTwo = playersData["playerTwoSlide"]; @@ -352,7 +356,7 @@ describe("layout-root:", () => { }); }); - describe("players list slide transition with parent frame no transition:", () => { + describe(`${rootType}-players-list-slide-transition with parent frame no transition:`, () => { const playerOne = playersData["playerOneSlide"]; const playerTwo = playersData["playerTwoSlide"]; @@ -411,7 +415,7 @@ describe("layout-root:", () => { }); }); - describe("players list flip transition with parent frame default transition:", () => { + describe(`${rootType}-players-list-flip-transition with parent frame default transition:`, () => { const playerOne = playersData["playerOneFlip"]; const playerTwo = playersData["playerTwoFlip"]; @@ -470,7 +474,7 @@ describe("layout-root:", () => { }); }); - describe("players list flip transition with parent frame no transition:", () => { + describe(`${rootType}-players-list-flip-transition with parent frame no transition:`, () => { const playerOne = playersData["playerOneFlip"]; const playerTwo = playersData["playerTwoFlip"]; diff --git a/e2e/nested-frame-navigation/e2e/tab-root.e2e-spec.ts b/e2e/nested-frame-navigation/e2e/tab-root.e2e-spec.ts index 56e0ab2db..8d9e811bf 100644 --- a/e2e/nested-frame-navigation/e2e/tab-root.e2e-spec.ts +++ b/e2e/nested-frame-navigation/e2e/tab-root.e2e-spec.ts @@ -1,4 +1,4 @@ -import { AppiumDriver, createDriver } from "nativescript-dev-appium"; +import { AppiumDriver, createDriver, logWarn } from "nativescript-dev-appium"; import { Screen, playersData, teamsData } from "./screen"; import * as shared from "./shared.e2e-spec"; @@ -7,15 +7,13 @@ import { suspendTime, appSuspendResume, dontKeepActivities, transitions } from " // NOTE: TabTop is Android only scenario (for iOS we will essentially execute 2x TabBottom) const roots = ["TabTop", "TabBottom"]; -function hyphenate(s: string) { - return s.replace(/([a-zA-Z])(?=[A-Z])/g, "$1-").toLowerCase(); -} - -describe("tab-root:", () => { +const rootType = "tab-root"; +describe(rootType, () => { let driver: AppiumDriver; let screen: Screen; before(async () => { + logWarn(`====== ${rootType} ========`) driver = await createDriver(); screen = new Screen(driver); if (dontKeepActivities) { @@ -39,24 +37,25 @@ describe("tab-root:", () => { } }); - roots.forEach(root => { - const rootWithHyphen = hyphenate(root); + for (let index = 0; index < roots.length; index++) { + const root = roots[index]; + describe(`${rootType}-${root}-scenarios:`, () => { - describe(`${rootWithHyphen} scenarios:`, () => { + for (let index = 0; index < transitions.length; index++) { + const transition = transitions[index]; - transitions.forEach(transition => { const playerOne = playersData[`playerOne${transition}`]; const playerTwo = playersData[`playerTwo${transition}`]; const teamOne = teamsData[`teamOne${transition}`]; const teamTwo = teamsData[`teamTwo${transition}`]; - describe(`transition: ${transition} scenarios:`, () => { + describe(`${rootType}-${root}-transition-${transition}-scenarios:`, () => { it("loaded home page", async () => { await screen.loadedHome(); }); - it(`loaded ${rootWithHyphen} root with frames`, async () => { + it(`loaded ${root} root with frames`, async () => { await screen[`navigateTo${root}RootWithFrames`](); await screen[`loaded${root}RootWithFrames`](); }); @@ -155,7 +154,7 @@ describe("tab-root:", () => { await screen.loadedHome(); }); }); - }); + }; }); - }); + } }); From 116c3a7a80d45fa240c6cc121eff8f43a8f28bea Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Mon, 4 Mar 2019 11:35:07 +0200 Subject: [PATCH 2/2] [Do Not Merge] chore(e2e): skip specific test suites with known issues on android / ios (#6797) * Update README.md * comment flip * skip specific test suites with known issues * restore skipped ios tests * chore: update css for ios * chore: update android css * chore: tab-root tests remove suspend for android * chore: frame-root tested on api23, api27 and ios11 * chore: fix tslint * chore: frame-tab-root tests api27 * chore: lower font size --- .../.vscode/launch.json | 22 ++++ .../app/app.android.css | 17 +-- e2e/nested-frame-navigation/app/app.ios.css | 15 +++ .../app/frame-root/frame-multi-home-page.xml | 4 +- .../app/layout-root/layout-home-page.xml | 4 +- .../layout-home-secondary-page.xml | 4 +- .../player-item-detail-page.xml | 6 +- .../app/players/players-items-page.xml | 4 +- e2e/nested-frame-navigation/e2e/config.ts | 3 +- .../e2e/frame-root.e2e-spec.ts | 118 +++++++++--------- .../e2e/frame-tab-root.e2e-spec.ts | 71 +++++++---- .../e2e/layout-root.e2e-spec.ts | 9 ++ e2e/nested-frame-navigation/e2e/screen.ts | 17 ++- .../e2e/tab-root.e2e-spec.ts | 26 +++- 14 files changed, 204 insertions(+), 116 deletions(-) diff --git a/e2e/nested-frame-navigation/.vscode/launch.json b/e2e/nested-frame-navigation/.vscode/launch.json index a017624a8..bbd504901 100644 --- a/e2e/nested-frame-navigation/.vscode/launch.json +++ b/e2e/nested-frame-navigation/.vscode/launch.json @@ -4,6 +4,28 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "type": "node", + "request": "launch", + "name": "debug tests", + "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", + "args": [ + "-u", + "tdd", + "--timeout", + "999999", + "--colors", + "${workspaceFolder}/e2e", + "--opts", + "../config/mocha.opts", + "-p", + "4723", + "-a", + "--grep", + "layout-root" + ], + "internalConsoleOptions": "openOnSessionStart" + }, { "type": "node", "request": "launch", diff --git a/e2e/nested-frame-navigation/app/app.android.css b/e2e/nested-frame-navigation/app/app.android.css index 2b5f529b5..68a02544a 100644 --- a/e2e/nested-frame-navigation/app/app.android.css +++ b/e2e/nested-frame-navigation/app/app.android.css @@ -1,25 +1,20 @@ Button { font-size: 8; - padding-left: 5; - padding-right: 5; - padding-top: 0; - padding-bottom: 0; - margin-top: 0; - margin-bottom: 0; - margin-right: 0; - height: 50px; + padding: 0; + margin: 0; + height: 30px; color: blue; } TextView { - font-size: 10; + font-size: 8; margin: 0; padding: 0; color: green; } Label { - font-size: 10; + font-size: 8; margin: 0; padding: 0; } @@ -30,6 +25,6 @@ GridLayout { } ActionBar { - height: 30; + height: 20; margin: 0; } \ No newline at end of file diff --git a/e2e/nested-frame-navigation/app/app.ios.css b/e2e/nested-frame-navigation/app/app.ios.css index 40458c5c6..9444b9452 100644 --- a/e2e/nested-frame-navigation/app/app.ios.css +++ b/e2e/nested-frame-navigation/app/app.ios.css @@ -1,7 +1,22 @@ Button{ color: blue; + font-size: 10; + height: 35px; + margin: 0; } TextView{ color: green; + font-size: 10; +} + +Label{ + margin: 0; + padding: 0; + font-size: 10; +} + +ActionBar { + margin: 0; + padding: 0; } \ No newline at end of file diff --git a/e2e/nested-frame-navigation/app/frame-root/frame-multi-home-page.xml b/e2e/nested-frame-navigation/app/frame-root/frame-multi-home-page.xml index c65c41a05..2c4011abc 100644 --- a/e2e/nested-frame-navigation/app/frame-root/frame-multi-home-page.xml +++ b/e2e/nested-frame-navigation/app/frame-root/frame-multi-home-page.xml @@ -1,8 +1,8 @@ - + - diff --git a/e2e/nested-frame-navigation/app/layout-root/layout-home-page.xml b/e2e/nested-frame-navigation/app/layout-root/layout-home-page.xml index bde06d5af..7962a84af 100644 --- a/e2e/nested-frame-navigation/app/layout-root/layout-home-page.xml +++ b/e2e/nested-frame-navigation/app/layout-root/layout-home-page.xml @@ -1,7 +1,7 @@ - -