Skip to content

Commit

Permalink
chore(appium): update config file for chats tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luisecm committed Apr 25, 2024
1 parent 215ae05 commit 6dd8ad7
Showing 1 changed file with 20 additions and 29 deletions.
49 changes: 20 additions & 29 deletions config/wdio.mac.multiremote.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"',
},
},
],
Expand Down Expand Up @@ -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");
Expand All @@ -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,
Expand All @@ -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);
},
},
};

Expand Down

0 comments on commit 6dd8ad7

Please sign in to comment.