From 6dd8ad775b56271c1bc6723953ce8ba0499e42c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:55:04 -0600 Subject: [PATCH] chore(appium): update config file for chats tests --- config/wdio.mac.multiremote.conf.ts | 49 ++++++++++++----------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/config/wdio.mac.multiremote.conf.ts b/config/wdio.mac.multiremote.conf.ts index 60a26812b7..abb44db62d 100644 --- a/config/wdio.mac.multiremote.conf.ts +++ b/config/wdio.mac.multiremote.conf.ts @@ -59,11 +59,7 @@ export const config: WebdriverIO.Config = { "appium:systemPort": 4725, "appium:prerun": { command: - 'do shell script "rm -rf ~/.uplink/.user/ && rm -rf ~/.uplinkUserB/.user/ && rm -rf ~/.uplinkUserC/.user/"', - }, - "appium:postrun": { - command: - 'do shell script "rm -rf ~/.uplink/.user/ && rm -rf ~/.uplinkUserB/.user/ && rm -rf ~/.uplinkUserC/.user/"', + 'do shell script "rm -rf ~/.uplink && rm -rf ~/.uplinkUserB && rm -rf ~/.uplinkUserC"', }, }, ], @@ -111,7 +107,10 @@ export const config: WebdriverIO.Config = { /** * Function to be executed after a test (in Mocha/Jasmine). */ - onPrepare: async function () { + onPrepare: async function (config, capabilities) { + const cacheFolderUserA = homedir() + "/.uplink/.user"; + const cacheFolderUserB = homedir() + "/.uplinkUserB/.user"; + const cacheFolderUserC = homedir() + "/.uplinkUserC/.user"; const allureResultsFolder = join(process.cwd(), "./allure-results"); const testReportFolder = join(process.cwd(), "./test-report"); const testResultsFolder = join(process.cwd(), "./test-results"); @@ -124,32 +123,17 @@ export const config: WebdriverIO.Config = { `Got an error trying to delete artifacts folders: ${error.message}`, ); } - }, - - beforeSession: async function () { - const cacheFolders = [ - "/.uplink/.user", - "/.uplinkUserB/.user", - "/.uplinkUserC/.user", - ]; - for (const folder of cacheFolders) { - try { - await rmSync(homedir() + folder, { recursive: true, force: true }); - } catch (error) { - console.error( - `Got an error trying to delete cache folder ${folder}: ${error.message}`, - ); - } + try { + await rmSync(cacheFolderUserA, { recursive: true, force: true }); + await rmSync(cacheFolderUserB, { recursive: true, force: true }); + await rmSync(cacheFolderUserC, { recursive: true, force: true }); + } catch (error) { + console.error( + `Got an error trying to delete Cache Folder: ${error.message}`, + ); } }, - afterSession: async function () { - // Close applications if open - await terminateApplication(MACOS_USER_A_BUNDLE_ID); - await terminateApplication(MACOS_USER_B_BUNDLE_ID); - await terminateApplication(MACOS_USER_C_BUNDLE_ID); - }, - afterTest: async function ( test, context, @@ -175,6 +159,13 @@ export const config: WebdriverIO.Config = { allureReporter.addAttachment(imageTitle, data, "image/png"); } }, + + afterSuite: async function (suite) { + // Close applications if open + await terminateApplication(MACOS_USER_A_BUNDLE_ID); + await terminateApplication(MACOS_USER_B_BUNDLE_ID); + await terminateApplication(MACOS_USER_C_BUNDLE_ID); + }, }, };