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
13 changes: 10 additions & 3 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
SESSION_DESKTOP_ROOT="<path to session desktop root>"
PLAYWRIGHT_REPEAT_COUNT=0
PLAYWRIGHT_RETRIES_COUNT=0
PLAYWRIGHT_WORKERS_COUNT=1
PRINT_ONGOING_TEST_LOGS=0 # Print logs for tests as they log (should only be enabled when `PLAYWRIGHT_WORKERS_COUNT=1`)
PRINT_FAILED_TEST_LOGS=0 # Print logs for failed tests at the end of each tests (should only be enabled when `PLAYWRIGHT_WORKERS_COUNT=1`)
PLAYWRIGHT_REPEAT_COUNT=0 # Number of times to repeat each test, regardless of their last status (0 means no repeat)
PLAYWRIGHT_RETRIES_COUNT=0 # Number of times to retry each test, only if the last run failed (0 means no retry)
PLAYWRIGHT_WORKERS_COUNT=1 # Number of workers to use for running tests
SESSION_PRO= # Feature flag marking Pro as being released, set to 1 to enable
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)
# DEBUG="pw:*" # warning: this is very verbose and needs `PRINT_ONGOING_TEST_LOGS=1` set too
6 changes: 3 additions & 3 deletions tests/automation/cta_donations.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { englishStrippedStr } from '../localization/englishStrippedStr';
import { CTA } from './locators';
import { test_Alice_1W } from './setup/sessionTest';
import { test_Alice_1W_no_network } from './setup/sessionTest';
import { mockDBCreationTime } from './utilities/time_travel';
import {
checkCTAStrings,
hasElementPoppedUpThatShouldnt,
} from './utilities/utils';

test_Alice_1W(
test_Alice_1W_no_network(
'Donate CTA, DB age >= 7 days',
async ({ aliceWindow1 }) => {
await checkCTAStrings(
Expand All @@ -28,7 +28,7 @@ test_Alice_1W(
},
);

test_Alice_1W(
test_Alice_1W_no_network(
'Donate CTA, DB age < 7 days',
async ({ aliceWindow1 }) => {
await Promise.all([
Expand Down
6 changes: 6 additions & 0 deletions tests/automation/enforce_localized_str.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ function getExpectedStringFromKey(
return 'Donate';
case 'maybeLater':
return 'Maybe Later';
case 'upgradeTo':
return 'Upgrade to';
case 'proCallToActionLongerMessages':
return 'Want to send longer messages? Send more text and unlock premium features with Session Pro Beta';
case 'proFeatureListLoadsMore':
return 'Plus loads more exclusive features';
default:
// returning null means we don't have an expected string yet for this key.
// This will make the test fail
Expand Down
45 changes: 36 additions & 9 deletions tests/automation/message_checks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { longText, mediaArray, testLink } from './constants/variables';
import {
Conversation,
ConversationSettings,
CTA,
Global,
HomeScreen,
} from './locators';
Expand All @@ -24,6 +25,7 @@ import {
trustUser,
} from './utilities/send_media';
import {
checkCTAStrings,
checkModalStrings,
clickOn,
clickOnElement,
Expand Down Expand Up @@ -346,15 +348,40 @@ messageLengthTestCases.forEach((testCase) => {
}),
);
} else {
// Message Too Long modal
await checkModalStrings(
aliceWindow1,
englishStrippedStr('modalMessageTooLongTitle').toString(),
englishStrippedStr('modalMessageTooLongDescription')
.withArgs({ limit: maxChars.toLocaleString('en-AU') }) // Force "2,000" instead of "2000"
.toString(),
);
await clickOn(aliceWindow1, Global.confirmButton);
if (process.env.SESSION_PRO) {
console.log('Session Pro detected, checking CTA');
// Upgrade to pro
await checkCTAStrings(
aliceWindow1,
englishStrippedStr('upgradeTo').toString(),
englishStrippedStr('proCallToActionLongerMessages').toString(),
[
englishStrippedStr('theContinue').toString(),
englishStrippedStr('cancel').toString(),
],
[
` ${englishStrippedStr(
'proFeatureListLongerMessages',
).toString()}`,
` ${englishStrippedStr(
'proFeatureListPinnedConversations',
).toString()}`,
englishStrippedStr('proFeatureListLoadsMore').toString(),
],
);
await clickOn(aliceWindow1, CTA.cancelButton);
} else {
console.log('Session Pro not detected, checking modal');
// Message Too Long modal
await checkModalStrings(
aliceWindow1,
englishStrippedStr('modalMessageTooLongTitle').toString(),
englishStrippedStr('modalMessageTooLongDescription')
.withArgs({ limit: maxChars.toLocaleString('en-AU') }) // Force "2,000" instead of "2000"
.toString(),
);
await clickOn(aliceWindow1, Global.confirmButton);
}

// Verify message didn't send
try {
Expand Down
1 change: 0 additions & 1 deletion tests/automation/setup/new_user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const newUser = async (
// );
await clickOn(window, Global.modalCloseButton);
await clickOn(window, LeftPane.profileButton);

// Save Account ID to a variable
let accountid = await window.innerText(
`[data-testid=${Settings.accountId.selector}]`,
Expand Down
10 changes: 6 additions & 4 deletions tests/automation/setup/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ 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 = 'http://seed2.getsession.org:38157/';
// process.env.LOCAL_DEVNET_SEED_URL = 'http://sesh-net:1280'
// 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
if (context?.dbCreationTimestampMs) {
Expand All @@ -48,7 +48,9 @@ const openElectronAppOnly = async (multi: string, context?: TestContext) => {
delete process.env.DB_CREATION_TIMESTAMP_MS;
}

console.info(` ${process.env.LOCAL_DEVNET_SEED_URL}`);
console.info(
` LOCAL_DEVNET_SEED_URL: ${process.env.LOCAL_DEVNET_SEED_URL}`,
);
console.info(` NON CI RUN`);
console.info(' NODE_ENV', process.env.NODE_ENV);
console.info(' NODE_APP_INSTANCE', process.env.NODE_APP_INSTANCE);
Expand Down
2 changes: 1 addition & 1 deletion tests/automation/utilities/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ function assertTextMatches(

if (sanitizedExpected !== sanitizedActual) {
throw new Error(
`${fieldName} is incorrect.\nExpected: ${sanitizedExpected}\nActual: ${sanitizedActual}`,
`${fieldName} is incorrect.\nExpected: ${sanitizedExpected}\nActual: ${sanitizedActual}\n`,
);
}
}
Expand Down
Loading