mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: fixes
This commit is contained in:
@@ -10,24 +10,21 @@ ActionBar {
|
||||
background-color: aquamarine;
|
||||
}
|
||||
|
||||
BottomNavigation {
|
||||
background-color: lightgreen;
|
||||
}
|
||||
|
||||
Button {
|
||||
background-color: lightskyblue;
|
||||
}
|
||||
|
||||
#lastItem {
|
||||
color: black;
|
||||
BottomNavigation {
|
||||
background-color: lightgreen;
|
||||
}
|
||||
|
||||
TabStripItem:active {
|
||||
background-color: coral;
|
||||
#lastStripItem {
|
||||
color: greenyellow;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
TabContentItem:active {
|
||||
background-color: aquamarine;
|
||||
TabStripItem:active, #lastStripItem:active {
|
||||
background-color:coral;
|
||||
}
|
||||
|
||||
#second-tab-content-item {
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
<TabStripItem iconSource="res://up" title="ICON-RES"></TabStripItem>
|
||||
|
||||
<TabStripItem title="Simply Long Title"></TabStripItem>
|
||||
|
||||
<TabStripItem iconSource="res://icon" id="lastItem" title="LAST"></TabStripItem>
|
||||
|
||||
<TabStripItem iconSource="res://icon" id="lastStripItem" title="LAST"></TabStripItem>
|
||||
|
||||
</TabStrip>
|
||||
<TabContentItem>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<Page class="page">
|
||||
|
||||
<ActionBar title="BottomNavigation color" icon="" class="action-bar">
|
||||
<ActionBar title="BottomNavigation FONT" icon="" class="action-bar">
|
||||
</ActionBar>
|
||||
|
||||
<BottomNavigation>
|
||||
<BottomNavigation automationText="bottomNavigation" >
|
||||
<TabStrip>
|
||||
<TabStripItem title="First" class="special"></TabStripItem>
|
||||
<TabStripItem title="Second"></TabStripItem>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<Page class="page">
|
||||
|
||||
<ActionBar title="BottomNavigation color" icon="" class="action-bar">
|
||||
<ActionBar title="BottomNavigation Text Transform" icon="" class="action-bar">
|
||||
</ActionBar>
|
||||
|
||||
<BottomNavigation>
|
||||
<BottomNavigation automationText="bottomNavigation" >
|
||||
<TabStrip>
|
||||
<TabStripItem title="first" class="special"></TabStripItem>
|
||||
<TabStripItem title="second"></TabStripItem>
|
||||
|
||||
@@ -46,10 +46,10 @@ export class ButtonBackgroundPage extends PageObjectBaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
async executeScenario(imageName: string, button: string) {
|
||||
async executeScenario(button: string) {
|
||||
const presenter = await this.testElement();
|
||||
await this.tapBtn(button);
|
||||
const result = await this._driver.compareElement(presenter, imageName, 0.01, 5, ImageOptions.percent);
|
||||
const result = await this._driver.compareElement(presenter, undefined, 0.01, 5, ImageOptions.percent);
|
||||
assert.isTrue(result);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
|
||||
import { ButtonBackgroundPage } from "./button-background-page";
|
||||
import { assert } from "chai";
|
||||
import { ImageOptions } from "nativescript-dev-appium/lib/image-options";
|
||||
import { setImageName } from "../../../helpers/image-helper";
|
||||
|
||||
const suite = "button";
|
||||
const spec = "background";
|
||||
const imagePrefix = `${suite}-${spec}`;
|
||||
|
||||
describe(`${suite}-${spec}-suite`, () => {
|
||||
describe(`${imagePrefix}-suite`, () => {
|
||||
let driver: AppiumDriver;
|
||||
let backgroundPage: ButtonBackgroundPage;
|
||||
|
||||
@@ -16,6 +17,7 @@ describe(`${suite}-${spec}-suite`, () => {
|
||||
await driver.restartApp();
|
||||
backgroundPage = new ButtonBackgroundPage(driver);
|
||||
await backgroundPage.initSuite();
|
||||
driver.imageHelper.options.donNotAppendActualSuffixOnIntialImageCapture = true;
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
@@ -23,7 +25,7 @@ describe(`${suite}-${spec}-suite`, () => {
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
driver.imageHelper.testName = this.currentTest.title;
|
||||
driver.imageHelper.testName = setImageName(suite, spec, this.currentTest.title);
|
||||
});
|
||||
|
||||
afterEach(async function () {
|
||||
@@ -34,127 +36,126 @@ describe(`${suite}-${spec}-suite`, () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("background_11", async function () {
|
||||
it(`${imagePrefix}-init`, async function () {
|
||||
const presenter = await backgroundPage.testElement();
|
||||
const result = await driver.compareElement(presenter, "background_11_clean", 0.1, 2);
|
||||
const result = await driver.compareElement(presenter, `${imagePrefix}-reset`);
|
||||
assert.isTrue(result);
|
||||
});
|
||||
|
||||
it("background_12", async function () {
|
||||
await await backgroundPage.executeScenario("background_12", "1");
|
||||
it(`${imagePrefix}-1`, async function () {
|
||||
await await backgroundPage.executeScenario("1");
|
||||
});
|
||||
|
||||
it("background_13", async function () {
|
||||
it(`${imagePrefix}-reset`, async function () {
|
||||
await backgroundPage.tapResetBtn();
|
||||
const presenter = await backgroundPage.testElement();
|
||||
const result = await driver.compareElement(presenter, "background_11_clean");
|
||||
const result = await driver.compareElement(presenter, `${imagePrefix}-reset`);
|
||||
assert.isTrue(result);
|
||||
});
|
||||
|
||||
// Border
|
||||
it("background_21_border", async function () {
|
||||
// await backgroundPage.navigateBackToSuitMainPage();
|
||||
await backgroundPage.executeScenario("background_21_border", "21");
|
||||
it(`${imagePrefix}-21-borders`, async function () {
|
||||
await backgroundPage.executeScenario("21");
|
||||
});
|
||||
|
||||
it("background_22_border", async function () {
|
||||
await backgroundPage.executeScenario("background_22_border", "22");
|
||||
it(`${imagePrefix}-22-borders`, async function () {
|
||||
await backgroundPage.executeScenario("22");
|
||||
});
|
||||
|
||||
it("background_23_border", async function () {
|
||||
await backgroundPage.executeScenario("background_23_border", "23");
|
||||
it(`${imagePrefix}-23-borders`, async function () {
|
||||
await backgroundPage.executeScenario("23");
|
||||
});
|
||||
|
||||
// Repeat
|
||||
it("background_31_repeat", async function () {
|
||||
await backgroundPage.executeScenario("background_31_repeat", "31");
|
||||
it(`${imagePrefix}-31-repeat`, async function () {
|
||||
await backgroundPage.executeScenario("31");
|
||||
});
|
||||
|
||||
it("background_32_repeat", async function () {
|
||||
await backgroundPage.executeScenario("background_32_repeat", "32");
|
||||
it(`${imagePrefix}-32-repeat`, async function () {
|
||||
await backgroundPage.executeScenario("32");
|
||||
});
|
||||
|
||||
it("background_33_repeat", async function () {
|
||||
await backgroundPage.executeScenario("background_33_repeat", "33");
|
||||
it(`${imagePrefix}-33-repeat`, async function () {
|
||||
await backgroundPage.executeScenario("33");
|
||||
});
|
||||
|
||||
// Position
|
||||
it("background_41_position", async function () {
|
||||
await backgroundPage.executeScenario("background_41_position", "41");
|
||||
it(`${imagePrefix}-41-position`, async function () {
|
||||
await backgroundPage.executeScenario("41");
|
||||
});
|
||||
|
||||
it("background_42_position", async function () {
|
||||
await backgroundPage.executeScenario("background_42_position", "42");
|
||||
it(`${imagePrefix}-42-position`, async function () {
|
||||
await backgroundPage.executeScenario("42");
|
||||
});
|
||||
|
||||
it("background_43_position", async function () {
|
||||
await backgroundPage.executeScenario("background_43_position", "43");
|
||||
it(`${imagePrefix}-43-position`, async function () {
|
||||
await backgroundPage.executeScenario("43");
|
||||
});
|
||||
|
||||
it("background_44_position", async function () {
|
||||
await backgroundPage.executeScenario("background_44_position", "44");
|
||||
it(`${imagePrefix}-44-position`, async function () {
|
||||
await backgroundPage.executeScenario("44");
|
||||
});
|
||||
|
||||
it("background_45_position", async function () {
|
||||
await backgroundPage.executeScenario("background_45_position", "45");
|
||||
it(`${imagePrefix}-45-position`, async function () {
|
||||
await backgroundPage.executeScenario("45");
|
||||
});
|
||||
|
||||
it("background_46_position", async function () {
|
||||
await backgroundPage.executeScenario("background_46_position", "46");
|
||||
it(`${imagePrefix}-46-position`, async function () {
|
||||
await backgroundPage.executeScenario("46");
|
||||
});
|
||||
|
||||
it("background_47_position", async function () {
|
||||
await backgroundPage.executeScenario("background_47_position", "47");
|
||||
it(`${imagePrefix}-47-position`, async function () {
|
||||
await backgroundPage.executeScenario("47");
|
||||
});
|
||||
|
||||
it("background_48_position", async function () {
|
||||
await backgroundPage.executeScenario("background_48_position", "48");
|
||||
it(`${imagePrefix}-48-position`, async function () {
|
||||
await backgroundPage.executeScenario("48");
|
||||
});
|
||||
|
||||
it("background_49_position", async function () {
|
||||
await backgroundPage.executeScenario("background_49_position", "49");
|
||||
it(`${imagePrefix}-49-position`, async function () {
|
||||
await backgroundPage.executeScenario("49");
|
||||
});
|
||||
|
||||
it("background_50_position", async function () {
|
||||
await backgroundPage.executeScenario("background_50_position", "50");
|
||||
it(`${imagePrefix}-50-position`, async function () {
|
||||
await backgroundPage.executeScenario("50");
|
||||
});
|
||||
|
||||
it("background_51_position", async function () {
|
||||
await backgroundPage.executeScenario("background_51_position", "51");
|
||||
it(`${imagePrefix}-51-position`, async function () {
|
||||
await backgroundPage.executeScenario("51");
|
||||
});
|
||||
|
||||
it("background_52_position", async function () {
|
||||
await backgroundPage.executeScenario("background_52_position", "52");
|
||||
it(`${imagePrefix}-52-position`, async function () {
|
||||
await backgroundPage.executeScenario("52");
|
||||
});
|
||||
|
||||
// Size
|
||||
it("background_61_size", async function () {
|
||||
await backgroundPage.executeScenario("background_61_size", "61");
|
||||
it(`${imagePrefix}-61-size`, async function () {
|
||||
await backgroundPage.executeScenario("61");
|
||||
});
|
||||
|
||||
it("background_62_size", async function () {
|
||||
await backgroundPage.executeScenario("background_62_size", "62");
|
||||
it(`${imagePrefix}-62-size`, async function () {
|
||||
await backgroundPage.executeScenario("62");
|
||||
});
|
||||
|
||||
it("background_63_size", async function () {
|
||||
await backgroundPage.executeScenario("background_63_size", "63");
|
||||
it(`${imagePrefix}-63-size`, async function () {
|
||||
await backgroundPage.executeScenario("63");
|
||||
});
|
||||
|
||||
it("background_64_size", async function () {
|
||||
await backgroundPage.executeScenario("background_64_size", "64");
|
||||
it(`${imagePrefix}-64-size`, async function () {
|
||||
await backgroundPage.executeScenario("64");
|
||||
});
|
||||
|
||||
// All
|
||||
it("background_71_all", async function () {
|
||||
await backgroundPage.executeScenario("background_71_all", "71");
|
||||
it(`${imagePrefix}-71-all`, async function () {
|
||||
await backgroundPage.executeScenario("71");
|
||||
});
|
||||
|
||||
it("background_72_all", async function () {
|
||||
await backgroundPage.executeScenario("background_72_all", "72");
|
||||
it(`${imagePrefix}-72-all`, async function () {
|
||||
await backgroundPage.executeScenario("72");
|
||||
});
|
||||
|
||||
// Antialiasing
|
||||
it("background_78_antialiasing", async function () {
|
||||
await backgroundPage.executeScenario("background_78_antialiasing", "78");
|
||||
it(`${imagePrefix}-78-antialiasing`, async function () {
|
||||
await backgroundPage.executeScenario("78");
|
||||
});
|
||||
});
|
||||
@@ -14,6 +14,8 @@ export class BottomNavigationBasePage extends PageObjectBaseModel {
|
||||
this._driver.imageHelper.options.keepOriginalImageSize = false;
|
||||
this._driver.imageHelper.options.tolerance = 0;
|
||||
this._driver.imageHelper.options.toleranceType = ImageOptions.pixel;
|
||||
// this._driver.imageHelper.options.donNotAppendActualSuffixOnIntialImageCapture = true;
|
||||
this._driver.imageHelper.options.timeOutSeconds = 7;
|
||||
}
|
||||
|
||||
async init(subSuiteName: string) {
|
||||
|
||||
@@ -7,8 +7,9 @@ import { assert } from "chai";
|
||||
|
||||
const suite = "tab-navigation";
|
||||
const spec = "bottom-navigation-css";
|
||||
const imagePrefix = `${suite}-${spec}`;
|
||||
|
||||
describe(`${suite}-${spec}-suite`, async function () {
|
||||
describe(`${imagePrefix}-suite`, async function () {
|
||||
let driver: AppiumDriver;
|
||||
let bottomNavigationBasePage: BottomNavigationBasePage;
|
||||
|
||||
@@ -44,6 +45,7 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
const sample = samples[index];
|
||||
let imageName = `${spec}-${sample.sample.replace(/[^a-z]/ig, "-").replace(/(-+)/ig, "-").replace(/(_+)/ig, "_").replace(/-$/, "")}`;
|
||||
it(imageName, async function () {
|
||||
this.skip();
|
||||
if (driver.platformName === Platform.ANDROID
|
||||
&& (sample.sample.toLowerCase() === "all"
|
||||
|| sample.sample.toLowerCase() === "reset")) {
|
||||
|
||||
@@ -47,7 +47,7 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
await bottomNavigationBasePage.refreshBottomNavigationTab();
|
||||
await bottomNavigationBasePage.tabOnItem(1);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
|
||||
await bottomNavigationBasePage.navigateBackToSuitMainPage();
|
||||
@@ -203,7 +203,7 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
await driver.backgroundApp(1);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await driver.setOrientation(DeviceOrientaion.PORTRAIT);
|
||||
// await driver.setOrientation(DeviceOrientaion.PORTRAIT);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
@@ -212,15 +212,11 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
|
||||
it(`${spec}-icon-change`, async function () {
|
||||
await bottomNavigationBasePage.navigateToSample("icon-change");
|
||||
const index = driver.nsCapabilities.device.platform === Platform.IOS
|
||||
? (+driver.nsCapabilities.device.apiLevel >= 11 ? 2 : 3) : 1;
|
||||
|
||||
let btns = await driver.findElementsByClassName(driver.locators.button, 5000);
|
||||
await btns[index].tap();
|
||||
await bottomNavigationBasePage.refreshBottomNavigationTab();
|
||||
await bottomNavigationBasePage.tabOnItem(1);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
btns = await driver.findElementsByClassName(driver.locators.button, 5000);
|
||||
await btns[index - 1].tap();
|
||||
await bottomNavigationBasePage.tabOnItem(0);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
@@ -246,4 +242,28 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
await bottomNavigationBasePage.navigateBackToSuitMainPage();
|
||||
});
|
||||
|
||||
it(`${spec}-text-transform`, async function () {
|
||||
await bottomNavigationBasePage.navigateToSample("text-transform");
|
||||
await bottomNavigationBasePage.refreshBottomNavigationTab();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await bottomNavigationBasePage.tabOnItem(1);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
await bottomNavigationBasePage.navigateBackToSuitMainPage();
|
||||
});
|
||||
|
||||
it(`${spec}-fonts`, async function () {
|
||||
await bottomNavigationBasePage.navigateToSample("text-transform");
|
||||
await bottomNavigationBasePage.refreshBottomNavigationTab();
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
await bottomNavigationBasePage.tabOnItem(1);
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
|
||||
await bottomNavigationBasePage.navigateBackToSuitMainPage();
|
||||
});
|
||||
});
|
||||
@@ -122,6 +122,9 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
});
|
||||
|
||||
it(`${spec}-icons`, async function () {
|
||||
if (driver.isAndroid) {
|
||||
this.skip();
|
||||
}
|
||||
await tabViewBasePage.navigateToSample("tab-view-icons");
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
@@ -142,6 +145,9 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
});
|
||||
|
||||
it(`${spec}-icons-local`, async function () {
|
||||
if (driver.isAndroid) {
|
||||
this.skip();
|
||||
}
|
||||
await tabViewBasePage.navigateToSample("tab-view-icons-local");
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
await driver.restartApp();
|
||||
tabViewBasePage = new TabViewBasePage(driver, ElementCacheStrategy.none);
|
||||
await tabViewBasePage.init("tabViewCss");
|
||||
driver.imageHelper.options.keepOriginalImageSize = false;
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
@@ -56,6 +57,9 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
const sample = samples[index];
|
||||
let imageName = `${spec}-${sample.sample.replace(/[^a-z]/ig, "-").replace(/(-+)/ig, "-").replace(/(_+)/ig, "_").replace(/-$/, "")}`;
|
||||
it(imageName, async function () {
|
||||
if (driver.isIOS && imageName.includes("android")) {
|
||||
this.skip();
|
||||
}
|
||||
if (driver.platformName === Platform.ANDROID
|
||||
&& (sample.sample.toLowerCase() === "all" || sample.sample.toLowerCase() === "reset")) {
|
||||
await driver.scroll(Direction.down, 400, 200, 300, 200);
|
||||
|
||||
@@ -6,7 +6,6 @@ const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target
|
||||
const CleanWebpackPlugin = require("clean-webpack-plugin");
|
||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
|
||||
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
|
||||
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
|
||||
const TerserPlugin = require("terser-webpack-plugin");
|
||||
@@ -214,11 +213,7 @@ module.exports = env => {
|
||||
"sass-loader"
|
||||
]
|
||||
},
|
||||
// TODO: Invetigate why do we need???
|
||||
{
|
||||
test: /\.png$|.jpg$|.ttf$|.otf$|.gradle$|.storyboard$|.plist$/,
|
||||
use: { loader: "raw-loader" }
|
||||
},
|
||||
|
||||
{
|
||||
test: /\.ts$/,
|
||||
use: {
|
||||
@@ -242,7 +237,7 @@ module.exports = env => {
|
||||
// Define useful constants like TNS_WEBPACK
|
||||
new webpack.DefinePlugin({
|
||||
"global.TNS_WEBPACK": "true",
|
||||
"process": undefined,
|
||||
"process": "global.process",
|
||||
}),
|
||||
// Remove all files from the out dir.
|
||||
new CleanWebpackPlugin(itemsToClean, { verbose: !!verbose }),
|
||||
@@ -271,9 +266,6 @@ module.exports = env => {
|
||||
async: false,
|
||||
useTypescriptIncrementalApi: true,
|
||||
memoryLimit: 4096
|
||||
}),
|
||||
new ExtraWatchWebpackPlugin({
|
||||
files: [`node_modules/**/*.${platform}.ts`]
|
||||
})
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user