Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ SESSION_PRO= # Feature flag marking Pro as being released, set to
TEST_PRO_BACKEND= # If `SESSION_PRO` is set, this is the backend to use (the only working is the dev one, set to 1)
LOCAL_DEVNET_SEED_URL= # The local devnet seed url to use
SESSION_DEBUG= # Enable debug mode on session-desktop (set to 1 to enable)
LOG_BROWSER_CONSOLE= # Enable log of the browser console (set to 1 to enable)
LOG_NODE_CONSOLE= # Enable log of the node console (set to 1 to enable), needs PRINT_ONGOING_TEST_LOGS
SESSION_DEBUG= # Enable debug mode on session-desktop (set to 1 to enable), needs PRINT_ONGOING_TEST_LOGS
# DEBUG="pw:*" # warning: this is very verbose and needs `PRINT_ONGOING_TEST_LOGS=1` set too
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions sessionReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,9 @@ class SessionReporter implements Reporter {
_result: TestResult | void,
) {
if (printOngoingTestLogs()) {
const asStr = isString(chunk) ? chunk : chunk.toString('utf-8');
process.stdout.write(
`"${test ? `${chalk.cyanBright(test.title)}` : ''}": ${
isString(chunk) ? chunk : chunk.toString('utf-8')
}`,
`"${test ? `${chalk.cyanBright(test.title)}` : ''}": ${asStr}`,
);
}
}
Expand Down
25 changes: 14 additions & 11 deletions tests/automation/community_tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ import { replyTo } from './utilities/reply_message';
import { sendMedia } from './utilities/send_media';
import { clickOn, clickOnWithText } from './utilities/utils';

test_Alice_2W('Join community', async ({ aliceWindow1, aliceWindow2 }) => {
await joinCommunity(aliceWindow1);
await clickOn(aliceWindow1, Conversation.scrollToBottomButton);
await sendMessage(aliceWindow1, 'Hello, community!');
// Check linked device for community
await clickOnWithText(
aliceWindow2,
HomeScreen.conversationItemName,
testCommunityName,
);
});
test_Alice_2W(
'Join community and sync',
async ({ aliceWindow1, aliceWindow2 }) => {
await joinCommunity(aliceWindow1);
await clickOn(aliceWindow1, Conversation.scrollToBottomButton);
await sendMessage(aliceWindow1, 'Hello, community!');
// Check linked device for community
await clickOnWithText(
aliceWindow2,
HomeScreen.conversationItemName,
testCommunityName,
);
},
);

test_Alice_1W_Bob_1W(
'Send image to community',
Expand Down
11 changes: 3 additions & 8 deletions tests/automation/setup/new_user.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { Page } from '@playwright/test';
import chalk from 'chalk';

import {
Global,
HomeScreen,
LeftPane,
Onboarding,
Settings,
} from '../locators';
import { Global, LeftPane, Onboarding, Settings } from '../locators';
import { User } from '../types/testing';
import {
checkPathLight,
Expand All @@ -28,7 +22,8 @@ export const newUser = async (
await typeIntoInput(window, Onboarding.displayNameInput.selector, userName);
await clickOn(window, Global.continueButton);
// save recovery phrase
await clickOn(window, HomeScreen.revealRecoveryPhraseButton);
await clickOn(window, LeftPane.profileButton);
await clickOn(window, Settings.recoveryPasswordMenuItem);
await waitForTestIdWithText(
window,
Settings.recoveryPasswordContainer.selector,
Expand Down
23 changes: 19 additions & 4 deletions tests/automation/setup/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { isEmpty } from 'lodash';
import { join } from 'path';
import { v4 } from 'uuid';

const logNodeConsole = process.env.LOG_NODE_CONSOLE === '1';

export const NODE_ENV = 'production';
export const MULTI_PREFIX = 'test-integration-';
const multisAvailable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
Expand Down Expand Up @@ -60,9 +62,6 @@ const openElectronAppOnly = async (multi: string, context?: TestContext) => {
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';
// process.env.LOCAL_DEVNET_SEED_URL = process.env.LOCAL_DEVNET_SEED_URL ?? 'http://seed2.getsession.org:38157/';
// process.env.LOCAL_DEVNET_SEED_URL = 'http://sesh-net.local:1280';

// Inject custom env vars if provided
mockDbCreationTimestamp(context?.dbCreationTimestampMs);
Expand All @@ -82,8 +81,24 @@ const openElectronAppOnly = async (multi: string, context?: TestContext) => {
'--disable-gpu',
'--force-device-scale-factor=1', // Normalizes Retina and non-Retina mac screens
],
env: {
...process.env,
ELECTRON_ENABLE_LOGGING: '1',
// Optional: control log level
ELECTRON_LOG_LEVEL: 'verbose', // 'verbose', 'info', 'warn', 'error'
},
});

if (logNodeConsole) {
electronApp.on('console', (msg) => {
const text = msg.text();

// if (text.includes('[QUERY PLAN]')) {
console.log(`[FROM NODE ${msg.type()}]:`, text);
// }
});
}

// When a test closes a window on purpose,
// the restarted app is considered a child process of the original electronApp.
// However Playwright only tracks the original processes.
Expand All @@ -106,7 +121,7 @@ const openElectronAppOnly = async (multi: string, context?: TestContext) => {
}
};

const logBrowserConsole = false;
const logBrowserConsole = process.env.LOG_BROWSER_CONSOLE === '1';

const openAppAndWait = async (multi: string, context?: TestContext) => {
const electronApp = await openElectronAppOnly(multi, context);
Expand Down
Loading