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

fix: gracefully handle missing test cases between two apps #40689

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/libs/E2E/reactNativeLaunchingTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ E2EClient.getTestConfig()
console.error(`[E2E] Test '${config.name}' not found`);
// instead of throwing, report the error to the server, which is better for DX
return E2EClient.submitTestResults({
branch: Config.E2E_BRANCH,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It resolves a problem where we see undefined in message like

[LISTENER] Test 'Open chat finder page TTI' on 'undefined' measured 0

name: config.name,
error: `Test '${config.name}' not found`,
isCritical: false,
Expand Down
12 changes: 9 additions & 3 deletions tests/e2e/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type ServerInstance = {
addTestStartedListener: AddListener<TestStartedListener>;
addTestResultListener: AddListener<TestResultListener>;
addTestDoneListener: AddListener<TestDoneListener>;
forceTestCompletion: () => void;
start: () => Promise<void>;
stop: () => Promise<Error | undefined>;
};
Expand Down Expand Up @@ -96,6 +97,12 @@ const createServerInstance = (): ServerInstance => {
const [testResultListeners, addTestResultListener] = createListenerState<TestResultListener>();
const [testDoneListeners, addTestDoneListener] = createListenerState<TestDoneListener>();

const forceTestCompletion = () => {
testDoneListeners.forEach((listener) => {
listener();
});
};

let activeTestConfig: TestConfig | undefined;
const networkCache: Record<string, NetworkCacheMap> = {};

Expand Down Expand Up @@ -131,9 +138,7 @@ const createServerInstance = (): ServerInstance => {
}

case Routes.testDone: {
testDoneListeners.forEach((listener) => {
listener();
});
forceTestCompletion();
return res.end('ok');
}

Expand Down Expand Up @@ -200,6 +205,7 @@ const createServerInstance = (): ServerInstance => {
addTestStartedListener,
addTestResultListener,
addTestDoneListener,
forceTestCompletion,
start: () =>
new Promise<void>((resolve) => {
server.listen(PORT, resolve);
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ const runTests = async (): Promise<void> => {
throw new Error(`Test '${testResult.name}' failed with error: ${testResult.error}`);
}
if (testResult?.error != null && !isCritical) {
// force test completion, since we don't want to have timeout error for non being execute test
server.forceTestCompletion();
Logger.warn(`Test '${testResult.name}' failed with error: ${testResult.error}`);
}
let result = 0;
Expand Down
Loading