Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VisitAllPages Test to E2E Test App on Fabric #12052

Merged
merged 27 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a400261
Add VisitAllPages Test
chiaramooney Aug 21, 2023
0659c7b
Fix: Hold Tests Until Metro Loads Bundle
chiaramooney Aug 22, 2023
07ba9b2
Fix: Disable API Tests
chiaramooney Aug 22, 2023
74d5d11
Merge branch 'main' into cm-visit-test
chiaramooney Aug 22, 2023
a582e50
Migrate to Release
chiaramooney Aug 23, 2023
51bce17
Merge branch 'cm-visit-test' of https://github.com/chiaramooney/react…
chiaramooney Aug 23, 2023
580a18b
Alter Path
chiaramooney Aug 23, 2023
bf31bfc
Adjust Commands
chiaramooney Aug 23, 2023
11fde82
Test Single Case
chiaramooney Aug 23, 2023
0f72626
Merge branch 'main' into cm-visit-test
chiaramooney Aug 23, 2023
e131e6d
Fire Warning if WebDriverIO loses focus
chiaramooney Aug 23, 2023
ab64e81
Merge branch 'cm-visit-test' of https://github.com/chiaramooney/react…
chiaramooney Aug 23, 2023
4099ed1
Adjuist
chiaramooney Aug 23, 2023
750962c
Add API
chiaramooney Aug 23, 2023
ebf7bef
Fix File
chiaramooney Aug 23, 2023
bf6034f
Add Additional Workaround
chiaramooney Aug 23, 2023
11f5ec0
Add Backspace
chiaramooney Aug 24, 2023
5a641bd
Merge branch 'main' into cm-visit-test
chiaramooney Aug 24, 2023
b078e18
Remove Border Example
chiaramooney Aug 24, 2023
daaf91c
Merge branch 'cm-visit-test' of https://github.com/chiaramooney/react…
chiaramooney Aug 24, 2023
a91e543
Remove Unneeded Workaround
chiaramooney Aug 25, 2023
1e5ffa8
Merge branch 'main' into cm-visit-test
chiaramooney Aug 25, 2023
d86b162
Remove Faulty Test
chiaramooney Aug 25, 2023
a4d7956
Merge branch 'cm-visit-test' of https://github.com/chiaramooney/react…
chiaramooney Aug 25, 2023
7855c10
Disable API
chiaramooney Aug 25, 2023
1f7c3d4
Fix Lint
chiaramooney Aug 25, 2023
42e0927
Merge branch 'main' into cm-visit-test
chiaramooney Aug 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .ado/jobs/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ jobs:
parameters:
buildEnvironment: ${{ parameters.BuildEnvironment }}
certificateName: reactUWPTestAppEncodedKey
buildConfiguration: Debug
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does debug not work? I'd be curious on what the issue with debug is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Debug we would need to add a launch for Metro. This matches the behavior of the test app on Paper which runs in Release for automated tests.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? I suppose better than not running them. Its possible to run debug against a prebuilt bundle just as we do in release. But at least getting to where we are in paper is a good thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look into that!

buildConfiguration: Release
buildPlatform: ${{ matrix.BuildPlatform }}
buildLogDirectory: $(BuildLogDirectory)
deployOption: '--no-deploy'
Expand All @@ -194,6 +194,13 @@ jobs:
echo ##vso[task.setvariable variable=StartedFabricTests]true
displayName: Set StartedFabricTests

- task: CopyFiles@2
displayName: Copy Bundle
inputs:
sourceFolder: packages/e2e-test-app-fabric/windows/x64/Release/Bundle
targetFolder: packages/e2e-test-app-fabric/Bundle
contents: "**"

