diff --git a/e2e/fixtures/fixture-helper.js b/e2e/fixtures/fixture-helper.js index c9e0ea54403..a6f46117e13 100644 --- a/e2e/fixtures/fixture-helper.js +++ b/e2e/fixtures/fixture-helper.js @@ -57,6 +57,10 @@ export const startFixtureServer = async () => { // Stop the fixture server export const stopFixtureServer = async () => { + if (!(await isFixtureServerStarted())) { + console.log('The fixture server has already been stopped'); + return; + } await fixtureServer.stop(); console.log('The fixture server is stopped'); }; @@ -74,7 +78,6 @@ export const stopFixtureServer = async () => { */ export async function withFixtures(options, testSuite) { const { fixture, restartDevice = false } = options; - let failed; try { // Start the fixture server await startFixtureServer(); @@ -90,12 +93,9 @@ export async function withFixtures(options, testSuite) { await testSuite(); } catch (error) { - failed = true; console.error(error); throw error; } finally { - if (!failed) { - await stopFixtureServer(); - } + await stopFixtureServer(); } } diff --git a/wdio.conf.js b/wdio.conf.js index 444e0498313..3c665cf1ee5 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -292,16 +292,10 @@ export const config = { driver.getPlatform = function getPlatform() { return capabilities.platformName; }; - // Avoid port forwarding in Bitrise - const isRunningBitrise = process.env.BITRISE_APP_TITLE; - if (!isRunningBitrise) { - const adb = await ADB.createADB(); - await adb.reversePort(8545, 8545); - await adb.reversePort(12345, 12345) - } - // Start the fixture server - await startFixtureServer(); - await loadFixture(); + + const adb = await ADB.createADB(); + await adb.reversePort(8545, 8545); + await adb.reversePort(12345, 12345) }, /** * Runs before a WebdriverIO command gets executed. @@ -349,6 +343,8 @@ export const config = { } if (tags.filter((e) => e.name === FIXTURES_SKIP_ONBOARDING).length > 0) { + // Start the fixture server + await startFixtureServer(); const state = new FixtureBuilder().build(); await loadFixture({fixture: state}); } diff --git a/wdio/step-definitions/common-steps.js b/wdio/step-definitions/common-steps.js index 23c8c64892a..d986b05947b 100644 --- a/wdio/step-definitions/common-steps.js +++ b/wdio/step-definitions/common-steps.js @@ -15,8 +15,6 @@ import LoginScreen from '../screen-objects/LoginScreen'; import TermOfUseScreen from '../screen-objects/Modals/TermOfUseScreen'; import WhatsNewModal from '../screen-objects/Modals/WhatsNewModal'; -const fixtureServer = new FixtureServer(); - Then(/^the Welcome screen is displayed$/, async () => { await WelcomeScreen.isScreenDisplayed(); });