Skip to content

Push main to foundation #6

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

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0fe44bb
feat: fix working v1 with session-tooling. Still need to use it
Bilb Jul 27, 2024
7ea7d22
working tiny test pushing configs and print seedphrase
Bilb Jul 27, 2024
cad271b
Merge branch 'main' into add-tooling
burtonemily Oct 11, 2024
a2cee2b
Merge pull request #3 from Bilb/add-tooling
burtonemily Oct 11, 2024
61c3f33
feat: fix working v1 with session-tooling. Still need to use it
Bilb Jul 27, 2024
c926c85
working tiny test pushing configs and print seedphrase
Bilb Jul 27, 2024
5551e77
Merge branch 'main' of github.com:burtonemily/session-playwright
burtonemily Oct 16, 2024
189afd4
Revert "feat: fix working v1 with session-tooling"
burtonemily Nov 11, 2024
df1d137
Merge pull request #4 from burtonemily/revert-3-add-tooling
burtonemily Nov 11, 2024
4931b96
fix: some tests fixed, all groups test still broken
Bilb Nov 26, 2024
fa0e4b1
fix: use human readable timer datatestids
Bilb Nov 26, 2024
4a408b4
Merge pull request #6 from Bilb/fix-some-test-group
burtonemily Nov 26, 2024
85c2045
fix: fix the non-groups test for the groups changes
Bilb Nov 28, 2024
31980a4
Removed package.json
burtonemily Dec 10, 2024
bd31b33
Merge branch 'main' of github.com:burtonemily/session-playwright
burtonemily Dec 10, 2024
7dd7bb9
Readds package.json
burtonemily Dec 10, 2024
78154c3
Merge branch 'main' of github.com:session-foundation/session-playwright
burtonemily Dec 10, 2024
388ec2d
Merge pull request #7 from Bilb/fix-test-with-groups
burtonemily Dec 10, 2024
8eff6d9
Merging main into local
burtonemily Dec 10, 2024
cdd68d2
Revert "Merge pull request #7 from Bilb/fix-test-with-groups"
burtonemily Dec 10, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ test-results/
/playwright-report/
/playwright/.cache/
**/*.js
/*.js
*.js
.vscode/settings.json
tests/automation/todo
allure-report
Expand Down
2 changes: 1 addition & 1 deletion tests/automation/disappearing_messages.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ test_Alice_2W(
await setDisappearingMessages(aliceWindow1, [
'note-to-self',
'disappear-after-send-option',
'input-10-seconds',
'time-option-10-seconds',
]);
// Check control message is visible and correct
await doesTextIncludeString(
Expand Down
4 changes: 2 additions & 2 deletions tests/automation/linked_device_requests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ test_Alice_2W_Bob_1W(
await sleepFor(1000);
await clickOnTestIdWithText(
aliceWindow1,
'decline-message-request',
englishStrippedStr('decline').toString(),
'delete-message-request',
englishStrippedStr('delete').toString(),
);
await clickOnTestIdWithText(
aliceWindow1,
Expand Down
4 changes: 2 additions & 2 deletions tests/automation/message_requests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ test_Alice_1W_Bob_1W(
// Check that using the accept button has intended use
await clickOnTestIdWithText(
bobWindow1,
'decline-message-request',
englishStrippedStr('decline').toString(),
'delete-message-request',
englishStrippedStr('delete').toString(),
);
// Confirm decline
await clickOnTestIdWithText(
Expand Down
1 change: 1 addition & 0 deletions tests/automation/setup/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const openElectronAppOnly = async (multi: string) => {
const uniqueId = v4();
process.env.NODE_APP_INSTANCE = `${MULTI_PREFIX}-devprod-${uniqueId}-${process.env.MULTI}`;
process.env.NODE_ENV = NODE_ENV;
process.env.SESSION_DEBUG = '1';

if (!isEmpty(process.env.CI)) {
const sessionBinPath = getSessionDesktopBinPath();
Expand Down
32 changes: 13 additions & 19 deletions tests/automation/types/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@ export type Group = {
export type ConversationType = '1:1' | 'group' | 'community' | 'note-to-self';

export type DMTimeOption =
| 'input-10-seconds'
| 'time-option-0-seconds'
| 'time-option-5-seconds'
| 'time-option-10-seconds'
| 'time-option-30-seconds'
| 'time-option-1-minute'
| 'time-option-60-seconds'
| 'time-option-5-minutes'
| 'time-option-1-hour'
| 'time-option-30-minutes'
| 'time-option-1-hours'
| 'time-option-6-hours'
| 'time-option-12-hours'
| 'time-option-1-day'
| 'time-option-1-week'
| 'time-option-2-weeks';
| 'time-option-1-days'
| 'time-option-7-days'
| 'time-option-14-days';

type DisappearOpts1o1 = [
'1:1',
Expand Down Expand Up @@ -84,7 +87,7 @@ export type DataTestId =
| 'label-device_and_network'
| 'message-request-banner'
| 'module-conversation__user__profile-name'
| 'decline-message-request'
| 'delete-message-request'
| 'session-confirm-ok-button'
| 'dropdownitem-5-seconds'
| 'disappearing-messages-dropdown'
Expand Down Expand Up @@ -139,26 +142,17 @@ export type DataTestId =
| 'disappear-after-read-option'
| 'disappearing-messages'
| 'disappear-after-send-option'
| 'time-option-1-minute'
| 'time-option-10-seconds'
| 'disappear-set-button'
| 'add-user-button'
| 'message-content'
| 'group-update-message'
| 'message-request-response-message'
| 'image-upload-click'
| 'input-10-seconds'
| 'time-option-30-seconds'
| 'time-option-1-minute'
| 'time-option-5-minutes'
| 'time-option-1-hour'
| 'time-option-12-hours'
| 'time-option-1-day'
| 'time-option-1-week'
| 'time-option-2-weeks'
| 'leave-group-button'
| 'create-account-button'
| 'continue-button'
| 'existing-account-button'
| 'context-menu-item'
| 'block-unblock-modal-description';
| 'block-unblock-modal-description'
| DMTimeOption
| `input-${DMTimeOption}`;
5 changes: 5 additions & 0 deletions tests/automation/utilities/reply_message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,17 @@ export const replyTo = async ({
for (let index = 0; index < 5; index++) {
try {
await clickOnTextMessage(senderWindow, textMessage, true, 1000);
// those 2 sleepfor are to try to avoid the layout shift which happens when we click too fast in the context menu
await sleepFor(200, true);

await clickOnMatchingText(
senderWindow,
englishStrippedStr('reply').toString(),
false,
1000,
);
await sleepFor(200, true);

break;
} catch (e) {
console.info(
Expand Down
20 changes: 16 additions & 4 deletions tests/automation/utilities/set_disappearing_messages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { Page } from '@playwright/test';
import { ConversationType, DisappearOptions } from '../types/testing';
import {
ConversationType,
DataTestId,
DisappearOptions,
} from '../types/testing';
import {
clickOnElement,
clickOnMatchingText,
Expand Down Expand Up @@ -50,13 +54,21 @@ export const setDisappearingMessages = async (
// Check that 1 Day default is automatically selected (default time is only relevant to 1:1's)
let defaultTime;
if (timerType === 'disappear-after-read-option') {
// making explicit DataTestId here as `waitForElement` currently allows a string
// TODO: add explicit typing to waitForElement
const dataTestId: DataTestId = 'input-time-option-12-hours';
defaultTime = await waitForElement(windowA, 'data-testid', dataTestId);
} else {
// making explicit DataTestId here as `waitForElement` currently allows a string
// TODO: add explicit typing to waitForElement
const dataTestId: DataTestId = 'input-time-option-1-days';

defaultTime = await waitForElement(
windowA,
'data-testid',
'input-12-hours',
dataTestId,
1000,
);
} else {
defaultTime = await waitForElement(windowA, 'data-testid', 'input-1-day');
}
const checked = await defaultTime.isChecked();
if (checked) {
Expand Down
21 changes: 19 additions & 2 deletions tests/automation/utilities/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,21 @@ export async function waitForElement(
? `css=[${strategy}=${selector}]`
: `css=[${strategy}=${selector}]:has-text("${text.replace(/"/g, '\\"')}")`;

return window.waitForSelector(builtSelector, { timeout: maxWaitMs });
const start = Date.now();
if (!selector.includes('path-light-container')) {
console.log(`waitForElement: ${builtSelector} for maxMs ${maxWaitMs}`);
}

const el = await window.waitForSelector(builtSelector, {
timeout: maxWaitMs,
});
if (!selector.includes('path-light-container')) {
console.log(
`waitForElement: got ${builtSelector} after ${Date.now() - start}ms`,
);
}

return el;
}

export async function waitForTextMessage(
Expand All @@ -72,7 +86,7 @@ export async function waitForTextMessage(
console.info('builtSelector:', builtSelector);
}
const el = await window.waitForSelector(builtSelector, { timeout: maxWait });
console.info(`Text message found. Text: , ${text}`);
console.info(`Text message found. Text: "${text}"`);
return el;
}

Expand Down Expand Up @@ -118,6 +132,9 @@ export async function waitForMatchingPlaceholder(

found = true;
}
if (!found) {
await sleepFor(100, true);
}
} catch (e) {
await sleepFor(1000, true);
console.info(
Expand Down
1 change: 0 additions & 1 deletion tests/locale/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ let initialLocale: Locale | undefined;

let translationDictionary: LocalizerDictionary | undefined;


/**
* Returns the current dictionary to use for translations.
*/
Expand Down