mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Merge pull request #2490 from Bilb/fix-integration-tests
fix integration tests
This commit is contained in:
commit
b008e9d792
23 changed files with 95 additions and 52 deletions
|
@ -32,7 +32,7 @@ const StyledSessionMemberItem = styled.button<{
|
||||||
font-family: var(--font-default);
|
font-family: var(--font-default);
|
||||||
padding: 0px var(--margins-sm);
|
padding: 0px var(--margins-sm);
|
||||||
height: ${props => (props.inMentions ? '40px' : '50px')};
|
height: ${props => (props.inMentions ? '40px' : '50px')};
|
||||||
|
width: 100%;
|
||||||
transition: var(--default-duration);
|
transition: var(--default-duration);
|
||||||
opacity: ${props => (props.zombie ? 0.5 : 1)};
|
opacity: ${props => (props.zombie ? 0.5 : 1)};
|
||||||
background-color: ${props =>
|
background-color: ${props =>
|
||||||
|
|
|
@ -64,7 +64,7 @@ const LeftPaneSettingsCategoryRow = (props: {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const focusedSettingsSection = useSelector(getFocusedSettingsSection);
|
const focusedSettingsSection = useSelector(getFocusedSettingsSection);
|
||||||
|
|
||||||
const dataTestId = `${title.toLowerCase()}-settings-menu-item`;
|
const dataTestId = `${title.toLowerCase().replace(' ', '-')}-settings-menu-item`;
|
||||||
|
|
||||||
const isClearData = id === SessionSettingCategory.ClearData;
|
const isClearData = id === SessionSettingCategory.ClearData;
|
||||||
|
|
||||||
|
|
|
@ -133,6 +133,7 @@ export const BlockedContactsList = () => {
|
||||||
buttonType={SessionButtonType.BrandOutline}
|
buttonType={SessionButtonType.BrandOutline}
|
||||||
text={window.i18n('unblockUser')}
|
text={window.i18n('unblockUser')}
|
||||||
onClick={unBlockThoseUsers}
|
onClick={unBlockThoseUsers}
|
||||||
|
dataTestId="unblock-button-settings-screen"
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<SpacerLG />
|
<SpacerLG />
|
||||||
|
@ -141,6 +142,7 @@ export const BlockedContactsList = () => {
|
||||||
iconType={'chevron'}
|
iconType={'chevron'}
|
||||||
onClick={toggleUnblockList}
|
onClick={toggleUnblockList}
|
||||||
iconRotation={expanded ? 0 : 180}
|
iconRotation={expanded ? 0 : 180}
|
||||||
|
dataTestId="reveal-blocked-user-settings"
|
||||||
/>
|
/>
|
||||||
<SpacerLG />
|
<SpacerLG />
|
||||||
</BlockedContactListTitleButtons>
|
</BlockedContactListTitleButtons>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { fromHexToArray } from '../utils/String';
|
import { fromHexToArray } from '../utils/String';
|
||||||
|
|
||||||
export const getStoragePubKey = (key: string) =>
|
export const getStoragePubKey = (key: string) => key;
|
||||||
window.sessionFeatureFlags.useTestNet ? key.substring(2) : key;
|
|
||||||
|
|
||||||
export enum KeyPrefixType {
|
export enum KeyPrefixType {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
import { _electron, expect, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { openAppsAndNewUsers } from './setup/new_user';
|
import { openAppsAndNewUsers } from './setup/new_user';
|
||||||
import { sendNewMessage } from './send_message';
|
import { sendNewMessage } from './send_message';
|
||||||
import { clickOnMatchingText, clickOnTestIdWithText, waitForTestIdWithText } from './utils';
|
import {
|
||||||
|
clickOnMatchingText,
|
||||||
|
clickOnTestIdWithText,
|
||||||
|
waitForMatchingText,
|
||||||
|
waitForTestIdWithText,
|
||||||
|
} from './utils';
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
test('Block User', async () => {
|
test('Block User', async () => {
|
||||||
|
@ -19,7 +26,6 @@ test('Block User', async () => {
|
||||||
await sendNewMessage(windowA, userB.sessionid, `A -> B: ${Date.now()}`);
|
await sendNewMessage(windowA, userB.sessionid, `A -> B: ${Date.now()}`);
|
||||||
await sendNewMessage(windowB, userA.sessionid, `B -> A: ${Date.now()}`);
|
await sendNewMessage(windowB, userA.sessionid, `B -> A: ${Date.now()}`);
|
||||||
// Check to see if User B is a contact
|
// Check to see if User B is a contact
|
||||||
|
|
||||||
await clickOnTestIdWithText(windowA, 'new-conversation-button');
|
await clickOnTestIdWithText(windowA, 'new-conversation-button');
|
||||||
await waitForTestIdWithText(windowA, 'module-conversation__user__profile-name', userB.userName);
|
await waitForTestIdWithText(windowA, 'module-conversation__user__profile-name', userB.userName);
|
||||||
|
|
||||||
|
@ -34,14 +40,18 @@ test('Block User', async () => {
|
||||||
// Verify the user was moved to the blocked contact list
|
// Verify the user was moved to the blocked contact list
|
||||||
// Click on settings tab
|
// Click on settings tab
|
||||||
await clickOnTestIdWithText(windowA, 'settings-section');
|
await clickOnTestIdWithText(windowA, 'settings-section');
|
||||||
// Navigate to blocked users tab'
|
|
||||||
await clickOnMatchingText(windowA, 'Blocked contacts');
|
|
||||||
// Check for user B's name
|
|
||||||
const blockedContact = windowA.locator('.session-settings-item__title');
|
|
||||||
|
|
||||||
await expect(blockedContact).toContainText(userB.userName);
|
// click on settings section 'conversation'
|
||||||
// Unblock user
|
await clickOnTestIdWithText(windowA, 'conversations-settings-menu-item');
|
||||||
await clickOnMatchingText(windowA, 'Unblock');
|
|
||||||
|
// Navigate to blocked users tab'
|
||||||
|
await clickOnTestIdWithText(windowA, 'reveal-blocked-user-settings');
|
||||||
|
// select the contact to unblock by clicking on it by name
|
||||||
|
await clickOnMatchingText(windowA, userB.userName);
|
||||||
|
|
||||||
|
// Unblock user by clicking on unblock
|
||||||
|
await clickOnTestIdWithText(windowA, 'unblock-button-settings-screen');
|
||||||
// Verify toast notification says unblocked
|
// Verify toast notification says unblocked
|
||||||
await waitForTestIdWithText(windowA, 'session-toast', 'Unblocked');
|
await waitForTestIdWithText(windowA, 'session-toast', 'Unblocked');
|
||||||
|
await waitForMatchingText(windowA, 'No blocked contacts');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import { _electron, expect, Page, test } from '@playwright/test';
|
import { _electron, expect, Page, test } from '@playwright/test';
|
||||||
import { openAppAndWait } from './setup/open';
|
import { openAppAndWait } from './setup/open';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { newUser } from './setup/new_user';
|
import { newUser } from './setup/new_user';
|
||||||
import { clickOnTestIdWithText, waitForTestIdWithText } from './utils';
|
import { clickOnTestIdWithText, waitForTestIdWithText } from './utils';
|
||||||
|
|
||||||
let window: Page | undefined;
|
let window: Page | undefined;
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(async () => {
|
test.afterEach(async () => {
|
||||||
if (window) {
|
if (window) {
|
||||||
|
@ -29,10 +30,7 @@ test('Change profile picture/avatar', async () => {
|
||||||
await waitForTestIdWithText(window, 'copy-button-profile-update', 'Copy');
|
await waitForTestIdWithText(window, 'copy-button-profile-update', 'Copy');
|
||||||
await clickOnTestIdWithText(window, 'modal-close-button');
|
await clickOnTestIdWithText(window, 'modal-close-button');
|
||||||
|
|
||||||
const leftpaneAvatarContainer = await waitForTestIdWithText(
|
const leftpaneAvatarContainer = await waitForTestIdWithText(window, 'leftpane-primary-avatar');
|
||||||
window,
|
|
||||||
'img-leftpane-primary-avatar'
|
|
||||||
);
|
|
||||||
const screenshot = await leftpaneAvatarContainer.screenshot({
|
const screenshot = await leftpaneAvatarContainer.screenshot({
|
||||||
type: 'jpeg',
|
type: 'jpeg',
|
||||||
// path: 'avatar-updated-blue',
|
// path: 'avatar-updated-blue',
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
import { _electron, expect, Page, test } from '@playwright/test';
|
import { _electron, expect, Page, test } from '@playwright/test';
|
||||||
import { newUser } from './setup/new_user';
|
import { newUser } from './setup/new_user';
|
||||||
import { openAppAndWait } from './setup/open';
|
import { openAppAndWait } from './setup/open';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { clickOnTestIdWithText, typeIntoInput } from './utils';
|
import { clickOnTestIdWithText, typeIntoInput } from './utils';
|
||||||
let window: Page | undefined;
|
let window: Page | undefined;
|
||||||
|
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(async () => {
|
test.afterEach(async () => {
|
||||||
if (window) {
|
if (window) {
|
||||||
await forceCloseAllWindows([window]);
|
await forceCloseAllWindows([window]);
|
||||||
|
|
|
@ -2,10 +2,12 @@ import { _electron, Page, test } from '@playwright/test';
|
||||||
import { newUser } from './setup/new_user';
|
import { newUser } from './setup/new_user';
|
||||||
import { openAppAndWait } from './setup/open';
|
import { openAppAndWait } from './setup/open';
|
||||||
import { sleepFor } from '../../session/utils/Promise';
|
import { sleepFor } from '../../session/utils/Promise';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { clickOnMatchingText, clickOnTestIdWithText, waitForTestIdWithText } from './utils';
|
import { clickOnMatchingText, clickOnTestIdWithText, waitForTestIdWithText } from './utils';
|
||||||
|
|
||||||
let window: Page | undefined;
|
let window: Page | undefined;
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(async () => {
|
test.afterEach(async () => {
|
||||||
if (window) {
|
if (window) {
|
||||||
await forceCloseAllWindows([window]);
|
await forceCloseAllWindows([window]);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { openAppsAndNewUsers, openAppsNoNewUsers } from './setup/new_user';
|
import { openAppsAndNewUsers, openAppsNoNewUsers } from './setup/new_user';
|
||||||
import { sendNewMessage } from './send_message';
|
import { sendNewMessage } from './send_message';
|
||||||
import { clickOnMatchingText, clickOnTestIdWithText, typeIntoInput } from './utils';
|
import { clickOnMatchingText, clickOnTestIdWithText, typeIntoInput } from './utils';
|
||||||
|
@ -7,6 +7,8 @@ import { sleepFor } from '../../session/utils/Promise';
|
||||||
// tslint:disable: no-console
|
// tslint:disable: no-console
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
test('Delete account from swarm', async () => {
|
test('Delete account from swarm', async () => {
|
||||||
|
@ -25,7 +27,7 @@ test('Delete account from swarm', async () => {
|
||||||
// Click on settings tab
|
// Click on settings tab
|
||||||
await clickOnTestIdWithText(windowA, 'settings-section');
|
await clickOnTestIdWithText(windowA, 'settings-section');
|
||||||
// Click on clear all data
|
// Click on clear all data
|
||||||
await clickOnMatchingText(windowA, 'Clear All Data');
|
await clickOnTestIdWithText(windowA, 'clear-data-settings-menu-item', 'Clear Data');
|
||||||
// Select entire account
|
// Select entire account
|
||||||
await clickOnMatchingText(windowA, 'Entire Account');
|
await clickOnMatchingText(windowA, 'Entire Account');
|
||||||
// Confirm deletion by clicking i am sure
|
// Confirm deletion by clicking i am sure
|
||||||
|
@ -44,6 +46,8 @@ test('Delete account from swarm', async () => {
|
||||||
await typeIntoInput(restoringWindow, 'display-name-input', userA.userName);
|
await typeIntoInput(restoringWindow, 'display-name-input', userA.userName);
|
||||||
// Click continue
|
// Click continue
|
||||||
await clickOnTestIdWithText(restoringWindow, 'continue-session-button');
|
await clickOnTestIdWithText(restoringWindow, 'continue-session-button');
|
||||||
|
console.log('sleeping for 20000ms');
|
||||||
|
await sleepFor(20000); // just to allow any messages from our swarm to show up
|
||||||
// Check if message from user B is restored (we don't want it to be)
|
// Check if message from user B is restored (we don't want it to be)
|
||||||
const errorDesc = 'Test Message should not be found';
|
const errorDesc = 'Test Message should not be found';
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { messageSent } from './message';
|
import { messageSent } from './message';
|
||||||
import { openAppsAndNewUsers } from './setup/new_user';
|
import { openAppsAndNewUsers } from './setup/new_user';
|
||||||
import { sendNewMessage } from './send_message';
|
import { sendNewMessage } from './send_message';
|
||||||
|
@ -12,6 +12,8 @@ import {
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
// tslint:disable: no-console
|
// tslint:disable: no-console
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { messageSent } from './message';
|
import { messageSent } from './message';
|
||||||
import { openAppsAndNewUsers } from './setup/new_user';
|
import { openAppsAndNewUsers } from './setup/new_user';
|
||||||
import { sendNewMessage } from './send_message';
|
import { sendNewMessage } from './send_message';
|
||||||
|
@ -14,6 +14,8 @@ import {
|
||||||
const testGroupName = 'Test Group Name';
|
const testGroupName = 'Test Group Name';
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
test('Create group', async () => {
|
test('Create group', async () => {
|
||||||
|
@ -39,7 +41,7 @@ test('Create group', async () => {
|
||||||
// Select user C
|
// Select user C
|
||||||
await clickOnMatchingText(windowA, userC.userName);
|
await clickOnMatchingText(windowA, userC.userName);
|
||||||
// Click Done
|
// Click Done
|
||||||
await clickOnMatchingText(windowA, 'Done');
|
await clickOnTestIdWithText(windowA, 'next-button');
|
||||||
// Check group was successfully created
|
// Check group was successfully created
|
||||||
await clickOnMatchingText(windowB, testGroupName);
|
await clickOnMatchingText(windowB, testGroupName);
|
||||||
await waitForTestIdWithText(windowB, 'header-conversation-name', testGroupName);
|
await waitForTestIdWithText(windowB, 'header-conversation-name', testGroupName);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, expect, Page, test } from '@playwright/test';
|
import { _electron, expect, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
// import { recoverFromSeed } from './setup/recovery_using_seed';
|
// import { recoverFromSeed } from './setup/recovery_using_seed';
|
||||||
import {
|
import {
|
||||||
clickOnMatchingText,
|
clickOnMatchingText,
|
||||||
|
@ -14,6 +14,8 @@ import { leaveGroup } from './leave_group';
|
||||||
import { createGroup } from './setup/create_group';
|
import { createGroup } from './setup/create_group';
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
test('Group testing', async () => {
|
test('Group testing', async () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { openAppsNoNewUsers } from './setup/new_user';
|
import { openAppsNoNewUsers } from './setup/new_user';
|
||||||
import { sendNewMessage } from './send_message';
|
import { sendNewMessage } from './send_message';
|
||||||
import { logIn } from './setup/log_in';
|
import { logIn } from './setup/log_in';
|
||||||
|
@ -12,6 +12,8 @@ import {
|
||||||
} from './setup/test_user';
|
} from './setup/test_user';
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
test.skip('Group upkeep', async () => {
|
test.skip('Group upkeep', async () => {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { linkedDevice } from './setup/linked_device';
|
import { linkedDevice } from './setup/linked_device';
|
||||||
import { clickOnTestIdWithText, typeIntoInput, waitForTestIdWithText } from './utils';
|
import { clickOnTestIdWithText, typeIntoInput, waitForTestIdWithText } from './utils';
|
||||||
|
|
||||||
const windows: Array<Page> = [];
|
const windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
// tslint:disable: no-console
|
// tslint:disable: no-console
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { clickOnTestIdWithText, typeIntoInput, waitForTestIdWithText } from './utils';
|
import { clickOnTestIdWithText, typeIntoInput, waitForTestIdWithText } from './utils';
|
||||||
import { createGroup } from './setup/create_group';
|
import { createGroup } from './setup/create_group';
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
test('Mentions', async () => {
|
test('Mentions', async () => {
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { sendNewMessage } from './send_message';
|
import { sendNewMessage } from './send_message';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { openAppsAndNewUsers } from './setup/new_user';
|
import { openAppsAndNewUsers } from './setup/new_user';
|
||||||
import { clickOnTestIdWithText, waitForMatchingText, waitForTestIdWithText } from './utils';
|
import { clickOnTestIdWithText, waitForMatchingText, waitForTestIdWithText } from './utils';
|
||||||
|
|
||||||
const testMessage = 'A -> B';
|
const testMessage = 'A -> B';
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
// Open two windows and log into 2 separate accounts
|
// Open two windows and log into 2 separate accounts
|
||||||
test.describe('Message requests', () => {
|
test.describe('Message requests', () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
|
|
||||||
import { sendNewMessage } from './send_message';
|
import { sendNewMessage } from './send_message';
|
||||||
import { openAppsAndNewUsers } from './setup/new_user';
|
import { openAppsAndNewUsers } from './setup/new_user';
|
||||||
|
@ -9,6 +9,8 @@ const testMessage = 'A -> B';
|
||||||
const testReply = 'B -> A';
|
const testReply = 'B -> A';
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
// Send message in one to one conversation with new contact
|
// Send message in one to one conversation with new contact
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { newUser } from './setup/new_user';
|
import { newUser } from './setup/new_user';
|
||||||
import { openAppAndWait } from './setup/open';
|
import { openAppAndWait } from './setup/open';
|
||||||
import {
|
import {
|
||||||
|
@ -11,6 +11,8 @@ import {
|
||||||
} from './utils';
|
} from './utils';
|
||||||
let window: Page | undefined;
|
let window: Page | undefined;
|
||||||
|
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(async () => {
|
test.afterEach(async () => {
|
||||||
if (window) {
|
if (window) {
|
||||||
await forceCloseAllWindows([window]);
|
await forceCloseAllWindows([window]);
|
||||||
|
|
|
@ -7,16 +7,20 @@ import { MULTI_PREFIX, NODE_ENV, openElectronAppOnly } from './open';
|
||||||
const getDirectoriesOfSessionDataPath = (source: string) =>
|
const getDirectoriesOfSessionDataPath = (source: string) =>
|
||||||
readdirSync(source, { withFileTypes: true })
|
readdirSync(source, { withFileTypes: true })
|
||||||
.filter(dirent => dirent.isDirectory())
|
.filter(dirent => dirent.isDirectory())
|
||||||
.map(dirent => dirent.name)
|
.map(dirent => {
|
||||||
.filter(n => n.startsWith(`Session-${NODE_ENV}-${MULTI_PREFIX}`));
|
return dirent.name;
|
||||||
|
})
|
||||||
|
.filter(n => n.includes(`${NODE_ENV}-${MULTI_PREFIX}`));
|
||||||
|
|
||||||
let alreadyCleaned = false;
|
let alreadyCleaned = false;
|
||||||
|
let alreadyCleanedWaiting = false;
|
||||||
|
|
||||||
export const cleanUpOtherTest = async () => {
|
const cleanUpOtherTest = async () => {
|
||||||
if (alreadyCleaned) {
|
if (alreadyCleaned || alreadyCleanedWaiting) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
alreadyCleaned = true;
|
alreadyCleaned = true;
|
||||||
|
|
||||||
const electronApp = await openElectronAppOnly('start');
|
const electronApp = await openElectronAppOnly('start');
|
||||||
|
|
||||||
const appPath = await electronApp.evaluate(async ({ app }) => {
|
const appPath = await electronApp.evaluate(async ({ app }) => {
|
||||||
|
@ -24,23 +28,25 @@ export const cleanUpOtherTest = async () => {
|
||||||
});
|
});
|
||||||
const window = await electronApp.firstWindow();
|
const window = await electronApp.firstWindow();
|
||||||
await window.close();
|
await window.close();
|
||||||
if (alreadyCleaned) {
|
if (alreadyCleaned && alreadyCleanedWaiting) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
alreadyCleanedWaiting = true;
|
||||||
|
|
||||||
if (!appPath.length) {
|
if (!appPath.length) {
|
||||||
throw new Error('appDataPath unset');
|
throw new Error('appDataPath unset');
|
||||||
}
|
}
|
||||||
|
|
||||||
const parentFolderOfAllDataPath = dirname(appPath);
|
const parentFolderOfAllDataPath = dirname(appPath);
|
||||||
|
|
||||||
if (!parentFolderOfAllDataPath || parentFolderOfAllDataPath.length < 20) {
|
if (!parentFolderOfAllDataPath || parentFolderOfAllDataPath.length < 20) {
|
||||||
throw new Error('parentFolderOfAllDataPath not found or invalid');
|
throw new Error('parentFolderOfAllDataPath not found or invalid');
|
||||||
}
|
}
|
||||||
console.info('cleaning other tests leftovers...');
|
console.info('cleaning other tests leftovers...', parentFolderOfAllDataPath);
|
||||||
|
|
||||||
if (alreadyCleaned) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const allAppDataPath = getDirectoriesOfSessionDataPath(parentFolderOfAllDataPath);
|
const allAppDataPath = getDirectoriesOfSessionDataPath(parentFolderOfAllDataPath);
|
||||||
|
console.info('allAppDataPath', allAppDataPath);
|
||||||
|
|
||||||
allAppDataPath.map(folder => {
|
allAppDataPath.map(folder => {
|
||||||
if (!appPath) {
|
if (!appPath) {
|
||||||
throw new Error('parentFolderOfAllDataPath unset');
|
throw new Error('parentFolderOfAllDataPath unset');
|
||||||
|
@ -51,6 +57,8 @@ export const cleanUpOtherTest = async () => {
|
||||||
console.info('...done');
|
console.info('...done');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const beforeAllClean = cleanUpOtherTest;
|
||||||
|
|
||||||
export const forceCloseAllWindows = async (windows: Array<Page>) => {
|
export const forceCloseAllWindows = async (windows: Array<Page>) => {
|
||||||
return Promise.all(windows.map(w => w.close()));
|
return Promise.all(windows.map(w => w.close()));
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,8 +38,8 @@ export const createGroup = async (groupName: string) => {
|
||||||
await clickOnMatchingText(windowA, userB.userName);
|
await clickOnMatchingText(windowA, userB.userName);
|
||||||
// Select user C
|
// Select user C
|
||||||
await clickOnMatchingText(windowA, userC.userName);
|
await clickOnMatchingText(windowA, userC.userName);
|
||||||
// Click Done
|
// Click Next
|
||||||
await clickOnMatchingText(windowA, 'Done');
|
await clickOnTestIdWithText(windowA, 'next-button');
|
||||||
// Check group was successfully created
|
// Check group was successfully created
|
||||||
await clickOnMatchingText(windowB, groupName);
|
await clickOnMatchingText(windowB, groupName);
|
||||||
await waitForTestIdWithText(windowB, 'header-conversation-name', groupName);
|
await waitForTestIdWithText(windowB, 'header-conversation-name', groupName);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page } from '@playwright/test';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { clickOnMatchingText, typeIntoInput } from '../utils';
|
import { clickOnMatchingText, typeIntoInput } from '../utils';
|
||||||
import { cleanUpOtherTest } from './beforeEach';
|
|
||||||
import { openAppAndWait } from './open';
|
import { openAppAndWait } from './open';
|
||||||
const multisAvailable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
const multisAvailable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
|
||||||
|
@ -11,9 +10,6 @@ export type UserLoggedInType = {
|
||||||
recoveryPhrase: string;
|
recoveryPhrase: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
test.beforeAll(cleanUpOtherTest);
|
|
||||||
test.afterAll(cleanUpOtherTest);
|
|
||||||
|
|
||||||
export const newUser = async (window: Page, userName: string): Promise<UserLoggedInType> => {
|
export const newUser = async (window: Page, userName: string): Promise<UserLoggedInType> => {
|
||||||
// Create User
|
// Create User
|
||||||
await clickOnMatchingText(window, 'Create Session ID');
|
await clickOnMatchingText(window, 'Create Session ID');
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import { _electron, expect, Page, test } from '@playwright/test';
|
import { _electron, expect, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { openAppsAndNewUsers } from './setup/new_user';
|
import { openAppsAndNewUsers } from './setup/new_user';
|
||||||
import { clickOnTestIdWithText } from './utils';
|
import { clickOnTestIdWithText } from './utils';
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
test('Switch themes', async () => {
|
test('Switch themes', async () => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { forceCloseAllWindows } from './setup/beforeEach';
|
import { beforeAllClean, forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { openAppsAndNewUsers } from './setup/new_user';
|
import { openAppsAndNewUsers } from './setup/new_user';
|
||||||
import { sendNewMessage } from './send_message';
|
import { sendNewMessage } from './send_message';
|
||||||
import {
|
import {
|
||||||
|
@ -13,6 +13,8 @@ const testMessage = 'A -> B: ';
|
||||||
const testReply = 'B -> A: ';
|
const testReply = 'B -> A: ';
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
|
test.beforeEach(beforeAllClean);
|
||||||
|
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
test('Unsend message', async () => {
|
test('Unsend message', async () => {
|
||||||
|
|
Loading…
Reference in a new issue