- script: yarn e2etest
displayName: yarn e2etest
workingDirectory: packages/e2e-test-app-fabric
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-test-app-fabric/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ module.exports = {
setupFilesAfterEnv: ['react-native-windows/jest/setup', './jest.setup.js'],

testEnvironmentOptions: {
app: `windows\\x64\\Debug\\RNTesterApp-Fabric.exe`,
app: `windows\\x64\\Release\\RNTesterApp-Fabric.exe`,
enableAutomationChannel: true,
},

Expand Down
16 changes: 8 additions & 8 deletions packages/e2e-test-app-fabric/test/RNTesterNavigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {app} from '@react-native-windows/automation';
* Visit an example on the RNTester Components tab
*/
export async function goToComponentExample(example: string) {
//const componentsTabButton = await app.findElementByTestID('components-tab');
//await componentsTabButton.click();
const componentsTabButton = await app.findElementByTestID('components-tab');
await componentsTabButton.waitForDisplayed({timeout: 20000});
await componentsTabButton.click();
await goToExample(example);
}

Expand All @@ -21,23 +22,22 @@ export async function goToComponentExample(example: string) {
*/
export async function goToApiExample(example: string) {
const componentsTabButton = await app.findElementByTestID('apis-tab');
await componentsTabButton.waitForDisplayed({timeout: 20000});
await componentsTabButton.click();
await goToExample(example);
}

async function goToExample(example: string) {
// Filter the list down to the one test, to improve the stability of selectors
const searchBox = await app.findElementByTestID('explorer_search');
await searchBox.setValue(regexEscape(example));

await searchBox.addValue(['Backspace', 'Backspace', 'Backspace']);
// Only grab first three characters of string to reduce cases in WebDriverIO mistyping.
await searchBox.addValue(regexEscape(example.substring(0, 3)));
const exampleButton = await app.findElementByTestID(example);
await exampleButton.click();

// Make sure we've launched the example by waiting until the search box is
// no longer present, but make sure we haven't crashed by checking that nav
// buttons are still visible
await app.waitUntil(async () => !(await exampleButton.isDisplayed()));
const componentsTab = await app.findElementByTestID('components-tab');
await componentsTab.waitForDisplayed({timeout: 5000});
expect(await componentsTab.isDisplayed()).toBe(true);
}

Expand Down
31 changes: 19 additions & 12 deletions packages/e2e-test-app-fabric/test/visitAllPages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
*
* @format
*/
//import {goToApiExample, goToComponentExample} from './RNTesterNavigation';
//import {verifyNoErrorLogs} from './Helpers';
import {goToComponentExample} from './RNTesterNavigation';
import {verifyNoErrorLogs} from './Helpers';

afterEach(async () => {
await verifyNoErrorLogs();
});

type RNTesterExampleModule = {
title: string;
Expand All @@ -24,7 +28,7 @@ type RNTesterList = {

const testerList: RNTesterList = require('@react-native-windows/tester/js/utils/RNTesterList');

const apiExamples = testerList.APIs.map(e => e.module.title);
//const apiExamples = testerList.APIs.map(e => e.module.title);
const componentExamples = testerList.Components.map(e => e.module.title);

describe('visitAllPages', () => {
Expand All @@ -33,20 +37,23 @@ describe('visitAllPages', () => {
});

for (const component of componentExamples) {
test(component, () => {
expect(true).toBe(true);
});
if (component === 'Flyout' || component === 'XAML') {
continue;
}

test(component, async () => await goToComponentExample(component));
}

for (const api of apiExamples) {
if (api === 'Transforms')
// disable until either transformExample uses units, or that isn't an error
// Disable Temporarily Until Stable
/*for (const api of apiExamples) {
if (api === 'Transforms' || api === 'Keyboard Focus Example')
// Disable until tests are supported.
continue;

test(api, () => {
expect(true).toBe(true);
test(api, async () => {
await goToApiExample(api);
});
}
}*/
});

export {};
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,21 @@ struct WindowData {
static HINSTANCE s_instance;
static constexpr uint16_t defaultDebuggerPort{9229};

std::wstring m_bundleFile = L"index";
bool m_windowInited{false};
winrt::Microsoft::ReactNative::CompositionHwndHost m_CompositionHwndHost{nullptr};
winrt::Microsoft::ReactNative::ReactNativeHost m_host{nullptr};
winrt::Microsoft::ReactNative::ReactInstanceSettings m_instanceSettings{nullptr};

#if BUNDLE
std::wstring m_bundleFile = L"index.windows";
bool m_useWebDebugger{false};
bool m_fastRefreshEnabled{false};
#else
std::wstring m_bundleFile = L"index";
bool m_useWebDebugger{false};
bool m_fastRefreshEnabled{true};
#endif

bool m_useDirectDebugger{false};
bool m_breakOnNextLine{false};
uint16_t m_debuggerPort{defaultDebuggerPort};
Expand Down