mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: update tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as vmModule from "./bottom-navigation-view-model";
|
||||
import { BottomNavigationViewModel } from "./bottom-navigation-view-model";
|
||||
|
||||
export function bottomNavigaitonLoaded(args) {
|
||||
const bottomNav = args.object.page;
|
||||
bottomNav.bindingContext = vmModule.bottomNavigationViewModel;
|
||||
bottomNav.bindingContext = new BottomNavigationViewModel();
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
|
||||
import { Label } from "tns-core-modules/ui/label";
|
||||
import { Observable } from "tns-core-modules/data/observable";
|
||||
import { ObservableArray } from "tns-core-modules/data/observable-array";
|
||||
import { TabStripItem } from "tns-core-modules/ui/tab-navigation-base/tab-strip-item";
|
||||
import { TabContentItem } from "tns-core-modules/ui/tab-navigation-base/tab-content-item";
|
||||
|
||||
@@ -58,4 +57,3 @@ export class BottomNavigationViewModel extends Observable {
|
||||
return contentItem;
|
||||
}
|
||||
}
|
||||
export const bottomNavigationViewModel = new BottomNavigationViewModel();
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
import * as vmModule from "./tabs-binding-view-model";
|
||||
|
||||
// var viewModel = vmModule.tabsBindingNavigationViewModel;
|
||||
|
||||
// export function tabsLoaded(args) {
|
||||
// let tabs = args.object;
|
||||
// tabs.bindingContext = viewModel;
|
||||
// }
|
||||
|
||||
// export function addTabs(args) {
|
||||
// viewModel.createItems();
|
||||
// }
|
||||
import { TabsBindingNavigationViewModel } from "./tabs-binding-view-model";
|
||||
|
||||
export function tabsLoaded(args) {
|
||||
const page = args.object.page;
|
||||
page.bindingContext = vmModule.tabsBindingNavigationViewModel;
|
||||
page.bindingContext = new TabsBindingNavigationViewModel();
|
||||
}
|
||||
@@ -58,4 +58,3 @@ export class TabsBindingNavigationViewModel extends Observable {
|
||||
return contentItem;
|
||||
}
|
||||
}
|
||||
export var tabsBindingNavigationViewModel = new TabsBindingNavigationViewModel();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { AppiumDriver, logInfo } from "nativescript-dev-appium";
|
||||
import { NavigationHelper, ElementCacheStrategy } from "./helpers/navigation-helper";
|
||||
import { ImageOptions } from "nativescript-dev-appium/lib/image-options";
|
||||
|
||||
export abstract class PageObjectBaseModel {
|
||||
|
||||
@@ -7,6 +8,11 @@ export abstract class PageObjectBaseModel {
|
||||
|
||||
constructor(protected _driver: AppiumDriver, protected _naviagtionLinks: Array<string>, elementCacheStrategy: ElementCacheStrategy = ElementCacheStrategy.none) {
|
||||
this.navigationHelper = new NavigationHelper(this._driver, this._naviagtionLinks, elementCacheStrategy);
|
||||
this._driver.imageHelper.options.overwriteActualImage = process.env["OVERWRITE_ACTUALIMAGE"] === 'true';
|
||||
this._driver.imageHelper.options.waitBeforeCreatingInitialImageCapture = +process.env["WAIT_BEFORE_CREATING_INITIAL_IMAGE_CAPTURE"] || 9000;
|
||||
this._driver.imageHelper.options.keepOriginalImageSize = false;
|
||||
this._driver.imageHelper.options.tolerance = 0;
|
||||
this._driver.imageHelper.options.toleranceType = ImageOptions.pixel;
|
||||
}
|
||||
|
||||
async initSuite() {
|
||||
|
||||
@@ -8,7 +8,6 @@ export class ButtonBackgroundPage extends PageObjectBaseModel {
|
||||
|
||||
constructor(_driver: AppiumDriver) {
|
||||
super(_driver, ["button", "background"], ElementCacheStrategy.none);
|
||||
this._driver.imageHelper.options.keepOriginalImageSize = false;
|
||||
this._driver.imageHelper.options.toleranceType = ImageOptions.percent;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,6 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
* Bug
|
||||
*/
|
||||
it(`${spec}-binding-add-items`, async function () {
|
||||
this.skip();
|
||||
|
||||
await bottomNavigationBasePage.navigateToSample("binding");
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
@@ -84,8 +82,6 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
* Bug
|
||||
*/
|
||||
it(`${spec}-binding-remove-items`, async function () {
|
||||
this.skip();
|
||||
|
||||
await bottomNavigationBasePage.navigateToSample("binding");
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
|
||||
@@ -10,12 +10,6 @@ export abstract class TabNavigationBasePage extends PageObjectBaseModel {
|
||||
|
||||
constructor(_driver: AppiumDriver, navigationLinks: Array<string>) {
|
||||
super(_driver, navigationLinks, ElementCacheStrategy.none);
|
||||
this._driver.imageHelper.options.waitBeforeCreatingInitialImageCapture = 6000;
|
||||
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;
|
||||
}
|
||||
|
||||
abstract async mainWidget();
|
||||
|
||||
@@ -12,8 +12,5 @@ export class TabViewBasePage extends PageObjectBaseModel {
|
||||
async init(subSuiteName: string) {
|
||||
this._naviagtionLinks.push(subSuiteName);
|
||||
await super.initSuite();
|
||||
this._driver.imageHelper.options.keepOriginalImageSize = false;
|
||||
this._driver.imageHelper.options.tolerance = 0;
|
||||
this._driver.imageHelper.options.toleranceType = ImageOptions.pixel;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { nsCapabilities, createDriver, AppiumDriver, Direction } from "nativescript-dev-appium";
|
||||
import { nsCapabilities, createDriver, AppiumDriver, Direction, logError } from "nativescript-dev-appium";
|
||||
import { TabViewBasePage } from "./tab-view-base-page";
|
||||
import { ImageOptions } from "nativescript-dev-appium/lib/image-options";
|
||||
import { Platform } from "mobile-devices-controller";
|
||||
@@ -32,7 +32,6 @@ 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 () {
|
||||
@@ -63,6 +62,9 @@ describe(`${suite}-${spec}-suite`, async function () {
|
||||
if (driver.platformName === Platform.ANDROID
|
||||
&& (sample.sample.toLowerCase() === "all" || sample.sample.toLowerCase() === "reset")) {
|
||||
await driver.scroll(Direction.down, 400, 200, 300, 200);
|
||||
await driver.scroll(Direction.down, 400, 200, 300, 200);
|
||||
await driver.scroll(Direction.down, 400, 200, 300, 200);
|
||||
|
||||
}
|
||||
const scenarioBtn = await driver.waitForElement(sample.sample);
|
||||
await scenarioBtn.tap();
|
||||
|
||||
@@ -177,8 +177,9 @@ describe(`${imagePrefix}-suite`, async function () {
|
||||
* Bug
|
||||
*/
|
||||
it(`${imagePrefix}-binding-add-items`, async function () {
|
||||
this.skip();
|
||||
|
||||
if (driver.isIOS) {
|
||||
this.skip();
|
||||
}
|
||||
await tabsViewBasePage.navigateToSample("tabs-binding");
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
@@ -207,8 +208,9 @@ describe(`${imagePrefix}-suite`, async function () {
|
||||
* Bug
|
||||
*/
|
||||
it(`${imagePrefix}-binding-remove-items`, async function () {
|
||||
this.skip();
|
||||
|
||||
if (driver.isIOS) {
|
||||
this.skip();
|
||||
}
|
||||
await tabsViewBasePage.navigateToSample("tabs-binding");
|
||||
await driver.imageHelper.compareScreen();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user