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
48 changes: 3 additions & 45 deletions tests/automation/cta_donations.spec.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import { Page } from '@playwright/test';

import { tStripped } from '../localization/lib';
import { CTA, Global } from './locators';
import { test_Alice_1W } from './setup/sessionTest';
import { mockDBCreationTime } from './utilities/time_travel';
import {
checkCTAStrings,
checkModalStrings,
clickOn,
reloadWindow,
verifyNoCTAShows,
} from './utilities/utils';

async function verifyDonateCTAShows(window: Page) {
await checkCTAStrings(
window,
tStripped('donateSessionHelp'),
tStripped('donateSessionDescription'),
[tStripped('donate'), tStripped('maybeLater')],
tStripped('donateSessionAppealTitle'),
tStripped('donateSessionAppealDescription'),
[tStripped('donateSessionAppealReadMore')],
);
}

Expand All @@ -43,45 +40,6 @@ test_Alice_1W(
},
);

const urlModalButtons = [
{ button: Global.openUrlButton, name: 'Open' },
{ button: Global.copyUrlButton, name: 'Copy' },
];

urlModalButtons.forEach(({ button, name }) => {
test_Alice_1W(
`Donate CTA, never shows after ${name}`,
async ({ aliceWindow1 }) => {
const url = 'https://getsession.org/donate';

// First time: CTA should appear
await verifyDonateCTAShows(aliceWindow1);

await clickOn(aliceWindow1, CTA.confirmButton);
await checkModalStrings(
aliceWindow1,
tStripped('urlOpen'),
tStripped('urlOpenDescription', { url }),
'openUrlModal',
);

// Click the Open or Copy button
// Note: "Open" spawns a system browser outside Playwright's control
await clickOn(aliceWindow1, button);

// Reload and verify CTA never appears again
await reloadWindow(aliceWindow1);
await verifyNoCTAShows(aliceWindow1);
},
{
dbCreationTimestampMs: mockDBCreationTime({
days: -7,
minutes: -2,
}),
},
);
});

test_Alice_1W(
'Donate CTA, DB age < 7 days',
async ({ aliceWindow1 }) => {
Expand Down
12 changes: 6 additions & 6 deletions tests/automation/enforce_localized_str.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,12 @@ function getExpectedStringFromKey(
return 'You cannot go back further. In order to stop loading your account, Session needs to quit.';
case 'quitButton':
return 'Quit';
case 'donateSessionHelp':
return 'Session Needs Your Help';
case 'donateSessionDescription':
return 'Powerful forces are trying to weaken privacy, but we can’t continue this fight alone. Donating helps keep Session secure, independent, and online.';
case 'donate':
return 'Donate';
case 'donateSessionAppealTitle':
return 'Please Read: A Personal Appeal From Cofounder of Session Chris McCabe';
case 'donateSessionAppealDescription':
return 'Eight years ago, Session was founded with a mission to restore your privacy. Today, Session faces a funding shortage which puts its very survival at risk. If you’ve ever found value in Session or its mission, please give me a moment of your time and read this appeal.';
case 'donateSessionAppealReadMore':
return 'Read Appeal';
case 'maybeLater':
return 'Maybe Later';
case 'upgradeTo':
Expand Down
2 changes: 1 addition & 1 deletion tests/localization/lib
Loading