Skip to content

Commit 1c7a464

Browse files
Remove pre-authenticated Playwright tests (#13606)
* Remove signed in playwright tests
1 parent d5c02e2 commit 1c7a464

File tree

6 files changed

+84
-425
lines changed

6 files changed

+84
-425
lines changed

dotcom-rendering/playwright/lib/load-page.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -98,30 +98,6 @@ const loadPageWithOverrides = async (
9898
await loadPage({ page, path, queryParamsOn: false });
9999
};
100100

101-
/**
102-
* Allows us to continue using cookies for signed in features
103-
* until we figure out how to use Okta in e2e testing.
104-
* See https://github.com/guardian/dotcom-rendering/issues/8758
105-
*/
106-
const loadPageNoOkta = async (
107-
page: Page,
108-
article: FEArticleType,
109-
overrides?: {
110-
configOverrides?: Record<string, unknown>;
111-
switchOverrides?: Record<string, unknown>;
112-
},
113-
): Promise<void> => {
114-
await loadPageWithOverrides(page, article, {
115-
configOverrides: overrides?.configOverrides,
116-
switchOverrides: {
117-
...overrides?.switchOverrides,
118-
okta: false,
119-
idCookieRefresh: false,
120-
userFeaturesDcr: true,
121-
},
122-
});
123-
};
124-
125101
/**
126102
* Fetch the page json from PROD then load it as a POST with overrides
127103
*/
@@ -148,6 +124,5 @@ export {
148124
BASE_URL,
149125
fetchAndloadPageWithOverrides,
150126
loadPage,
151-
loadPageNoOkta,
152127
loadPageWithOverrides,
153128
};

dotcom-rendering/playwright/tests/braze.e2e.spec.ts

Lines changed: 0 additions & 142 deletions
This file was deleted.

dotcom-rendering/playwright/tests/sign-in-gate.e2e.spec.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,6 @@ test.describe('Sign In Gate Tests', () => {
8484
await expectToNotExist(page, SIGN_IN_GATE_MAIN_SELECTOR);
8585
});
8686

87-
test('do NOT load the sign in gate if the user is signed in', async ({
88-
context,
89-
page,
90-
}) => {
91-
// Fake login
92-
await addCookie(context, { name: 'GU_U', value: 'true' });
93-
94-
await loadPageWithOverrides(page, standardArticle);
95-
96-
await scrollToGateForLazyLoading(page);
97-
98-
await expectToNotExist(page, SIGN_IN_GATE_MAIN_SELECTOR);
99-
});
100-
10187
test('do NOT load the sign in gate if the user has already dismissed the gate', async ({
10288
page,
10389
}) => {

dotcom-rendering/playwright/tests/signedin.e2e.spec.ts

Lines changed: 2 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,16 @@
11
import { expect, test } from '@playwright/test';
22
import { Standard as standardArticle } from '../../fixtures/generated/fe-articles/Standard';
33
import { disableCMP } from '../lib/cmp';
4-
import { addCookie } from '../lib/cookies';
54
import { waitForIsland } from '../lib/islands';
6-
import { loadPageNoOkta } from '../lib/load-page';
7-
import { stubResponse } from '../lib/network';
8-
9-
const profileResponse = {
10-
status: 'ok',
11-
userProfile: {
12-
userId: '102309223',
13-
displayName: 'Guardian User',
14-
webUrl: 'https://profile.theguardian.com/user/id/102309223',
15-
apiUrl: 'https://discussion.guardianapis.com/discussion-api/profile/102309223',
16-
avatar: 'https://avatar.guim.co.uk/user/102309223',
17-
secureAvatarUrl: 'https://avatar.guim.co.uk/user/102309223',
18-
badge: [],
19-
privateFields: {
20-
canPostComment: true,
21-
isPremoderated: false,
22-
hasCommented: false,
23-
},
24-
},
25-
};
26-
27-
const idapiIdentifiersResponse = {
28-
id: '000000000',
29-
brazeUuid: 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
30-
puzzleUuid: 'aaaaaaaaaaaa',
31-
googleTagId: 'aaaaaaaaaaaa',
32-
};
5+
import { loadPageWithOverrides } from '../lib/load-page';
336

347
test.describe('Signed in readers', () => {
35-
test('should display the correct page state for signed in users', async ({
36-
context,
37-
page,
38-
}) => {
39-
// Fake login
40-
await addCookie(context, { name: 'GU_U', value: 'true' });
41-
42-
// Mock call to '/user/me/identifiers'
43-
const idapiReponseProfile = stubResponse(
44-
page,
45-
'**/user/me/identifiers',
46-
{
47-
json: idapiIdentifiersResponse,
48-
},
49-
);
50-
51-
// Mock call to 'profile/me'
52-
const profileResponsePromise = stubResponse(
53-
page,
54-
'**/profile/me?strict_sanctions_check=false',
55-
{
56-
json: profileResponse,
57-
},
58-
);
59-
60-
await disableCMP(context);
61-
await loadPageNoOkta(page, standardArticle);
62-
63-
await idapiReponseProfile;
64-
await profileResponsePromise;
65-
66-
// This text is shown in the header for signed in users
67-
await expect(page.getByText('My account')).toBeVisible();
68-
});
69-
70-
test('should have the correct urls for the header links', async ({
71-
context,
72-
page,
73-
}) => {
74-
// Fake login
75-
await addCookie(context, { name: 'GU_U', value: 'true' });
76-
77-
await addCookie(context, {
78-
name: 'gu_hide_support_messaging',
79-
value: 'true',
80-
});
81-
82-
// Mock call to 'profile/me'
83-
const profileResponsePromise = stubResponse(
84-
page,
85-
'**/profile/me?strict_sanctions_check=false',
86-
{
87-
json: profileResponse,
88-
},
89-
);
90-
91-
await disableCMP(context);
92-
await loadPageNoOkta(page, standardArticle);
93-
94-
await profileResponsePromise;
95-
96-
expect(
97-
await page
98-
.locator('a[data-link-name="header : topbar : printsubs"]')
99-
.getAttribute('href'),
100-
).toContain('support.theguardian.com/subscribe');
101-
102-
expect(
103-
await page
104-
.locator('a[data-link-name="header : topbar : job-cta"]')
105-
.getAttribute('href'),
106-
).toContain('https://jobs.theguardian.com');
107-
108-
expect(
109-
await page
110-
.locator(
111-
'button[data-link-name="header : topbar : my account"]',
112-
)
113-
.textContent(),
114-
).toContain('My account');
115-
});
116-
1178
test('should not display signed in texts when users are not signed in', async ({
1189
context,
11910
page,
12011
}) => {
12112
await disableCMP(context);
122-
await loadPageNoOkta(page, standardArticle);
13+
await loadPageWithOverrides(page, standardArticle);
12314

12415
await waitForIsland(page, 'DiscussionWeb');
12516

0 commit comments

Comments
 (0)