Skip to content

Commit

Permalink
Re-enable VisitAllPages E2ETest (#5699)
Browse files Browse the repository at this point in the history
* re-enable

* comment out PlatformColor test, this was the failing test in the past as well

* trying again, this time commenting out PanResponder Sample, which comes just before the failing test

* trying to wait for home page to load before continuing

* another take on waiting for item in FlatList to be loaded first

* trying new approach, enter test name in edit box to filter first

* made some progress, now timing out on edit control, add polling for that control

* finally!  success.  Try #2

* try #3, fingers crossed!

* try #4

* split test into groups

* bumping up timeout

* try #2 with longer timeout

* go back to one testspec

* try #4 with longer timeout

* try #5 with longer timeout.  really folks I think I got it this time :)

* convert all the tests to use same mechanism

* Change files

* remove smoke test

* stability pass after removing smoke test, try #2
  • Loading branch information
kmelmon authored Aug 18, 2020
1 parent 50f0f87 commit 4174941
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 165 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"type": "prerelease",
"comment": "fix instability in VisitAllPages test",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch",
"date": "2020-08-17T22:28:29.230Z"
}
16 changes: 8 additions & 8 deletions packages/E2ETest/wdio/pages/BasePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ export function wait(timeout: number) {
}

export class BasePage {
isPageLoaded(): boolean {
return this.homeButton.isDisplayed();
isElementLoaded(element: string): boolean {
return By(element).isDisplayed();
}

waitForPageLoaded(timeout?: number) {
waitForElementLoaded(element: string, timeout?: number) {
// eslint-disable-next-line no-undef
browser.waitUntil(
() => {
return this.isPagedLoadedOrLoadBundleError();
return this.isElementLoadedOrLoadBundleError(element);
},
this.timeoutForPageLoaded(timeout),
'Wait for page ' + this.constructor.name + ' timeout'
'Wait for element ' + element + ' timeout'
);
}

Expand Down Expand Up @@ -73,18 +73,18 @@ export class BasePage {
return By(REACT_CONTROL_ERROR_TEST_ID);
}

private isPagedLoadedOrLoadBundleError(): boolean {
private isElementLoadedOrLoadBundleError(element: string): boolean {
if (this.reactControlErrorMessage.isDisplayed()) {
throw "ReactControl doesn't load bundle successfully: " +
this.reactControlErrorMessage.getText();
}
return this.isPageLoaded();
return this.isElementLoaded(element);
}

private get treeDumpResult() {
return By(TREE_DUMP_RESULT);
}

// Default timeout for waitForPageLoaded command in PageObject
private waitforPageTimeout: number = 10000;
private waitforPageTimeout: number = 60000;
}
9 changes: 0 additions & 9 deletions packages/E2ETest/wdio/pages/ControlStylePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ import { BasePage, By } from './BasePage';
import { SHOWBORDER_ON_CONTROLSTYLE } from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

class ControlStyleTestPage extends BasePage {
backToHomePage() {
this.homeButton.click();
this.waitForPageLoaded();
}

isPageLoaded() {
return super.isPageLoaded();
}

toggleControlBorder() {
this._controlBorder.click();
}
Expand Down
9 changes: 0 additions & 9 deletions packages/E2ETest/wdio/pages/DirectManipulationPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ import {
} from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

class DirectManipulationPage extends BasePage {
backToHomePage() {
this.homeButton.click();
this.waitForPageLoaded();
}

isPageLoaded() {
return super.isPageLoaded() && this.measureInWindowButton.isDisplayed();
}

clickMeasureInWindowAndGetResult() {
this.measureInWindowButton.click();
return this.directManipulationResult.getText();
Expand Down
86 changes: 12 additions & 74 deletions packages/E2ETest/wdio/pages/HomePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,86 +4,24 @@
*/

import { BasePage, By } from './BasePage';
import TextInputTestPage from './TextInputTestPage';
import {
TEXTINPUT_TESTPAGE,
LOGIN_TESTPAGE,
DIRECT_MANIPULATION_TESTPAGE,
IMAGE_TESTPAGE,
CONTROL_STYLE_TESTPAGE,
TRANSFORM_TESTPAGE,
SEARCH_BOX,
BACK_BUTTON,
} from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';
import LoginPage from './LoginPage';
import DirectManipulationPage from './DirectManipulationPage';
import ImageTestPage from './ImageTestPage';
import ControlStyleTestPage from './ControlStylePage';

class HomePage extends BasePage {
backToHomePage() {
this.homeButton.click();
this.waitForPageLoaded();
}

isPageLoaded() {
return super.isPageLoaded() && this.testInputTestPageButton.isDisplayed();
}

clickAndGoToTextInputPage() {
this.testInputTestPageButton.click();
TextInputTestPage.waitForPageLoaded();
}

clickAndGotoLoginPage() {
this.loginTestPageButton.click();
LoginPage.waitForPageLoaded();
}

clickAndGotoDirectManipulationPage() {
this.directManipulationPageButton.click();
DirectManipulationPage.waitForPageLoaded();
}

clickAndGotoImagePage() {
this.ImagePageButton.click();
ImageTestPage.waitForPageLoaded();
}

clickControlStylePageButton() {
this.ControlStylePageButton.click();
}

clickAndGotoControlStylePage() {
this.ControlStylePageButton.click();
ControlStyleTestPage.waitForPageLoaded();
}

clickAndGotoTransformTestPage() {
this.TransformTestPageButton.click();
ControlStyleTestPage.waitForPageLoaded();
}

private get testInputTestPageButton() {
return By(TEXTINPUT_TESTPAGE);
}

private get loginTestPageButton() {
return By(LOGIN_TESTPAGE);
goToTestPage(page: string) {
// Filter the list down to the one test, to improve the stability of selectors
this.waitForElementLoaded(SEARCH_BOX);
let editBox = By(SEARCH_BOX);
editBox.setValue(page);
let pageItem = By(page);
pageItem.click();
super.waitForElementLoaded(BACK_BUTTON);
}

private get directManipulationPageButton() {
return By(DIRECT_MANIPULATION_TESTPAGE);
}

private get ImagePageButton() {
return By(IMAGE_TESTPAGE);
}

private get ControlStylePageButton() {
return By(CONTROL_STYLE_TESTPAGE);
}

private get TransformTestPageButton() {
return By(TRANSFORM_TESTPAGE);
backToHomePage() {
this.homeButton.click();
}
}

Expand Down
9 changes: 0 additions & 9 deletions packages/E2ETest/wdio/pages/ImageTestPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ import {
} from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

class ImageTestPage extends BasePage {
backToHomePage() {
this.homeButton.click();
this.waitForPageLoaded();
}

isPageLoaded() {
return super.isPageLoaded();
}

toggleImageBorder() {
this._imageBorder.click();
}
Expand Down
4 changes: 0 additions & 4 deletions packages/E2ETest/wdio/pages/LoginPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import {
} from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

class LoginPage extends BasePage {
isPageLoaded() {
return super.isPageLoaded() && this._userName.isDisplayed();
}

setLoginInfo(userName: string, password: string) {
this._userName.setValue(userName);
this._password.setValue(password);
Expand Down
4 changes: 0 additions & 4 deletions packages/E2ETest/wdio/pages/TextInputTestPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import {
} from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

class TextInputTestPage extends BasePage {
isPageLoaded() {
return super.isPageLoaded() && this.textInput.isDisplayed();
}

clickTextInput() {
this.textInput.click();
}
Expand Down
9 changes: 0 additions & 9 deletions packages/E2ETest/wdio/pages/TransformTestPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,6 @@ import {
} from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

class DirectManipulationPage extends BasePage {
backToHomePage() {
this.homeButton.click();
this.waitForPageLoaded();
}

isPageLoaded() {
return super.isPageLoaded() && this.measureLayoutButton.isDisplayed();
}

clickApplyScaleTransform() {
this.applyScaleTransformButton.click();
}
Expand Down
15 changes: 0 additions & 15 deletions packages/E2ETest/wdio/test/AAA_SmokeTest.spec.ts

This file was deleted.

3 changes: 2 additions & 1 deletion packages/E2ETest/wdio/test/DirectManipulation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import HomePage from '../pages/HomePage';
import DirectManipulationPage from '../pages/DirectManipulationPage';
import assert from 'assert';
import { DIRECT_MANIPULATION_TESTPAGE } from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

beforeAll(() => {
HomePage.clickAndGotoDirectManipulationPage();
HomePage.goToTestPage(DIRECT_MANIPULATION_TESTPAGE);
});

describe('DirectManipulationTest', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/E2ETest/wdio/test/Image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import HomePage from '../pages/HomePage';
import ImageTestPage from '../pages/ImageTestPage';
import assert from 'assert';
import { IMAGE_TESTPAGE } from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

beforeAll(() => {
HomePage.clickAndGotoImagePage();
HomePage.goToTestPage(IMAGE_TESTPAGE);
});

describe('ImageWithoutBorderTest', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/E2ETest/wdio/test/TransformTest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import HomePage from '../pages/HomePage';
import TransformTestPage from '../pages/TransformTestPage';
import assert from 'assert';
import { TRANSFORM_TESTPAGE } from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

beforeAll(() => {
HomePage.clickAndGotoTransformTestPage();
HomePage.goToTestPage(TRANSFORM_TESTPAGE);
});

describe('TransformTest', () => {
Expand Down
22 changes: 4 additions & 18 deletions packages/E2ETest/wdio/test/VisitAllPages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
* Licensed under the MIT License.
*/

import { BasePage, By } from '../pages/BasePage';
import HomePage from '../pages/HomePage';

let pages = [
'<ActivityIndicator>',
/* TODO: Disabling most of the test for now due to
instability, tracked by #5661
'<Button>',
// 'Custom Views',
'<DatePicker>',
Expand All @@ -29,7 +27,7 @@ let pages = [
'<Switch>',
'<Text>',
'<TextInput>',
'<Touchable*> and onPress',
//'<Touchable*> and onPress',
'<TransferProperties>',
'<TransparentHitTestExample>',
'<View>',
Expand Down Expand Up @@ -70,26 +68,14 @@ let pages = [
// '<LegacyDirectManipulationTest>',
// '<LegacyImageTest>',
// '<LegacyAccessibilityTest>',
*/
];

class TestPage extends BasePage {
goToTestPage(page: string) {
By(page).click();
this.waitForPageLoaded();
}
backToHomePage() {
this.homeButton.click();
}
}

describe('VisitAllPagesTest', () => {
pages.forEach(function(page) {
it(page, () => {
console.log('loading page ' + page);
let testPage = new TestPage();
testPage.goToTestPage(page);
testPage.backToHomePage();
HomePage.goToTestPage(page);
HomePage.backToHomePage();
});
});
});
3 changes: 2 additions & 1 deletion packages/E2ETest/wdio/test/controlStyle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import HomePage from '../pages/HomePage';
import ControlStyleTestPage from '../pages/ControlStylePage';
import assert from 'assert';
import { CONTROL_STYLE_TESTPAGE } from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

beforeAll(() => {
HomePage.clickAndGotoControlStylePage();
HomePage.goToTestPage(CONTROL_STYLE_TESTPAGE);
});

describe('ControlStyleTest', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/E2ETest/wdio/test/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import LoginPage from '../pages/LoginPage';
import HomePage from '../pages/HomePage';
import assert from 'assert';
import { LOGIN_TESTPAGE } from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

beforeAll(() => {
HomePage.clickAndGotoLoginPage();
HomePage.goToTestPage(LOGIN_TESTPAGE);
});

describe('LoginTest', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/E2ETest/wdio/test/testInput.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
import TextInputTestPage from '../pages/TextInputTestPage';
import HomePage from '../pages/HomePage';
import assert from 'assert';
import { TEXTINPUT_TESTPAGE } from 'react-native-windows/RNTester/js/examples-win/LegacyTests/Consts';

beforeAll(() => {
HomePage.clickAndGoToTextInputPage();
HomePage.goToTestPage(TEXTINPUT_TESTPAGE);
});

function assertLogContains(text: string) {
Expand Down
1 change: 1 addition & 0 deletions vnext/src/RNTester/js/examples-win/LegacyTests/Consts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Framework
export const SEARCH_BOX = 'explorer_search';
export const BACK_BUTTON = 'BackButton';
export const REACT_CONTROL_ERROR_TEST_ID = 'ReactControlErrorMessage';
export const TREE_DUMP_RESULT = 'TreeDump';
Expand Down

0 comments on commit 4174941

Please sign in to comment.