From 14360881e6a7980f61e78feaf9b99983e6f8c87b Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Thu, 25 Mar 2021 21:01:55 -0700 Subject: [PATCH] chore: fix automated tests --- apps/automated/src/data/observable-tests.ts | 3 +-- apps/automated/src/navigation/navigation-tests.ts | 5 +---- apps/automated/src/navigation/transition-tests.ts | 3 +-- apps/automated/src/ui/animation/animation-tests.ts | 3 +-- apps/automated/src/ui/button/button-tests-native.ios.ts | 2 +- apps/automated/src/ui/label/label-tests-native.android.ts | 2 +- apps/automated/src/ui/label/label-tests-native.ios.ts | 2 +- apps/automated/src/ui/label/label-tests.ts | 3 +-- .../src/ui/text-field/text-field-tests-native.android.ts | 2 +- .../src/ui/text-field/text-field-tests-native.ios.ts | 2 +- .../src/ui/text-view/text-view-tests-native.android.ts | 2 +- .../automated/src/ui/text-view/text-view-tests-native.ios.ts | 2 +- apps/automated/src/ui/view/view-tests.android.ts | 3 +-- apps/automated/src/ui/view/view-tests.ios.ts | 3 ++- apps/toolbox/src/pages/box-shadow.ts | 3 +-- 15 files changed, 16 insertions(+), 24 deletions(-) diff --git a/apps/automated/src/data/observable-tests.ts b/apps/automated/src/data/observable-tests.ts index 50fd2be07..5bfa1cefb 100644 --- a/apps/automated/src/data/observable-tests.ts +++ b/apps/automated/src/data/observable-tests.ts @@ -1,10 +1,9 @@ // >> observable-require -import { Observable, PropertyChangeData, EventData, WrappedValue, fromObject, fromObjectRecursive } from '@nativescript/core'; +import { Observable, PropertyChangeData, EventData, WrappedValue, fromObject, fromObjectRecursive, ObservableArray } from '@nativescript/core'; // << observable-require import * as TKUnit from '../tk-unit'; import * as types from '@nativescript/core/utils/types'; -import { ObservableArray } from '@nativescript/core'; var TESTED_NAME = 'tested'; class TestObservable extends Observable { diff --git a/apps/automated/src/navigation/navigation-tests.ts b/apps/automated/src/navigation/navigation-tests.ts index b80ef3141..62d943b54 100644 --- a/apps/automated/src/navigation/navigation-tests.ts +++ b/apps/automated/src/navigation/navigation-tests.ts @@ -1,8 +1,5 @@ import * as TKUnit from '../tk-unit'; -import { EventData, Page, NavigatedData } from '@nativescript/core'; -import { Frame, NavigationTransition } from '@nativescript/core/ui/frame'; -import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; -import { Color } from '@nativescript/core/color'; +import { EventData, Page, NavigatedData, Frame, NavigationTransition, StackLayout, Color } from '@nativescript/core'; import * as helper from '../ui-helper'; import * as frame from '@nativescript/core/ui/frame'; // Creates a random colorful page full of meaningless stuff. diff --git a/apps/automated/src/navigation/transition-tests.ts b/apps/automated/src/navigation/transition-tests.ts index bd0efef4e..abb722d38 100644 --- a/apps/automated/src/navigation/transition-tests.ts +++ b/apps/automated/src/navigation/transition-tests.ts @@ -1,10 +1,9 @@ import * as helper from '../ui-helper'; import * as platform from '@nativescript/core/platform'; -import { Trace } from '@nativescript/core'; +import { Trace, CoreTypes } from '@nativescript/core'; import { Color } from '@nativescript/core/color'; import { NavigationEntry, NavigationTransition } from '@nativescript/core/ui/frame'; import { Page } from '@nativescript/core/ui/page'; -import { CoreTypes } from '@nativescript/core'; import { CustomTransition } from './custom-transition'; function _testTransition(navigationTransition: NavigationTransition) { diff --git a/apps/automated/src/ui/animation/animation-tests.ts b/apps/automated/src/ui/animation/animation-tests.ts index e6826b33c..20d4b907b 100644 --- a/apps/automated/src/ui/animation/animation-tests.ts +++ b/apps/automated/src/ui/animation/animation-tests.ts @@ -4,12 +4,11 @@ import * as viewModule from '@nativescript/core/ui/core/view'; import { Label } from '@nativescript/core/ui/label'; import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; import * as colorModule from '@nativescript/core/color'; -import { Enums } from '@nativescript/core'; +import { CoreTypes, PercentLength } from '@nativescript/core'; import { AnimationPromise } from '@nativescript/core/ui/animation'; // >> animation-require import * as animation from '@nativescript/core/ui/animation'; -import { CoreTypes, PercentLength } from '@nativescript/core'; // << animation-require function prepareTest(parentHeight?: number, parentWidth?: number): Label { diff --git a/apps/automated/src/ui/button/button-tests-native.ios.ts b/apps/automated/src/ui/button/button-tests-native.ios.ts index 6203d8cc2..60e818847 100644 --- a/apps/automated/src/ui/button/button-tests-native.ios.ts +++ b/apps/automated/src/ui/button/button-tests-native.ios.ts @@ -1,6 +1,6 @@ import * as buttonModule from '@nativescript/core/ui/button'; import * as colorModule from '@nativescript/core/color'; -import { Enums } from '@nativescript/core'; +import { CoreTypes } from '@nativescript/core'; import { getColor } from '../../ui-helper'; export function getNativeText(button: buttonModule.Button): string { diff --git a/apps/automated/src/ui/label/label-tests-native.android.ts b/apps/automated/src/ui/label/label-tests-native.android.ts index 1ffccaf33..426bddf5d 100644 --- a/apps/automated/src/ui/label/label-tests-native.android.ts +++ b/apps/automated/src/ui/label/label-tests-native.android.ts @@ -1,5 +1,5 @@ import * as labelModule from '@nativescript/core/ui/label'; -import { Enums } from '@nativescript/core'; +import { CoreTypes } from '@nativescript/core'; import * as colorModule from '@nativescript/core/color'; export function getNativeTextAlignment(label: labelModule.Label): string { diff --git a/apps/automated/src/ui/label/label-tests-native.ios.ts b/apps/automated/src/ui/label/label-tests-native.ios.ts index b0e6fa7b8..59d8d44d4 100644 --- a/apps/automated/src/ui/label/label-tests-native.ios.ts +++ b/apps/automated/src/ui/label/label-tests-native.ios.ts @@ -1,5 +1,5 @@ import * as labelModule from '@nativescript/core/ui/label'; -import { Enums } from '@nativescript/core'; +import { CoreTypes } from '@nativescript/core'; import * as colorModule from '@nativescript/core/color'; import { getColor } from '../../ui-helper'; diff --git a/apps/automated/src/ui/label/label-tests.ts b/apps/automated/src/ui/label/label-tests.ts index 91306b373..cc1f322e3 100644 --- a/apps/automated/src/ui/label/label-tests.ts +++ b/apps/automated/src/ui/label/label-tests.ts @@ -10,7 +10,7 @@ import * as colorModule from '@nativescript/core/color'; import * as utils from '@nativescript/core/utils/utils'; import * as observableModule from '@nativescript/core/data/observable'; import * as bindable from '@nativescript/core/ui/core/bindable'; -import { CoreTypes } from '@nativescript/core'; +import { CoreTypes, Span, FormattedString } from '@nativescript/core'; import * as labelTestsNative from './label-tests-native'; import * as fs from '@nativescript/core/file-system'; @@ -20,7 +20,6 @@ import { isIOS, isAndroid } from '@nativescript/core/platform'; import { Label } from '@nativescript/core/ui/label'; import { LayoutBase } from '@nativescript/core/ui/layouts/layout-base'; import * as helper from '../../ui-helper'; -import { Span, FormattedString } from '@nativescript/core'; const testDir = 'ui/label'; diff --git a/apps/automated/src/ui/text-field/text-field-tests-native.android.ts b/apps/automated/src/ui/text-field/text-field-tests-native.android.ts index 767aaadad..bb8114ccf 100644 --- a/apps/automated/src/ui/text-field/text-field-tests-native.android.ts +++ b/apps/automated/src/ui/text-field/text-field-tests-native.android.ts @@ -1,4 +1,4 @@ -import { TextField, Color, Utils, Enums } from '@nativescript/core'; +import { TextField, Color, Utils, CoreTypes } from '@nativescript/core'; export function getNativeText(textField: TextField): string { return textField.android.getText().toString(); diff --git a/apps/automated/src/ui/text-field/text-field-tests-native.ios.ts b/apps/automated/src/ui/text-field/text-field-tests-native.ios.ts index 4ee999daf..5ff5ed042 100644 --- a/apps/automated/src/ui/text-field/text-field-tests-native.ios.ts +++ b/apps/automated/src/ui/text-field/text-field-tests-native.ios.ts @@ -1,7 +1,7 @@ import * as textFieldModule from '@nativescript/core/ui/text-field'; import * as colorModule from '@nativescript/core/color'; import { getColor } from '../../ui-helper'; -import { Enums } from '@nativescript/core'; +import { CoreTypes } from '@nativescript/core'; export function getNativeText(textField: textFieldModule.TextField): string { return textField.ios.text; diff --git a/apps/automated/src/ui/text-view/text-view-tests-native.android.ts b/apps/automated/src/ui/text-view/text-view-tests-native.android.ts index 0dc8c72b0..25b28656f 100644 --- a/apps/automated/src/ui/text-view/text-view-tests-native.android.ts +++ b/apps/automated/src/ui/text-view/text-view-tests-native.android.ts @@ -1,4 +1,4 @@ -import { TextView, Color, Utils, Enums } from '@nativescript/core'; +import { TextView, Color, Utils, CoreTypes } from '@nativescript/core'; export function getNativeText(textView: TextView): string { return textView.android.getText().toString(); diff --git a/apps/automated/src/ui/text-view/text-view-tests-native.ios.ts b/apps/automated/src/ui/text-view/text-view-tests-native.ios.ts index f1ced5939..c1e0c2b68 100644 --- a/apps/automated/src/ui/text-view/text-view-tests-native.ios.ts +++ b/apps/automated/src/ui/text-view/text-view-tests-native.ios.ts @@ -1,7 +1,7 @@ import * as textViewModule from '@nativescript/core/ui/text-view'; import * as colorModule from '@nativescript/core/color'; import { getColor } from '../../ui-helper'; -import { Enums } from '@nativescript/core'; +import { CoreTypes } from '@nativescript/core'; export function getNativeText(textView: textViewModule.TextView): string { return textView.ios.text; diff --git a/apps/automated/src/ui/view/view-tests.android.ts b/apps/automated/src/ui/view/view-tests.android.ts index a94c286a4..2270afc13 100644 --- a/apps/automated/src/ui/view/view-tests.android.ts +++ b/apps/automated/src/ui/view/view-tests.android.ts @@ -5,9 +5,8 @@ import { Button } from '@nativescript/core/ui/button'; import * as types from '@nativescript/core/utils/types'; import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; import { Label } from '@nativescript/core/ui/label'; -import { Trace } from '@nativescript/core'; +import { Trace, isIOS } from '@nativescript/core'; import { Color } from '@nativescript/core/color'; -import { isIOS } from '@nativescript/core'; // enable the trace, it is disabled by default Trace.enable(); diff --git a/apps/automated/src/ui/view/view-tests.ios.ts b/apps/automated/src/ui/view/view-tests.ios.ts index b8280d50f..7e4463323 100644 --- a/apps/automated/src/ui/view/view-tests.ios.ts +++ b/apps/automated/src/ui/view/view-tests.ios.ts @@ -84,7 +84,8 @@ export function testBackgroundInternalChangedOnceOnResize() { export function test_automation_text_set_to_native() { var newButton = new Button(); newButton.automationText = 'Button1'; + newButton.accessibilityLabel = 'Button1'; helper.getCurrentPage().content = newButton; TKUnit.assertEqual((newButton.ios).accessibilityIdentifier, 'Button1', 'accessibilityIdentifier not set to native view.'); - TKUnit.assertEqual((newButton.ios).accessibilityLabel, 'Button1', 'accessibilityIdentifier not set to native view.'); + TKUnit.assertEqual((newButton.ios).accessibilityLabel, 'Button1', 'accessibilityLabel not set to native view.'); } diff --git a/apps/toolbox/src/pages/box-shadow.ts b/apps/toolbox/src/pages/box-shadow.ts index 0414d6d4e..f269b3a2b 100644 --- a/apps/toolbox/src/pages/box-shadow.ts +++ b/apps/toolbox/src/pages/box-shadow.ts @@ -1,5 +1,4 @@ -import { Observable } from '@nativescript/core'; -import { EventData, Page } from '@nativescript/core'; +import { Observable, EventData, Page } from '@nativescript/core'; export function navigatingTo(args: EventData) { const page = args.object;