Repository: freeCodeCamp/freeCodeCamp (language: python)

Issue:
Default to being signed in for playwright tests
Our Playwright tests sign in before every test, via the https://github.com/freeCodeCamp/freeCodeCamp/blob/main/e2e/global-setup.ts, but they don't use the authentication cookies by default. This is counterintuitive, since it's natural to assume that this means the test runner will be signed in.

To fix this, we should change the https://github.com/freeCodeCamp/freeCodeCamp/blob/main/playwright.config.ts so that the projects use the generated `storageState`. Then it should be possible to remove all the `test.use({ storageState: 'playwright/.auth/certified-user.json' });`, but it will be necessary to manually sign out whenever the tests need the browser to be signed out. This can be achieved with `test.use({ storageState: { cookies: [], origins: [] } });`.

Original discussion:
https://github.com/freeCodeCamp/freeCodeCamp/pull/54481#discussion_r1581288800


Discussion / hints:
Hey @huyenltnguyen it's not urgent, but I just wanted to check if you're still planning to work on this? No worries if not - we can open this up for contribution.
Discussed with Huyen I will be taking a jab at this.

Fix patch:
diff --git a/playwright.config.ts b/playwright.config.ts
index 8adc5cc913095b..8791e0ea687def 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -33,7 +33,7 @@ export default defineConfig({
     baseURL: process.env.HOME_LOCATION || 'http://127.0.0.1:8000',
     /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
     trace: 'on-first-retry',
-
+    storageState: 'playwright/.auth/certified-user.json',
     /* Use custom test attribute */
     testIdAttribute: 'data-playwright-test-label'
   },


Test patch:
diff --git a/e2e/c-sharp.spec.ts b/e2e/c-sharp.spec.ts
index 9373a87b757765..22a273f9c1b900 100644
--- a/e2e/c-sharp.spec.ts
+++ b/e2e/c-sharp.spec.ts
@@ -1,6 +1,5 @@
 import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
 const checkAnswerButtonText = translations.buttons['check-answer'];
 const askForHelpButtonText = translations.buttons['ask-for-help'];
 const trophyButtonText = translations.buttons['verify-trophy'];
diff --git a/e2e/cert-username-case-navigation.spec.ts b/e2e/cert-username-case-navigation.spec.ts
index 9da76f015371d9..7ccb5a2d130d4a 100644
--- a/e2e/cert-username-case-navigation.spec.ts
+++ b/e2e/cert-username-case-navigation.spec.ts
@@ -2,7 +2,6 @@ import { execSync } from 'child_process';
 import { expect, test } from '@playwright/test';
 
 test.describe('Public profile certifications', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
   test('Should show claimed certifications if the username has all lowercase characters', async ({
     page
   }) => {
diff --git a/e2e/certification.spec.ts b/e2e/certification.spec.ts
index 5abf3883644bae..74012408437c3e 100644
--- a/e2e/certification.spec.ts
+++ b/e2e/certification.spec.ts
@@ -3,8 +3,6 @@ import { test, expect, Page } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 import { alertToBeVisible } from './utils/alerts';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.describe('Certification page - Non Microsoft', () => {
   test.beforeEach(async ({ page }) => {
     await page.goto('/certification/certifieduser/responsive-web-design');
@@ -148,7 +146,6 @@ test.describe('Invalid certification page', () => {
     }
   };
   test.describe('for authenticated user', () => {
-    test.use({ storageState: 'playwright/.auth/certified-user.json' });
     test(
       'it should redirect to / and display an error message',
       testInvalidCertification
diff --git a/e2e/challenge-reset-modal.spec.ts b/e2e/challenge-reset-modal.spec.ts
index a8dc87ad4fba8c..5c42de5f249e88 100644
--- a/e2e/challenge-reset-modal.spec.ts
+++ b/e2e/challenge-reset-modal.spec.ts
@@ -97,61 +97,68 @@ test('User can reset challenge', async ({ page, isMobile, browserName }) => {
   ).not.toBeVisible();
 });
 
-test('User can reset classic challenge', async ({ page, isMobile }) => {
-  await page.goto(
-    '/learn/javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code'
-  );
-
-  const challengeSolution = '// This is in-line comment';
-  await focusEditor({ page, isMobile });
-  await getEditors(page).fill(challengeSolution);
+test.describe('When the user is not logged in', () => {
+  test.use({ storageState: { cookies: [], origins: [] } });
+  test('User can reset classic challenge', async ({ page, isMobile }) => {
+    await page.goto(
+      '/learn/javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code'
+    );
 
-  const submitButton = page.getByRole('button', {
-    name: isMobile ? translations.buttons.run : translations.buttons['run-test']
-  });
-  await submitButton.click();
+    const challengeSolution = '// This is in-line comment';
+    await focusEditor({ page, isMobile });
+    await getEditors(page).fill(challengeSolution);
 
-  await expect(
-    page.locator('.view-lines').getByText(challengeSolution)
-  ).toBeVisible();
+    const submitButton = page.getByRole('button', {
+      name: isMobile
+        ? translations.buttons.run
+        : translations.buttons['run-test']
+    });
+    await submitButton.click();
 
-  if (isMobile) {
-    await page
-      .getByText(translations.learn['editor-tabs'].instructions)
-      .click();
-  }
+    await expect(
+      page.locator('.view-lines').getByText(challengeSolution)
+    ).toBeVisible();
 
-  await expect(
-    page.getByLabel(translations.icons.passed).locator('circle')
-  ).toBeVisible();
+    if (isMobile) {
+      await page
+        .getByText(translations.learn['editor-tabs'].instructions)
+        .click();
+    }
 
-  await page
-    .getByRole('button', {
-      name: !isMobile
-        ? translations.buttons['reset-lesson']
-        : translations.buttons.reset
-    })
-    .click();
+    await expect(
+      page.getByLabel(translations.icons.passed).locator('circle')
+    ).toBeVisible();
 
-  await page
-    .getByRole('button', { name: translations.buttons['reset-lesson'] })
-    .click();
-
-  await expect(
-    page.locator('.view-lines').getByText(challengeSolution)
-  ).not.toBeVisible();
-  await expect(
-    page.getByLabel(translations.icons.passed).locator('circle')
-  ).not.toBeVisible();
-  await expect(
-    page.getByText(translations.learn['tests-completed'])
-  ).not.toBeVisible();
+    await page
+      .getByRole('button', {
+        name: !isMobile
+          ? translations.buttons['reset-lesson']
+          : translations.buttons.reset
+      })
+      .click();
 
-  if (isMobile) {
-    await page.getByText(translations.learn['editor-tabs'].console).click();
-  }
+    await page
+      .getByRole('button', { name: translations.buttons['reset-lesson'] })
+      .click();
 
-  await expect(page.getByText(translations.learn['test-output'])).toBeVisible();
+    await expect(
+      page.locator('.view-lines').getByText(challengeSolution)
+    ).not.toBeVisible();
+    await expect(
+      page.getByLabel(translations.icons.passed).locator('circle')
+    ).not.toBeVisible();
+    await expect(
+      page.getByText(translations.learn['tests-completed'])
+    ).not.toBeVisible();
+
+    if (isMobile) {
+      await page.getByText(translations.learn['editor-tabs'].console).click();
+    }
+
+    await expect(
+      page.getByText(translations.learn['test-output'])
+    ).toBeVisible();
+  });
 });
 
 test('should close when the user clicks the close button', async ({ page }) => {
diff --git a/e2e/challenge-title.spec.ts b/e2e/challenge-title.spec.ts
index a348a73003c702..4ebd5cf1ebfad4 100644
--- a/e2e/challenge-title.spec.ts
+++ b/e2e/challenge-title.spec.ts
@@ -74,8 +74,6 @@ test.describe('Challenge Title Component (signed out)', () => {
 });
 
 test.describe('Challenge Title Component (signed in)', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test('should display GreenPass after challenge completion', async ({
     page
   }) => {
diff --git a/e2e/code-storage.spec.ts b/e2e/code-storage.spec.ts
index 6e539549a803fd..469423cf1b8dd4 100644
--- a/e2e/code-storage.spec.ts
+++ b/e2e/code-storage.spec.ts
@@ -2,7 +2,6 @@ import { test, expect } from '@playwright/test';
 
 import { getEditors } from './utils/editor';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
 test.describe('Challenge with editor', function () {
   test.skip(({ isMobile }) => isMobile);
   test('the shortcut "Ctrl + S" saves the code', async ({ page }) => {
diff --git a/e2e/codeally.spec.ts b/e2e/codeally.spec.ts
index 12f9c9aac7b778..8dafbc443fcc1b 100644
--- a/e2e/codeally.spec.ts
+++ b/e2e/codeally.spec.ts
@@ -23,8 +23,6 @@ test.describe('Before completing the project', () => {
 });
 
 test.describe('After completing the project', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test.beforeAll(() => {
     execSync('node ./tools/scripts/seed/seed-demo-user --certified-user');
   });
diff --git a/e2e/completion-modal.spec.ts b/e2e/completion-modal.spec.ts
index 60fc38d50e8e55..65b9494c2bb999 100644
--- a/e2e/completion-modal.spec.ts
+++ b/e2e/completion-modal.spec.ts
@@ -16,6 +16,7 @@ test.beforeEach(async ({ page }) => {
 });
 
 test.describe('Challenge Completion Modal Tests (Signed Out)', () => {
+  test.use({ storageState: { cookies: [], origins: [] } });
   test('should render the modal correctly', async ({ page }) => {
     await expect(page.getByRole('heading')).toBeVisible();
     await expect(page.getByRole('button', { name: 'close' })).toBeVisible();
@@ -83,8 +84,6 @@ test.describe('Challenge Completion Modal Tests (Signed Out)', () => {
 });
 
 test.describe('Challenge Completion Modal Tests (Signed In)', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test('should render the modal correctly', async ({ page }) => {
     await expect(page.getByRole('heading')).toBeVisible();
     await expect(page.getByRole('button', { name: 'close' })).toBeVisible();
diff --git a/e2e/delete-modal.spec.ts b/e2e/delete-modal.spec.ts
index d6902a35253d7e..b58b098418baae 100644
--- a/e2e/delete-modal.spec.ts
+++ b/e2e/delete-modal.spec.ts
@@ -8,8 +8,6 @@ import { alertToBeVisible } from './utils/alerts';
 
 const execP = promisify(exec);
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.beforeEach(async ({ page }) => {
   await page.goto('/settings');
 });
diff --git a/e2e/desktop-layout.spec.ts b/e2e/desktop-layout.spec.ts
index b0d0f0798e7568..c6862624d56dcf 100644
--- a/e2e/desktop-layout.spec.ts
+++ b/e2e/desktop-layout.spec.ts
@@ -1,7 +1,5 @@
 import { test, expect } from '@playwright/test';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.describe('Classic challenge - 3 pane desktop layout component', () => {
   test.skip(
     ({ isMobile }) => isMobile === true,
diff --git a/e2e/donate-page-default.spec.ts b/e2e/donate-page-default.spec.ts
index 66bedd3f40a835..8db0315860a1f2 100644
--- a/e2e/donate-page-default.spec.ts
+++ b/e2e/donate-page-default.spec.ts
@@ -1,8 +1,6 @@
 import { test, expect, type Page } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 const pageElements = {
   mainHeading: 'main-head',
   donateText1: 'donate-text-1',
diff --git a/e2e/donation-modal.spec.ts b/e2e/donation-modal.spec.ts
index 44b2a3fca443a0..e3a347aeb9496b 100644
--- a/e2e/donation-modal.spec.ts
+++ b/e2e/donation-modal.spec.ts
@@ -117,8 +117,6 @@ test.describe('Donation modal display', () => {
     await addGrowthbookCookie({ context, variation: 'A' });
   });
 
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test('should display the content correctly and disable close when the animation is not complete', async ({
     page,
     browserName,
@@ -292,7 +290,6 @@ test.describe('Donation modal appearance logic - New user', () => {
 });
 
 test.describe('Donation modal appearance logic - Certified user', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
   test.beforeEach(async ({ context }) => {
     await addGrowthbookCookie({ context, variation: 'A' });
   });
@@ -333,8 +330,6 @@ test.describe('Donation modal appearance logic - Certified user', () => {
 });
 
 test.describe('Donation modal appearance logic - Donor user', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test.beforeAll(() => {
     execSync(
       'node ./tools/scripts/seed/seed-demo-user --certified-user --set-true isDonating'
diff --git a/e2e/edit-profile-modal.spec.ts b/e2e/edit-profile-modal.spec.ts
index 8a41f2b122a6e3..c45a96bf0c6579 100644
--- a/e2e/edit-profile-modal.spec.ts
+++ b/e2e/edit-profile-modal.spec.ts
@@ -1,8 +1,6 @@
 import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.beforeEach(async ({ page }) => {
   await page.goto('/certifieduser');
 
diff --git a/e2e/editor.spec.ts b/e2e/editor.spec.ts
index 147b772831f830..f86f3a8e907513 100644
--- a/e2e/editor.spec.ts
+++ b/e2e/editor.spec.ts
@@ -64,8 +64,6 @@ test.describe('Editor theme if the system theme is dark', () => {
   test.use({ colorScheme: 'dark' });
 
   test.describe('If the user is signed in', () => {
-    test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
     test('should respect the user settings', async ({ page, request }) => {
       const editor = page.locator("div[role='code'].monaco-editor");
 
@@ -96,8 +94,6 @@ test.describe('Editor theme if the system theme is light', () => {
   test.use({ colorScheme: 'light' });
 
   test.describe('If the user is signed in', () => {
-    test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
     test('should respect the user settings', async ({ page, request }) => {
       const editor = page.locator("div[role='code'].monaco-editor");
 
diff --git a/e2e/email-settings.spec.ts b/e2e/email-settings.spec.ts
index ffc182e957ec02..0f12aa17246ec6 100644
--- a/e2e/email-settings.spec.ts
+++ b/e2e/email-settings.spec.ts
@@ -15,8 +15,6 @@ const settingsPageElement = {
 const originalEmail = 'foo@bar.com';
 const newEmail = 'foo-update@bar.com';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.beforeEach(async ({ page }) => {
   execSync('node ./tools/scripts/seed/seed-demo-user --certified-user');
   await page.goto('/settings');
diff --git a/e2e/exam-results-modal.spec.ts b/e2e/exam-results-modal.spec.ts
index 16917d3d6152c4..321fbd590a8f7f 100644
--- a/e2e/exam-results-modal.spec.ts
+++ b/e2e/exam-results-modal.spec.ts
@@ -1,7 +1,5 @@
 import { test, expect } from '@playwright/test';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.describe('Exam results modal', () => {
   test.beforeEach(async ({ page }) => {
     await page.goto('/settings');
diff --git a/e2e/exam-results.spec.ts b/e2e/exam-results.spec.ts
index c6aa9d2e4bc03c..0cba6a0463c2fe 100644
--- a/e2e/exam-results.spec.ts
+++ b/e2e/exam-results.spec.ts
@@ -3,8 +3,6 @@ import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 import intro from '../client/i18n/locales/english/intro.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 const examUrl =
   '/learn/foundational-c-sharp-with-microsoft/foundational-c-sharp-with-microsoft-certification-exam/foundational-c-sharp-with-microsoft-certification-exam';
 
diff --git a/e2e/exam-show-non-qualified.spec.ts b/e2e/exam-show-non-qualified.spec.ts
index 22a8acdb3d8fe9..bf8134baf33f2f 100644
--- a/e2e/exam-show-non-qualified.spec.ts
+++ b/e2e/exam-show-non-qualified.spec.ts
@@ -4,7 +4,7 @@ import translations from '../client/i18n/locales/english/translations.json';
 
 const examUrl =
   '/learn/foundational-c-sharp-with-microsoft/foundational-c-sharp-with-microsoft-certification-exam/foundational-c-sharp-with-microsoft-certification-exam';
-
+test.use({ storageState: { cookies: [], origins: [] } });
 test.beforeEach(async ({ page }) => {
   await page.goto(examUrl);
 });
diff --git a/e2e/exam-show-qualified.spec.ts b/e2e/exam-show-qualified.spec.ts
index 73eeb5deb912da..56d9cd26ac2398 100644
--- a/e2e/exam-show-qualified.spec.ts
+++ b/e2e/exam-show-qualified.spec.ts
@@ -2,8 +2,6 @@ import { test, expect } from '@playwright/test';
 import intro from '../client/i18n/locales/english/intro.json';
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 const examUrl =
   '/learn/foundational-c-sharp-with-microsoft/foundational-c-sharp-with-microsoft-certification-exam/foundational-c-sharp-with-microsoft-certification-exam';
 
diff --git a/e2e/exam-started-show.spec.ts b/e2e/exam-started-show.spec.ts
index ecbcb0a2fea6d3..3b189c93789317 100644
--- a/e2e/exam-started-show.spec.ts
+++ b/e2e/exam-started-show.spec.ts
@@ -2,8 +2,6 @@ import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 import intro from '../client/i18n/locales/english/intro.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 const examUrl =
   '/learn/foundational-c-sharp-with-microsoft/foundational-c-sharp-with-microsoft-certification-exam/foundational-c-sharp-with-microsoft-certification-exam';
 
diff --git a/e2e/exam-survey.spec.ts b/e2e/exam-survey.spec.ts
index 28260d002fd427..7ecbf43c5e0dee 100644
--- a/e2e/exam-survey.spec.ts
+++ b/e2e/exam-survey.spec.ts
@@ -3,7 +3,6 @@ import { test, expect } from '@playwright/test';
 const url =
   '/learn/foundational-c-sharp-with-microsoft/foundational-c-sharp-with-microsoft-certification-exam/foundational-c-sharp-with-microsoft-certification-exam';
 test.describe('Exam Survey', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
   test.beforeAll(() => {
     execSync('node ./tools/scripts/seed/seed-demo-user --certified-user');
     execSync('node tools/scripts/seed/seed-surveys.js delete-only');
diff --git a/e2e/exam-token.spec.ts b/e2e/exam-token.spec.ts
index 46ca3665a0a16e..b6ca5e1a025535 100644
--- a/e2e/exam-token.spec.ts
+++ b/e2e/exam-token.spec.ts
@@ -3,8 +3,6 @@
 
 // import { test, expect } from '@playwright/test';
 
-// test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 // test.beforeEach(async ({ page }) => {
 //   await page.goto('/settings');
 // });
diff --git a/e2e/exit-exam-modal.spec.ts b/e2e/exit-exam-modal.spec.ts
index a315dab4a3b4c6..dc76f57703383a 100644
--- a/e2e/exit-exam-modal.spec.ts
+++ b/e2e/exit-exam-modal.spec.ts
@@ -1,8 +1,6 @@
 import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 const examUrl =
   '/learn/foundational-c-sharp-with-microsoft/foundational-c-sharp-with-microsoft-certification-exam/foundational-c-sharp-with-microsoft-certification-exam';
 const cancelExamUrl =
diff --git a/e2e/finish-exam-modal.spec.ts b/e2e/finish-exam-modal.spec.ts
index 2f41f4a2fa5642..54e51e542c3de5 100644
--- a/e2e/finish-exam-modal.spec.ts
+++ b/e2e/finish-exam-modal.spec.ts
@@ -1,8 +1,6 @@
 import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 const examUrl =
   '/learn/foundational-c-sharp-with-microsoft/foundational-c-sharp-with-microsoft-certification-exam/foundational-c-sharp-with-microsoft-certification-exam';
 const QUESTION_COUNT = 5;
diff --git a/e2e/flash.spec.ts b/e2e/flash.spec.ts
index d13e2fc960df43..2619754c626fd0 100644
--- a/e2e/flash.spec.ts
+++ b/e2e/flash.spec.ts
@@ -1,7 +1,6 @@
 import { test, expect, type Page } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
 test.beforeEach(async ({ page }) => {
   await page.goto('/settings');
 });
diff --git a/e2e/form-helper.spec.ts b/e2e/form-helper.spec.ts
index b00119e51d50db..b6eee7e860dbc9 100644
--- a/e2e/form-helper.spec.ts
+++ b/e2e/form-helper.spec.ts
@@ -1,8 +1,6 @@
 import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.describe('Test form with only solution link', () => {
   test.beforeEach(async ({ page }) => {
     await page.goto(
diff --git a/e2e/global-setup.ts b/e2e/global-setup.ts
index 5cdf17539c08ac..a1699039e6f23f 100644
--- a/e2e/global-setup.ts
+++ b/e2e/global-setup.ts
@@ -3,6 +3,12 @@ import { execSync } from 'child_process';
 import { test as setup } from '@playwright/test';
 
 setup.describe('certifieduser', () => {
+  setup.use({ storageState: { cookies: [], origins: [] } });
+
+  setup.beforeAll(() => {
+    execSync('node ./tools/scripts/seed/seed-demo-user --certified-user ');
+  });
+
   setup('can sign in', async ({ request }) => {
     await request.get(process.env.API_LOCATION + '/signin');
     await request.storageState({
@@ -12,6 +18,10 @@ setup.describe('certifieduser', () => {
 });
 
 setup.describe('developmentuser', () => {
+  // We need to make sure the development user does not have any cookies from the certified user.
+  // Ass the certified user now has the default storage state.
+  setup.use({ storageState: { cookies: [], origins: [] } });
+
   // We can only sign in as a single user (one with email: 'foo@bar.com'), so
   // changing users means changing the record with that email in the database.
   setup.beforeAll(() => {
diff --git a/e2e/header.spec.ts b/e2e/header.spec.ts
index 1ac19e497593e6..e37cbb257fdf3e 100644
--- a/e2e/header.spec.ts
+++ b/e2e/header.spec.ts
@@ -276,8 +276,6 @@ test.describe('Header', () => {
 });
 
 test.describe('Exam Header', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test('Renders exam nav for Foundational C# with Microsoft exam', async ({
     page
   }) => {
diff --git a/e2e/help-modal.spec.ts b/e2e/help-modal.spec.ts
index f18cbd6a95cba2..73ac222ed47a97 100644
--- a/e2e/help-modal.spec.ts
+++ b/e2e/help-modal.spec.ts
@@ -1,8 +1,6 @@
 import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.beforeEach(async ({ page }) => {
   await page.goto(
     '/learn/foundational-c-sharp-with-microsoft/write-your-first-code-using-c-sharp/write-your-first-c-sharp-code'
diff --git a/e2e/hotkeys.spec.ts b/e2e/hotkeys.spec.ts
index 596fb6155df3bb..7d59999ce138d2 100644
--- a/e2e/hotkeys.spec.ts
+++ b/e2e/hotkeys.spec.ts
@@ -46,8 +46,6 @@ const waitUntilHydrated = async (page: Page, pageId: PageId) => {
   await waitUntilListening(page);
 };
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.beforeAll(async ({ request }) => {
   await authedRequest({
     request,
diff --git a/e2e/image-picture-check.spec.ts b/e2e/image-picture-check.spec.ts
index c4d3671093da2b..4c4590605af7ab 100644
--- a/e2e/image-picture-check.spec.ts
+++ b/e2e/image-picture-check.spec.ts
@@ -1,8 +1,6 @@
 import { test, expect } from '@playwright/test';
 
 test.describe('Picture input field', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test.beforeEach(async ({ page }) => {
     await page.goto('/certifieduser');
 
diff --git a/e2e/internet-presence-settings.spec.ts b/e2e/internet-presence-settings.spec.ts
index dd2bbf0deefe9e..432e2e310ec964 100644
--- a/e2e/internet-presence-settings.spec.ts
+++ b/e2e/internet-presence-settings.spec.ts
@@ -12,8 +12,6 @@ const settingsPageElement = {
   internetPresenceForm: 'internet-presence'
 } as const;
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.beforeEach(async ({ page }) => {
   // Reset input values
   execSync('node ./tools/scripts/seed/seed-demo-user --certified-user');
diff --git a/e2e/learn.spec.ts b/e2e/learn.spec.ts
index 9ce0b901d347ce..e736e9270e8101 100644
--- a/e2e/learn.spec.ts
+++ b/e2e/learn.spec.ts
@@ -74,8 +74,6 @@ test.describe('Learn - Unauthenticated user', () => {
 });
 
 test.describe('Learn - Authenticated user)', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test('the page should render correctly', async ({ page }) => {
     await page.goto('/learn');
 
diff --git a/e2e/link-ms-user.spec.ts b/e2e/link-ms-user.spec.ts
index a3584404245467..9db82e41a52ac2 100644
--- a/e2e/link-ms-user.spec.ts
+++ b/e2e/link-ms-user.spec.ts
@@ -11,6 +11,7 @@ test.beforeEach(async ({ page }) => {
 });
 
 test.describe('Link MS user component (signed-out user)', () => {
+  test.use({ storageState: { cookies: [], origins: [] } });
   test('should display the page content with a signin CTA', async ({
     page
   }) => {
@@ -44,7 +45,6 @@ test.describe('Link MS user component (signed-in user)', () => {
   test.afterEach(() => {
     execSync('node ./tools/scripts/seed/seed-ms-username');
   });
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
 
   test("should recognize the user's MS account", async ({ page }) => {
     await expect(
diff --git a/e2e/mobile-layout.spec.ts b/e2e/mobile-layout.spec.ts
index 1256dbd8a59b24..fa354833588e0d 100644
--- a/e2e/mobile-layout.spec.ts
+++ b/e2e/mobile-layout.spec.ts
@@ -2,8 +2,6 @@ import { test, expect } from '@playwright/test';
 
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.describe('Classic challenge - 5 tabs mobile layout component', () => {
   test.skip(
     ({ isMobile }) => isMobile === false,
diff --git a/e2e/ms-trophy-show.spec.ts b/e2e/ms-trophy-show.spec.ts
index 6a38dbc89454d8..4bec2e7369431a 100644
--- a/e2e/ms-trophy-show.spec.ts
+++ b/e2e/ms-trophy-show.spec.ts
@@ -3,7 +3,7 @@ import translations from '../client/i18n/locales/english/translations.json';
 
 const verifyTrophyButtonText = translations.buttons['verify-trophy'];
 const askForHelpButtonText = translations.buttons['ask-for-help'];
-
+test.use({ storageState: { cookies: [], origins: [] } });
 test.beforeEach(async ({ page }) => {
   await page.goto(
     '/learn/foundational-c-sharp-with-microsoft/write-your-first-code-using-c-sharp/trophy-write-your-first-code-using-c-sharp'
diff --git a/e2e/multifile-cert-projects.spec.ts b/e2e/multifile-cert-projects.spec.ts
index 9f1e10fd52df2b..59b9707c3dc916 100644
--- a/e2e/multifile-cert-projects.spec.ts
+++ b/e2e/multifile-cert-projects.spec.ts
@@ -1,7 +1,6 @@
 import { execSync } from 'child_process';
 import { test, expect } from '@playwright/test';
 import { clearEditor, focusEditor } from './utils/editor';
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
 test.describe('multifileCertProjects', () => {
   test.beforeEach(async ({ page }) => {
     execSync('node ./tools/scripts/seed/seed-demo-user --certified-user');
diff --git a/e2e/navigation-from-last-challenge.spec.ts b/e2e/navigation-from-last-challenge.spec.ts
index 3bb60e9fb0a83b..5f0db32b15766a 100644
--- a/e2e/navigation-from-last-challenge.spec.ts
+++ b/e2e/navigation-from-last-challenge.spec.ts
@@ -22,7 +22,6 @@ const rwdChallenge = {
   nextUrl:
     '/learn/2022/responsive-web-design/#build-a-personal-portfolio-webpage-project'
 };
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
 test.describe('Navigation from the middle or end (URL solution)', () => {
   test('In the middle of a block should take you to the next challenge', async ({
     page
diff --git a/e2e/profile.spec.ts b/e2e/profile.spec.ts
index 66aa818e6cdaad..c4c1ab6f74e26c 100644
--- a/e2e/profile.spec.ts
+++ b/e2e/profile.spec.ts
@@ -83,7 +83,6 @@ const legacyCerts = [
 
 test.describe('Profile component', () => {
   test.describe('when viewing my own profile', () => {
-    test.use({ storageState: 'playwright/.auth/certified-user.json' });
     test.beforeEach(async ({ page }) => {
       await page.goto('/certifieduser');
 
@@ -207,8 +206,6 @@ test.describe('Profile component', () => {
     });
 
     test.describe('while logged in', () => {
-      test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
       test('displays the public username', async ({ page }) => {
         await expect(
           page.getByRole('heading', { name: '@publicuser' })
diff --git a/e2e/progress-bar.spec.ts b/e2e/progress-bar.spec.ts
index 905ba1df51814c..8d2e4615a128ef 100644
--- a/e2e/progress-bar.spec.ts
+++ b/e2e/progress-bar.spec.ts
@@ -1,8 +1,6 @@
 import { expect, test } from '@playwright/test';
 import { clearEditor, focusEditor } from './utils/editor';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.describe('Progress bar component', () => {
   test('Should appear with the correct content after the user has submitted their code', async ({
     page,
diff --git a/e2e/progress-reset-modal.spec.ts b/e2e/progress-reset-modal.spec.ts
index 2b01fe1a36529c..072802f58bf567 100644
--- a/e2e/progress-reset-modal.spec.ts
+++ b/e2e/progress-reset-modal.spec.ts
@@ -5,8 +5,6 @@ import translations from '../client/i18n/locales/english/translations.json';
 
 const execP = promisify(exec);
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.beforeEach(async ({ page }) => {
   await page.goto('/settings');
 });
diff --git a/e2e/quincy-email-sign-up.spec.ts b/e2e/quincy-email-sign-up.spec.ts
index bb3607f0d90682..f21431bbc5016b 100644
--- a/e2e/quincy-email-sign-up.spec.ts
+++ b/e2e/quincy-email-sign-up.spec.ts
@@ -92,8 +92,6 @@ test.describe('Email sign-up page when user is not signed in', () => {
 });
 
 test.describe('Email sign-up page when user is signed in', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test.beforeEach(async ({ page }) => {
     // It's necessary to seed with a user that has not accepted the privacy
     // terms, otherwise the user will be redirected away from the email sign-up
diff --git a/e2e/quiz-challenge.spec.ts b/e2e/quiz-challenge.spec.ts
index fb6509da0102bd..69e1f7bbde5869 100644
--- a/e2e/quiz-challenge.spec.ts
+++ b/e2e/quiz-challenge.spec.ts
@@ -6,8 +6,6 @@ test.describe('Quiz challenge', () => {
     'The FSD superblock is not available if SHOW_UPCOMING_CHANGES is false'
   );
 
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test.beforeEach(async ({ page }) => {
     await page.goto(
       '/learn/full-stack-developer/quiz-basic-html/quiz-basic-html'
diff --git a/e2e/report-user.spec.ts b/e2e/report-user.spec.ts
index 4aeacff4498163..0b6e02eca0bbf0 100644
--- a/e2e/report-user.spec.ts
+++ b/e2e/report-user.spec.ts
@@ -5,7 +5,6 @@ import {
   getFirstEmail,
   getSubject
 } from './utils/mailhog';
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
 
 test.beforeEach(async () => {
   await deleteAllEmails();
diff --git a/e2e/scrollbar-width.spec.ts b/e2e/scrollbar-width.spec.ts
index fbc65630df82e3..a28f72a757e44e 100644
--- a/e2e/scrollbar-width.spec.ts
+++ b/e2e/scrollbar-width.spec.ts
@@ -1,5 +1,5 @@
 import { test, expect } from '@playwright/test';
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
+
 test.describe('Editor scrollbar width', () => {
   test.beforeEach(async ({ page }) => {
     await page.goto('/settings');
diff --git a/e2e/settings.spec.ts b/e2e/settings.spec.ts
index fa25e0616d282a..6d515552958cc6 100644
--- a/e2e/settings.spec.ts
+++ b/e2e/settings.spec.ts
@@ -47,8 +47,6 @@ const legacyCertifications = [
 ];
 
 test.describe('Settings - Certified User', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test.beforeEach(async ({ page }) => {
     execSync('node ./tools/scripts/seed/seed-demo-user --certified-user');
     await page.goto('/settings');
@@ -262,8 +260,6 @@ test.describe('Settings - Certified User', () => {
 // Instead of simulating 6 cert claim flows,
 // we use the data of Certified User but remove the Full Stack cert.
 test.describe('Settings - Certified User without Full Stack Certification', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test.beforeEach(async ({ page }) => {
     execSync(
       'node ./tools/scripts/seed/seed-demo-user --certified-user --set-false isFullStackCert'
diff --git a/e2e/shortcuts-modal.spec.ts b/e2e/shortcuts-modal.spec.ts
index 34498b5912b08a..12629a62b94383 100644
--- a/e2e/shortcuts-modal.spec.ts
+++ b/e2e/shortcuts-modal.spec.ts
@@ -7,8 +7,6 @@ import { getEditors } from './utils/editor';
 const course =
   '/learn/javascript-algorithms-and-data-structures/basic-javascript/comment-your-javascript-code';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 const enableKeyboardShortcuts = async (request: APIRequestContext) => {
   const res = await authedRequest({
     request,
diff --git a/e2e/show-cert-from-superblock.spec.ts b/e2e/show-cert-from-superblock.spec.ts
index 69209ccea6a0b3..8cc6238112148d 100644
--- a/e2e/show-cert-from-superblock.spec.ts
+++ b/e2e/show-cert-from-superblock.spec.ts
@@ -32,8 +32,6 @@ test.describe('When the user HAS NOT claimed their cert', () => {
 });
 
 test.describe('When the user HAS claimed their cert', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test.beforeEach(async ({ page }) => {
     await page.goto('/learn/front-end-development-libraries');
   });
diff --git a/e2e/show-certificate-else.spec.ts b/e2e/show-certificate-else.spec.ts
index 42df08db40e55d..c6cb858a6c0502 100644
--- a/e2e/show-certificate-else.spec.ts
+++ b/e2e/show-certificate-else.spec.ts
@@ -2,6 +2,7 @@ import { test, expect, type Page } from '@playwright/test';
 
 test.describe('Show certification else', () => {
   let page: Page;
+  test.use({ storageState: { cookies: [], origins: [] } });
 
   test.beforeAll(async ({ browser }) => {
     page = await browser.newPage();
diff --git a/e2e/show-certificate-own.spec.ts b/e2e/show-certificate-own.spec.ts
index 1a5d98f96816d1..054c53e442f6c1 100644
--- a/e2e/show-certificate-own.spec.ts
+++ b/e2e/show-certificate-own.spec.ts
@@ -1,7 +1,5 @@
 import { test, expect, type Page } from '@playwright/test';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.describe('Show certification own', () => {
   let page: Page;
 
diff --git a/e2e/show.spec.ts b/e2e/show.spec.ts
index ec2c0229d8e64a..3492fb6ed9df11 100644
--- a/e2e/show.spec.ts
+++ b/e2e/show.spec.ts
@@ -40,8 +40,6 @@ test.describe('Odin challenges', () => {
   });
 
   test.describe('When the user is signed in', () => {
-    test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
     test('should render the content correctly', async ({ page }) => {
       await expect(page).toHaveTitle(
         'Write Your First Code Using C# - Write Your First C# Code | Learn | freeCodeCamp.org'
diff --git a/e2e/signin.spec.ts b/e2e/signin.spec.ts
index 71651b49a1c630..d0aba09a3985c6 100644
--- a/e2e/signin.spec.ts
+++ b/e2e/signin.spec.ts
@@ -1,6 +1,7 @@
 import { test, expect } from '@playwright/test';
 
 test.describe('signing in', () => {
+  test.use({ storageState: { cookies: [], origins: [] } });
   test('welcomes the user', async ({ page }) => {
     const welcomeText = 'Welcome back, Full Stack User.';
     await page.goto('/learn');
diff --git a/e2e/signout-modal.spec.ts b/e2e/signout-modal.spec.ts
index 1f9d638312481b..9f9e30126fe94a 100644
--- a/e2e/signout-modal.spec.ts
+++ b/e2e/signout-modal.spec.ts
@@ -1,8 +1,6 @@
 import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.beforeEach(async ({ page }) => {
   await page.goto('/');
 });
diff --git a/e2e/solution-viewer.spec.ts b/e2e/solution-viewer.spec.ts
index 1d2b30fe145d68..0b292fd6e675ed 100644
--- a/e2e/solution-viewer.spec.ts
+++ b/e2e/solution-viewer.spec.ts
@@ -1,7 +1,5 @@
 import { test, expect } from '@playwright/test';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.describe('Solution Viewer component', () => {
   test('renders the modal correctly', async ({ page }) => {
     await page.goto(
diff --git a/e2e/third-party-donation.spec.ts b/e2e/third-party-donation.spec.ts
index 9e6cd1ad284388..a086c48cbcc616 100644
--- a/e2e/third-party-donation.spec.ts
+++ b/e2e/third-party-donation.spec.ts
@@ -5,7 +5,6 @@ import stripeJson from './fixtures/donation/stripe.json';
 import { alertToBeVisible } from './utils/alerts';
 
 test.describe('third-party donation tests', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
   test.beforeEach(async ({ page }) => {
     await page.goto('/donate');
   });
diff --git a/e2e/update-about-me.spec.ts b/e2e/update-about-me.spec.ts
index de50e0d6fcfacb..750ba359a18e97 100644
--- a/e2e/update-about-me.spec.ts
+++ b/e2e/update-about-me.spec.ts
@@ -2,8 +2,6 @@ import { execSync } from 'child_process';
 import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
 test.beforeEach(async ({ page }) => {
   execSync(
     'node ./tools/scripts/seed/seed-demo-user --certified-user --set-false isFullStackCert'
diff --git a/e2e/update-email.spec.ts b/e2e/update-email.spec.ts
index 0ed02e8f9d64b8..43435001f7dc8f 100644
--- a/e2e/update-email.spec.ts
+++ b/e2e/update-email.spec.ts
@@ -2,8 +2,6 @@ import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
 test.describe('The update-email page when the user is signed in', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
-
   test.beforeEach(async ({ page }) => {
     await page.goto('/update-email');
   });
diff --git a/e2e/update-stripe-card-default.spec.ts b/e2e/update-stripe-card-default.spec.ts
index a37a70e8e1121e..a4067e47803bd8 100644
--- a/e2e/update-stripe-card-default.spec.ts
+++ b/e2e/update-stripe-card-default.spec.ts
@@ -2,7 +2,6 @@ import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
 
 test.describe('Update Card Page for Non-Donor Authenticated User', () => {
-  test.use({ storageState: 'playwright/.auth/certified-user.json' });
   test('should render correctly', async ({ page }) => {
     await page.goto('/update-stripe-card');
     await expect(page).toHaveTitle(
diff --git a/e2e/username-change.spec.ts b/e2e/username-change.spec.ts
index 0b0d2ff8546b6b..201d3788fb55b2 100644
--- a/e2e/username-change.spec.ts
+++ b/e2e/username-change.spec.ts
@@ -1,7 +1,6 @@
 import { execSync } from 'child_process';
 import { test, expect } from '@playwright/test';
 import translations from '../client/i18n/locales/english/translations.json';
-test.use({ storageState: 'playwright/.auth/certified-user.json' });
 
 test.afterAll(() => {
   // change the name back to the original