Skip to content
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
4 changes: 2 additions & 2 deletions tests/e2e/testRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ try {

const runTests = async () => {
Logger.info('Installing apps and reversing port');
await installApp('android', config.MAIN_APP_PACKAGE, mainAppPath);
await installApp('android', config.DELTA_APP_PACKAGE, deltaAppPath);
await installApp(config.MAIN_APP_PACKAGE, mainAppPath);
await installApp(config.DELTA_APP_PACKAGE, deltaAppPath);
await reversePort();

// Start the HTTP server
Expand Down
26 changes: 0 additions & 26 deletions tests/e2e/utils/installApp.js

This file was deleted.

25 changes: 25 additions & 0 deletions tests/e2e/utils/installApp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type {ExecException} from 'child_process';
import execAsync from './execAsync';
import type {PromiseWithAbort} from './execAsync';
import * as Logger from './logger';

/**
* Installs the app on the currently connected device for the given platform.
* It removes the app first if it already exists, so it's a clean installation.
*/
export default function (packageName: string, path: string, platform = 'android'): PromiseWithAbort {
if (platform !== 'android') {
throw new Error(`installApp() missing implementation for platform: ${platform}`);
}

// Uninstall first, then install
return (
execAsync(`adb uninstall ${packageName}`)
.catch((error: ExecException) => {
// Ignore errors
Logger.warn('Failed to uninstall app:', error);
})
// eslint-disable-next-line @typescript-eslint/no-misused-promises
.finally(() => execAsync(`adb install ${path}`))
Comment on lines +22 to +23

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// eslint-disable-next-line @typescript-eslint/no-misused-promises
.finally(() => execAsync(`adb install ${path}`))
.finally(() => {execAsync(`adb install ${path}`)})

I think you can remove this comment by doing this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@fabioh8010 I've tried it initially, but this way the test hasn't launched the app properly for me, so I decided to keep the logic

);
}