Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2023-05-01 05:43:19 +02:00
|
|
|
import { join } from 'path';
|
2023-05-15 05:38:54 +02:00
|
|
|
import { homedir } from 'os';
|
2023-08-02 06:50:35 +02:00
|
|
|
import { Page } from '@playwright/test';
|
|
|
|
import { readdirSync, rmdirSync } from 'fs-extra';
|
2023-05-15 05:38:54 +02:00
|
|
|
import { isLinux, isMacOS } from '../../../OS';
|
Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2023-05-01 05:43:19 +02:00
|
|
|
import { MULTI_PREFIX, NODE_ENV } from './open';
|
2022-05-17 05:22:13 +02:00
|
|
|
|
|
|
|
const getDirectoriesOfSessionDataPath = (source: string) =>
|
|
|
|
readdirSync(source, { withFileTypes: true })
|
|
|
|
.filter(dirent => dirent.isDirectory())
|
2022-09-14 07:46:18 +02:00
|
|
|
.map(dirent => {
|
|
|
|
return dirent.name;
|
|
|
|
})
|
|
|
|
.filter(n => n.includes(`${NODE_ENV}-${MULTI_PREFIX}`));
|
2022-05-17 05:22:13 +02:00
|
|
|
|
Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2023-05-01 05:43:19 +02:00
|
|
|
const alreadyCleaned = false;
|
2022-09-14 07:46:18 +02:00
|
|
|
let alreadyCleanedWaiting = false;
|
2022-08-18 08:53:47 +02:00
|
|
|
|
Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2023-05-01 05:43:19 +02:00
|
|
|
function cleanUpOtherTest() {
|
2022-09-14 07:46:18 +02:00
|
|
|
if (alreadyCleaned || alreadyCleanedWaiting) {
|
2022-08-18 08:53:47 +02:00
|
|
|
return;
|
|
|
|
}
|
2022-09-14 07:46:18 +02:00
|
|
|
|
|
|
|
alreadyCleanedWaiting = true;
|
|
|
|
|
2023-05-15 05:38:54 +02:00
|
|
|
const parentFolderOfAllDataPath = isMacOS()
|
|
|
|
? '~/Library/Application Support/'
|
|
|
|
: isLinux()
|
2023-05-18 08:28:01 +02:00
|
|
|
? `${homedir()}/.config/`
|
2023-05-15 05:38:54 +02:00
|
|
|
: null;
|
Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2023-05-01 05:43:19 +02:00
|
|
|
if (!parentFolderOfAllDataPath) {
|
|
|
|
throw new Error('Only macOS is currrently supported ');
|
2022-05-17 05:22:13 +02:00
|
|
|
}
|
2022-09-14 07:46:18 +02:00
|
|
|
|
2023-05-15 05:38:54 +02:00
|
|
|
if (!parentFolderOfAllDataPath || parentFolderOfAllDataPath.length < 9) {
|
2023-05-18 08:28:01 +02:00
|
|
|
throw new Error(`parentFolderOfAllDataPath not found or invalid: ${parentFolderOfAllDataPath}`);
|
2022-05-17 05:22:13 +02:00
|
|
|
}
|
2022-09-14 07:46:18 +02:00
|
|
|
console.info('cleaning other tests leftovers...', parentFolderOfAllDataPath);
|
2022-05-17 05:22:13 +02:00
|
|
|
|
|
|
|
const allAppDataPath = getDirectoriesOfSessionDataPath(parentFolderOfAllDataPath);
|
2022-09-14 07:46:18 +02:00
|
|
|
console.info('allAppDataPath', allAppDataPath);
|
|
|
|
|
2023-07-26 11:26:46 +02:00
|
|
|
allAppDataPath.forEach(folder => {
|
2022-05-17 05:22:13 +02:00
|
|
|
const pathToRemove = join(parentFolderOfAllDataPath, folder);
|
|
|
|
rmdirSync(pathToRemove, { recursive: true });
|
|
|
|
});
|
2022-08-18 08:53:47 +02:00
|
|
|
console.info('...done');
|
Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2023-05-01 05:43:19 +02:00
|
|
|
}
|
2022-05-17 05:22:13 +02:00
|
|
|
|
2022-09-14 07:46:18 +02:00
|
|
|
export const beforeAllClean = cleanUpOtherTest;
|
|
|
|
|
2022-05-17 05:22:13 +02:00
|
|
|
export const forceCloseAllWindows = async (windows: Array<Page>) => {
|
|
|
|
return Promise.all(windows.map(w => w.close()));
|
|
|
|
};
|