@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
2
2
import { clientUrl } from "../utils.ts" ;
3
3
4
4
const COOKIE_CONSENT_MESSAGE = 'We use cookies to ensure you get the best experience on DANDI.' ;
5
- // const COOKIE_DISABLED_MESSAGE = 'We noticed you\'re blocking cookies - note that certain aspects of the site may not work.';
5
+ const COOKIE_DISABLED_MESSAGE = 'We noticed you\'re blocking cookies - note that certain aspects of the site may not work.' ;
6
6
7
7
test . describe ( "Cookie banner behavior" , async ( ) => {
8
8
test ( "cookie banner when cookies are enabled" , async ( { page } ) => {
@@ -11,19 +11,15 @@ test.describe("Cookie banner behavior", async () => {
11
11
await page . getByText ( "Got it!" ) . click ( ) ;
12
12
await expect ( page . getByText ( COOKIE_CONSENT_MESSAGE ) ) . toHaveCount ( 0 ) ;
13
13
} ) ;
14
- // See: https://github.com/dandi/dandi-archive/issues/2271
15
- //
16
- // test("cookie banner when cookies are disabled", async ({ page }) => {
17
- // Patch navigator.cookieEnabled. This is the condition used to determine which
18
- // cookie banner message to show the end user.
14
+ test ( "cookie banner when cookies are disabled" , async ( { page } ) => {
19
15
// https://github.com/microsoft/playwright/issues/30115#issuecomment-2020821987
20
- // await page.addInitScript(() => {
21
- // Object.defineProperty(navigator.__proto__, "cookieEnabled", { get: () => false });
22
- // });
23
- // await page.goto(clientUrl);
16
+ await page . addInitScript ( ( ) => {
17
+ Object . defineProperty ( navigator . __proto__ , "cookieEnabled" , { get : ( ) => false } ) ;
18
+ } ) ;
19
+ await page . goto ( clientUrl ) ;
24
20
25
- // await expect(page.getByText(COOKIE_DISABLED_MESSAGE)).toHaveCount(1);
26
- // await page.getByText("Got it!").click();
27
- // await expect(page.getByText(COOKIE_CONSENT_MESSAGE)).toHaveCount(0);
28
- // });
21
+ await expect ( page . getByText ( COOKIE_DISABLED_MESSAGE ) ) . toHaveCount ( 1 ) ;
22
+ await page . getByText ( "Got it!" ) . click ( ) ;
23
+ await expect ( page . getByText ( COOKIE_CONSENT_MESSAGE ) ) . toHaveCount ( 0 ) ;
24
+ } ) ;
29
25
} ) ;
0 commit comments