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

[NoQA] e2e: close ANR popup in case if exception happened #52121

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions tests/e2e/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import compare from './compare/compare';
import defaultConfig from './config';
import createServerInstance from './server';
import reversePort from './utils/androidReversePort';
import closeANRPopup from './utils/closeANRPopup';
import installApp from './utils/installApp';
import killApp from './utils/killApp';
import launchApp from './utils/launchApp';
Expand Down Expand Up @@ -287,6 +288,7 @@ const runTests = async (): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
Logger.error(`Warmup failed with error: ${e}`);

closeANRPopup();
kirillzyusko marked this conversation as resolved.
Show resolved Hide resolved
MeasureUtils.stop('error-warmup');
server.clearAllTestDoneListeners();

Expand Down Expand Up @@ -314,6 +316,7 @@ const runTests = async (): Promise<void> => {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
Logger.error(`Unexpected error during test execution: ${e}. `);
MeasureUtils.stop('error');
closeANRPopup();
server.clearAllTestDoneListeners();
errorCountRef.errorCount += 1;
if (testIteration === 0 || errorCountRef.errorCount === errorCountRef.allowedExceptions) {
Expand Down
13 changes: 13 additions & 0 deletions tests/e2e/utils/closeANRPopup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import execAsync from './execAsync';
import type {PromiseWithAbort} from './execAsync';

const closeANRPopup = function (platform = 'android'): PromiseWithAbort {
if (platform !== 'android') {
throw new Error(`closeANRPopup() missing implementation for platform: ${platform}`);
}

// Press "Enter" to close the ANR popup
return execAsync(`adb shell input keyevent KEYCODE_ENTER`);
};

export default closeANRPopup;
Loading