fix: integration tests with the new design
This commit is contained in:
parent
7bbbc74fa8
commit
cac63a7edb
|
@ -1,5 +1,6 @@
|
||||||
// tslint:disable-next-line: no-implicit-dependencies
|
// tslint:disable-next-line: no-implicit-dependencies
|
||||||
import { PlaywrightTestConfig } from '@playwright/test';
|
import { PlaywrightTestConfig } from '@playwright/test';
|
||||||
|
import { toNumber } from 'lodash';
|
||||||
|
|
||||||
const config: PlaywrightTestConfig = {
|
const config: PlaywrightTestConfig = {
|
||||||
timeout: 350000,
|
timeout: 350000,
|
||||||
|
@ -10,7 +11,7 @@ const config: PlaywrightTestConfig = {
|
||||||
outputDir: './ts/test/automation/test-results',
|
outputDir: './ts/test/automation/test-results',
|
||||||
retries: 1,
|
retries: 1,
|
||||||
repeatEach: 1,
|
repeatEach: 1,
|
||||||
workers: 1,
|
workers: toNumber(process.env.PLAYWRIGHT_WORKER_COUNT) || 1,
|
||||||
reportSlowTests: null,
|
reportSlowTests: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
import { _electron, expect, Page, test } from '@playwright/test';
|
import { _electron, expect, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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, waitForTestIdWithText } from './utils';
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
|
@ -21,7 +19,8 @@ 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, 'contact-section');
|
|
||||||
|
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);
|
||||||
|
|
||||||
//Click on three dots menu
|
//Click on three dots menu
|
||||||
|
|
|
@ -1,12 +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 { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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(cleanUpOtherTest);
|
|
||||||
test.afterEach(async () => {
|
test.afterEach(async () => {
|
||||||
if (window) {
|
if (window) {
|
||||||
await forceCloseAllWindows([window]);
|
await forceCloseAllWindows([window]);
|
||||||
|
@ -14,7 +13,7 @@ test.afterEach(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Change profile picture/avatar', async () => {
|
test('Change profile picture/avatar', async () => {
|
||||||
window = await openAppAndWait('1');
|
window = await openAppAndWait(`1`);
|
||||||
|
|
||||||
await newUser(window, 'userA');
|
await newUser(window, 'userA');
|
||||||
// Open profile
|
// Open profile
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
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 { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { clickOnTestIdWithText, typeIntoInput } from './utils';
|
import { clickOnTestIdWithText, typeIntoInput } from './utils';
|
||||||
let window: Page | undefined;
|
let window: Page | undefined;
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
test.afterEach(async () => {
|
test.afterEach(async () => {
|
||||||
if (window) {
|
if (window) {
|
||||||
await forceCloseAllWindows([window]);
|
await forceCloseAllWindows([window]);
|
||||||
|
@ -14,7 +13,7 @@ test.afterEach(async () => {
|
||||||
|
|
||||||
test('Change username', async () => {
|
test('Change username', async () => {
|
||||||
// Open App
|
// Open App
|
||||||
window = await openAppAndWait('1');
|
window = await openAppAndWait(`1`);
|
||||||
// Create user
|
// Create user
|
||||||
await newUser(window, 'userA');
|
await newUser(window, 'userA');
|
||||||
// Open Profile
|
// Open Profile
|
||||||
|
|
|
@ -2,11 +2,10 @@ 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 { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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(cleanUpOtherTest);
|
|
||||||
test.afterEach(async () => {
|
test.afterEach(async () => {
|
||||||
if (window) {
|
if (window) {
|
||||||
await forceCloseAllWindows([window]);
|
await forceCloseAllWindows([window]);
|
||||||
|
@ -14,7 +13,7 @@ test.afterEach(async () => {
|
||||||
});
|
});
|
||||||
test('Create User', async () => {
|
test('Create User', async () => {
|
||||||
// Launch Electron app.
|
// Launch Electron app.
|
||||||
window = await openAppAndWait('1');
|
window = await openAppAndWait(`1`);
|
||||||
// // Create User
|
// // Create User
|
||||||
const userA = await newUser(window, 'userA');
|
const userA = await newUser(window, 'userA');
|
||||||
// Open profile tab
|
// Open profile tab
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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 {
|
import {
|
||||||
|
@ -12,8 +12,6 @@ import {
|
||||||
} from './utils';
|
} from './utils';
|
||||||
import { sleepFor } from '../../session/utils/Promise';
|
import { sleepFor } from '../../session/utils/Promise';
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
|
@ -65,8 +63,8 @@ test('Delete account from swarm', async () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await clickOnTestIdWithText(restoringWindow, 'contact-section');
|
|
||||||
// Expect contacts list to be empty
|
await clickOnTestIdWithText(restoringWindow, 'new-conversation-button'); // Expect contacts list to be empty
|
||||||
|
|
||||||
const errorDesc2 = 'Should not be found';
|
const errorDesc2 = '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 { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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';
|
||||||
|
@ -11,7 +11,6 @@ import {
|
||||||
waitForTestIdWithText,
|
waitForTestIdWithText,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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';
|
||||||
|
@ -13,8 +13,6 @@ import {
|
||||||
|
|
||||||
const testGroupName = 'Test Group Name';
|
const testGroupName = 'Test Group Name';
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
|
@ -32,8 +30,9 @@ test('Create group', async () => {
|
||||||
sendNewMessage(windowC, userA.sessionid, `C -> A: ${Date.now()}`),
|
sendNewMessage(windowC, userA.sessionid, `C -> A: ${Date.now()}`),
|
||||||
]);
|
]);
|
||||||
// Click new closed group tab
|
// Click new closed group tab
|
||||||
await clickOnMatchingText(windowA, 'New Closed Group');
|
|
||||||
// Enter group name
|
await clickOnTestIdWithText(windowA, 'new-conversation-button');
|
||||||
|
await clickOnTestIdWithText(windowA, 'chooser-new-group'); // Enter group name
|
||||||
await typeIntoInput(windowA, 'new-closed-group-name', testGroupName);
|
await typeIntoInput(windowA, 'new-closed-group-name', testGroupName);
|
||||||
// Select user B
|
// Select user B
|
||||||
await clickOnMatchingText(windowA, userB.userName);
|
await clickOnMatchingText(windowA, userB.userName);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, expect, Page, test } from '@playwright/test';
|
import { _electron, expect, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { forceCloseAllWindows } from './setup/beforeEach';
|
||||||
// import { recoverFromSeed } from './setup/recovery_using_seed';
|
// import { recoverFromSeed } from './setup/recovery_using_seed';
|
||||||
import {
|
import {
|
||||||
clickOnMatchingText,
|
clickOnMatchingText,
|
||||||
|
@ -13,8 +13,6 @@ import { renameGroup } from './rename_group';
|
||||||
import { leaveGroup } from './leave_group';
|
import { leaveGroup } from './leave_group';
|
||||||
import { createGroup } from './setup/create_group';
|
import { createGroup } from './setup/create_group';
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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';
|
||||||
|
@ -11,8 +11,6 @@ import {
|
||||||
testUser,
|
testUser,
|
||||||
} from './setup/test_user';
|
} from './setup/test_user';
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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';
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
|
|
||||||
const windows: Array<Page> = [];
|
const windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
|
@ -12,13 +10,13 @@ test('linking device', async () => {
|
||||||
const { windowA1, windowA2, userA } = await linkedDevice();
|
const { windowA1, windowA2, userA } = await linkedDevice();
|
||||||
windows.push(windowA1, windowA2);
|
windows.push(windowA1, windowA2);
|
||||||
|
|
||||||
await clickOnTestIdWithText(windowA2, 'leftpane-primary-avatar');
|
await clickOnTestIdWithText(windowA1, 'leftpane-primary-avatar');
|
||||||
// Verify Username
|
// Verify Username
|
||||||
await waitForTestIdWithText(windowA2, 'your-profile-name', userA.userName);
|
await waitForTestIdWithText(windowA1, 'your-profile-name', userA.userName);
|
||||||
// Verify Session ID
|
// Verify Session ID
|
||||||
await waitForTestIdWithText(windowA2, 'your-session-id', userA.sessionid);
|
await waitForTestIdWithText(windowA1, 'your-session-id', userA.sessionid);
|
||||||
// exit profile module
|
// exit profile module
|
||||||
await clickOnTestIdWithText(windowA2, 'modal-close-button');
|
await clickOnTestIdWithText(windowA1, 'modal-close-button');
|
||||||
// You're almost finished isn't displayed
|
// You're almost finished isn't displayed
|
||||||
const errorDesc = 'Should not be found';
|
const errorDesc = 'Should not be found';
|
||||||
try {
|
try {
|
||||||
|
@ -46,6 +44,6 @@ test('linking device', async () => {
|
||||||
// Click on profile settings in window B
|
// Click on profile settings in window B
|
||||||
await clickOnTestIdWithText(windowA2, 'leftpane-primary-avatar');
|
await clickOnTestIdWithText(windowA2, 'leftpane-primary-avatar');
|
||||||
// Verify username has changed to new username
|
// Verify username has changed to new username
|
||||||
await waitForTestIdWithText(windowA2, 'your-profile-name', userA.userName);
|
await waitForTestIdWithText(windowA2, 'your-profile-name', newUsername);
|
||||||
// Check message is deleting on both devices
|
// Check message is deleting on both devices
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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';
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
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 { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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';
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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';
|
||||||
|
@ -7,7 +7,6 @@ import { clickOnTestIdWithText, waitForTestIdWithText } from './utils';
|
||||||
|
|
||||||
const testMessage = 'A -> B';
|
const testMessage = 'A -> B';
|
||||||
const testReply = 'B -> A';
|
const testReply = 'B -> A';
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
@ -25,10 +24,10 @@ test('Send message to new contact', async () => {
|
||||||
await sendNewMessage(windowB, userA.sessionid, `${testReply}${Date.now()}`);
|
await sendNewMessage(windowB, userA.sessionid, `${testReply}${Date.now()}`);
|
||||||
// Navigate to contacts tab in User B's window
|
// Navigate to contacts tab in User B's window
|
||||||
|
|
||||||
await clickOnTestIdWithText(windowA, 'contact-section');
|
await clickOnTestIdWithText(windowA, 'new-conversation-button');
|
||||||
await windowA.waitForTimeout(2000);
|
await windowA.waitForTimeout(2000);
|
||||||
await waitForTestIdWithText(windowB, 'module-conversation__user__profile-name', userA.userName);
|
await waitForTestIdWithText(windowB, 'module-conversation__user__profile-name', userA.userName);
|
||||||
|
|
||||||
// Navigate to contacts tab in User A's window
|
// Navigate to contacts tab in User A's window
|
||||||
await clickOnTestIdWithText(windowA, 'contact-section');
|
await clickOnTestIdWithText(windowA, 'new-conversation-button');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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,7 +11,6 @@ import {
|
||||||
} from './utils';
|
} from './utils';
|
||||||
let window: Page | undefined;
|
let window: Page | undefined;
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
test.afterEach(async () => {
|
test.afterEach(async () => {
|
||||||
if (window) {
|
if (window) {
|
||||||
await forceCloseAllWindows([window]);
|
await forceCloseAllWindows([window]);
|
||||||
|
@ -24,7 +23,7 @@ const newTestPassword = '789101112';
|
||||||
test.describe('Password checks', () => {
|
test.describe('Password checks', () => {
|
||||||
test('Set Password', async () => {
|
test('Set Password', async () => {
|
||||||
// open Electron
|
// open Electron
|
||||||
window = await openAppAndWait('1');
|
window = await openAppAndWait(`1`);
|
||||||
// Create user
|
// Create user
|
||||||
await newUser(window, 'userA');
|
await newUser(window, 'userA');
|
||||||
// Click on settings tab
|
// Click on settings tab
|
||||||
|
@ -80,7 +79,7 @@ test.describe('Password checks', () => {
|
||||||
});
|
});
|
||||||
test('Wrong password', async () => {
|
test('Wrong password', async () => {
|
||||||
// Check if incorrect password works
|
// Check if incorrect password works
|
||||||
window = await openAppAndWait('1');
|
window = await openAppAndWait(`1`);
|
||||||
// Create user
|
// Create user
|
||||||
await newUser(window, 'userA');
|
await newUser(window, 'userA');
|
||||||
// Click on settings tab
|
// Click on settings tab
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { clickOnTestIdWithText, typeIntoInput } from './utils';
|
||||||
|
|
||||||
export const sendNewMessage = async (window: Page, sessionid: string, message: string) => {
|
export const sendNewMessage = async (window: Page, sessionid: string, message: string) => {
|
||||||
await clickOnTestIdWithText(window, 'new-conversation-button');
|
await clickOnTestIdWithText(window, 'new-conversation-button');
|
||||||
|
await clickOnTestIdWithText(window, 'chooser-new-conversation-button');
|
||||||
// Enter session ID of USER B
|
// Enter session ID of USER B
|
||||||
await typeIntoInput(window, 'new-session-conversation', sessionid);
|
await typeIntoInput(window, 'new-session-conversation', sessionid);
|
||||||
// click next
|
// click next
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { _electron, Page } from '@playwright/test';
|
||||||
import { readdirSync, rmdirSync } from 'fs-extra';
|
import { readdirSync, rmdirSync } from 'fs-extra';
|
||||||
import { dirname, join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
import { MULTI_PREFIX, NODE_ENV, openElectronAppOnly } from './open';
|
import { MULTI_PREFIX, NODE_ENV, openElectronAppOnly } from './open';
|
||||||
|
// tslint:disable: no-console
|
||||||
|
|
||||||
const getDirectoriesOfSessionDataPath = (source: string) =>
|
const getDirectoriesOfSessionDataPath = (source: string) =>
|
||||||
readdirSync(source, { withFileTypes: true })
|
readdirSync(source, { withFileTypes: true })
|
||||||
|
@ -9,13 +10,23 @@ const getDirectoriesOfSessionDataPath = (source: string) =>
|
||||||
.map(dirent => dirent.name)
|
.map(dirent => dirent.name)
|
||||||
.filter(n => n.startsWith(`Session-${NODE_ENV}-${MULTI_PREFIX}`));
|
.filter(n => n.startsWith(`Session-${NODE_ENV}-${MULTI_PREFIX}`));
|
||||||
|
|
||||||
|
let alreadyCleaned = false;
|
||||||
|
|
||||||
export const cleanUpOtherTest = async () => {
|
export const cleanUpOtherTest = async () => {
|
||||||
|
if (alreadyCleaned) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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 }) => {
|
||||||
return app.getPath('userData');
|
return app.getPath('userData');
|
||||||
});
|
});
|
||||||
const window = await electronApp.firstWindow();
|
const window = await electronApp.firstWindow();
|
||||||
await window.close();
|
await window.close();
|
||||||
|
if (alreadyCleaned) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!appPath.length) {
|
if (!appPath.length) {
|
||||||
throw new Error('appDataPath unset');
|
throw new Error('appDataPath unset');
|
||||||
}
|
}
|
||||||
|
@ -24,7 +35,11 @@ export const cleanUpOtherTest = async () => {
|
||||||
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...');
|
||||||
|
|
||||||
|
if (alreadyCleaned) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const allAppDataPath = getDirectoriesOfSessionDataPath(parentFolderOfAllDataPath);
|
const allAppDataPath = getDirectoriesOfSessionDataPath(parentFolderOfAllDataPath);
|
||||||
allAppDataPath.map(folder => {
|
allAppDataPath.map(folder => {
|
||||||
if (!appPath) {
|
if (!appPath) {
|
||||||
|
@ -33,6 +48,7 @@ export const cleanUpOtherTest = async () => {
|
||||||
const pathToRemove = join(parentFolderOfAllDataPath, folder);
|
const pathToRemove = join(parentFolderOfAllDataPath, folder);
|
||||||
rmdirSync(pathToRemove, { recursive: true });
|
rmdirSync(pathToRemove, { recursive: true });
|
||||||
});
|
});
|
||||||
|
console.info('...done');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const forceCloseAllWindows = async (windows: Array<Page>) => {
|
export const forceCloseAllWindows = async (windows: Array<Page>) => {
|
||||||
|
|
|
@ -30,7 +30,8 @@ export const createGroup = async (groupName: string) => {
|
||||||
// wait for user C to be contact before moving to create group
|
// wait for user C to be contact before moving to create group
|
||||||
// Create group with existing contact and session ID (of non-contact)
|
// Create group with existing contact and session ID (of non-contact)
|
||||||
// Click new closed group tab
|
// Click new closed group tab
|
||||||
await clickOnMatchingText(windowA, 'New Closed Group');
|
await clickOnTestIdWithText(windowA, 'new-conversation-button');
|
||||||
|
await clickOnTestIdWithText(windowA, 'chooser-new-group');
|
||||||
// Enter group name
|
// Enter group name
|
||||||
await typeIntoInput(windowA, 'new-closed-group-name', groupName);
|
await typeIntoInput(windowA, 'new-closed-group-name', groupName);
|
||||||
// Select user B
|
// Select user B
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { _electron } from 'playwright-core';
|
import { _electron } from 'playwright-core';
|
||||||
import { openAppsAndNewUsers, openAppsNoNewUsers } from './new_user';
|
import { openAppsAndNewUsers, openAppsNoNewUsers } from './new_user';
|
||||||
|
import { logIn } from '../setup/log_in';
|
||||||
|
|
||||||
export async function linkedDevice() {
|
export async function linkedDevice() {
|
||||||
const windowLoggedIn = await openAppsAndNewUsers(1);
|
const windowLoggedIn = await openAppsAndNewUsers(1);
|
||||||
|
@ -8,5 +9,7 @@ export async function linkedDevice() {
|
||||||
const [userA] = users;
|
const [userA] = users;
|
||||||
const [windowA2] = await openAppsNoNewUsers(1);
|
const [windowA2] = await openAppsNoNewUsers(1);
|
||||||
|
|
||||||
|
await logIn(windowA2, userA.recoveryPhrase);
|
||||||
|
|
||||||
return { windowA1, windowA2, userA };
|
return { windowA1, windowA2, userA };
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { _electron, Page } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { clickOnMatchingText, clickOnTestIdWithText, 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';
|
||||||
|
|
||||||
|
@ -10,6 +11,9 @@ 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');
|
||||||
|
@ -64,27 +68,7 @@ export async function openAppsNoNewUsers(windowToCreate: number) {
|
||||||
const multisToUse = multisAvailable.slice(0, windowToCreate);
|
const multisToUse = multisAvailable.slice(0, windowToCreate);
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
[...multisToUse].map(async m => {
|
[...multisToUse].map(async m => {
|
||||||
return openAppAndWait(m);
|
return openAppAndWait(`${m}`);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function existingUser() {
|
|
||||||
const recoveryPhraseTest =
|
|
||||||
'pinched total ongoing sushi etched rest gone long oilfield incur code grunt code';
|
|
||||||
const newUsername = 'new-username';
|
|
||||||
// const sessionIDTest = '05560802be231abc2fbaa860f09da4c2f20dafa4e5f560f77d61c5f587ef2c741f';
|
|
||||||
// const contactOne = 'Fish';
|
|
||||||
// const contactTwo = 'Dragon';
|
|
||||||
// const contactThree = 'Whale';
|
|
||||||
// const contactFour = 'Gopher';
|
|
||||||
const [windowA1] = await openAppsNoNewUsers(1);
|
|
||||||
|
|
||||||
await clickOnTestIdWithText(windowA1, 'restore-using-recovery');
|
|
||||||
await typeIntoInput(windowA1, 'recovery-phrase-input', recoveryPhraseTest);
|
|
||||||
await typeIntoInput(windowA1, 'display-name-input', newUsername);
|
|
||||||
await clickOnTestIdWithText(windowA1, 'continue-session-button');
|
|
||||||
// await clickOnTestIdWithText(windowA1, 'leftpane-primary-avatar');
|
|
||||||
// const sessionIDTest = await waitForTestIdWithText(windowA1, 'your-session-id');
|
|
||||||
return existingUser;
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,11 +6,11 @@ export const NODE_ENV = 'production';
|
||||||
export const MULTI_PREFIX = 'test-integration-testnet-';
|
export const MULTI_PREFIX = 'test-integration-testnet-';
|
||||||
|
|
||||||
export const openElectronAppOnly = async (multi: string) => {
|
export const openElectronAppOnly = async (multi: string) => {
|
||||||
process.env.NODE_APP_INSTANCE = `${MULTI_PREFIX}-${multi}`;
|
process.env.NODE_APP_INSTANCE = `${MULTI_PREFIX}-${Date.now()}-${multi}`;
|
||||||
process.env.NODE_ENV = NODE_ENV;
|
process.env.NODE_ENV = NODE_ENV;
|
||||||
|
|
||||||
// console.warn(' NODE_ENV', process.env.NODE_ENV);
|
console.warn(' NODE_ENV', process.env.NODE_ENV);
|
||||||
// console.warn(' NODE_APP_INSTANCE', process.env.NODE_APP_INSTANCE);
|
console.warn(' NODE_APP_INSTANCE', process.env.NODE_APP_INSTANCE);
|
||||||
const electronApp = await _electron.launch({
|
const electronApp = await _electron.launch({
|
||||||
args: [join(getAppRootPath(), 'ts', 'mains', 'main_node.js')],
|
args: [join(getAppRootPath(), 'ts', 'mains', 'main_node.js')],
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import { _electron, expect, Page, test } from '@playwright/test';
|
import { _electron, expect, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { forceCloseAllWindows } from './setup/beforeEach';
|
||||||
import { openAppsAndNewUsers } from './setup/new_user';
|
import { openAppsAndNewUsers } from './setup/new_user';
|
||||||
import { clickOnTestIdWithText } from './utils';
|
import { clickOnTestIdWithText } from './utils';
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { _electron, Page, test } from '@playwright/test';
|
import { _electron, Page, test } from '@playwright/test';
|
||||||
import { cleanUpOtherTest, forceCloseAllWindows } from './setup/beforeEach';
|
import { 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 {
|
||||||
|
@ -12,7 +12,6 @@ import {
|
||||||
const testMessage = 'A -> B: ';
|
const testMessage = 'A -> B: ';
|
||||||
const testReply = 'B -> A: ';
|
const testReply = 'B -> A: ';
|
||||||
|
|
||||||
test.beforeEach(cleanUpOtherTest);
|
|
||||||
let windows: Array<Page> = [];
|
let windows: Array<Page> = [];
|
||||||
test.afterEach(() => forceCloseAllWindows(windows));
|
test.afterEach(() => forceCloseAllWindows(windows));
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ export async function clickOnTestIdWithText(window: Page, dataTestId: string, te
|
||||||
}
|
}
|
||||||
|
|
||||||
const builtSelector = `css=[data-testid=${dataTestId}]`;
|
const builtSelector = `css=[data-testid=${dataTestId}]`;
|
||||||
|
await window.waitForSelector(builtSelector);
|
||||||
return window.click(builtSelector);
|
return window.click(builtSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue