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

chore(refactor): independent chats tests #564

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 9 additions & 5 deletions config/wdio.mac.multiremote.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const join = require("path").join;
const MACOS_USER_A_BUNDLE_ID = require("@helpers/constants").MACOS_USER_A_BUNDLE_ID;
const MACOS_USER_B_BUNDLE_ID = require("@helpers/constants").MACOS_USER_B_BUNDLE_ID;
const MACOS_DRIVER = require("@helpers/constants").MACOS_DRIVER;
const USER_A_INSTANCE = require("@helpers/constants").USER_A_INSTANCE;
const fsp = require("fs").promises;
const { readFileSync, rmSync } = require("fs");

Expand All @@ -30,11 +29,12 @@ export const config: WebdriverIO.Config = {
// then the current working directory is where your `package.json` resides, so `wdio`
// will be called from there.
//
specs: [join(process.cwd(), "./tests/suites/Chats/01-Chats.suite.ts")],
specs: [join(process.cwd(), "./tests/specs/reusable-accounts/01-*.spec.ts")],
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
],
maxInstances: 1,
//
// ============
// Capabilities
Expand Down Expand Up @@ -96,6 +96,8 @@ export const config: WebdriverIO.Config = {
// methods to it. If one of them returns with a promise, WebdriverIO will wait until that promise got
// resolved to continue.
onPrepare: async function() {
const cacheFolderSourceA = join(process.cwd(), "./tests/fixtures/users/mac2/ChatUserA");
const cacheFolderSourceB = join(process.cwd(), "./tests/fixtures/users/mac2/ChatUserB");
const cacheFolderUserA = homedir() + "/.uplink/.user";
const cacheFolderUserB = homedir() + "/.uplinkUserB/.user";
const allureResultsFolder = join(process.cwd(), "./allure-results");
Expand All @@ -114,7 +116,9 @@ export const config: WebdriverIO.Config = {
try {
await rmSync(cacheFolderUserA, { recursive: true, force: true });
await rmSync(cacheFolderUserB, { recursive: true, force: true });
console.log("Deleted Cache Folder Successfully!");
await fsp.cp(cacheFolderSourceA, cacheFolderUserA, { recursive: true }, { force: true });
await fsp.cp(cacheFolderSourceB, cacheFolderUserB, { recursive: true }, { force: true });
console.log("Deleted and Copied Cache Folder Successfully!");
} catch (error) {
console.error(
`Got an error trying to delete Cache Folder: ${error.message}`
Expand All @@ -141,7 +145,7 @@ export const config: WebdriverIO.Config = {
allureReporter.addAttachment(imageTitle, data, 'image/png')

// Close second application if open
await driver[USER_A_INSTANCE].executeScript("macos: terminateApp", [
await driver.executeScript("macos: terminateApp", [
{
bundleId: MACOS_USER_B_BUNDLE_ID,
},
Expand All @@ -152,7 +156,7 @@ export const config: WebdriverIO.Config = {

afterSuite: async function (suite) {
// Close second application if open
await driver[USER_A_INSTANCE].executeScript("macos: terminateApp", [
await driver.executeScript("macos: terminateApp", [
{
bundleId: MACOS_USER_B_BUNDLE_ID,
},
Expand Down
5 changes: 2 additions & 3 deletions config/wdio.windows.multiremote.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ require("module-alias/register");
const allureReporter = require('@wdio/allure-reporter').default;
const sharedConfig = require('@config/wdio.shared.conf.ts').config;
const join = require("path").join;
const USER_A_INSTANCE = require("@helpers/constants").USER_A_INSTANCE;
const fsp = require("fs").promises;
const userACacheFolder = join(process.cwd(), "./apps/ChatUserA/.user")
const userBCacheFolder = join(process.cwd(), "./apps/ChatUserB/.user")
Expand Down Expand Up @@ -146,7 +145,7 @@ export const config: WebdriverIO.Config = {

beforeTest: async function (test) {
// Start video recording for each test and instance
await driver[USER_A_INSTANCE].executeScript("windows: startRecordingScreen", [
await driver.executeScript("windows: startRecordingScreen", [
{
deviceId: 1
},
Expand All @@ -160,7 +159,7 @@ export const config: WebdriverIO.Config = {
imageFile = await driver.takeScreenshot();

// Stop video recording for both instances and save video into base64 format
base64VideoUserA = await driver[USER_A_INSTANCE].executeScript("windows: stopRecordingScreen", [
base64VideoUserA = await driver.executeScript("windows: stopRecordingScreen", [
{
remotePath: ""
},
Expand Down
Loading
Loading