Skip to content

Commit 69bf0df

Browse files
authored
fix expires date in playwright addCookies (#796)
1 parent 38fbdf3 commit 69bf0df

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/playwright-utils.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,14 @@ export const test = base.extend<{
9494
authSession.set(sessionKey, session.id)
9595
const cookieConfig = setCookieParser.parseString(
9696
await authSessionStorage.commitSession(authSession),
97-
) as any
98-
await page
99-
.context()
100-
.addCookies([{ ...cookieConfig, domain: 'localhost' }])
97+
)
98+
const newConfig = {
99+
...cookieConfig,
100+
domain: 'localhost',
101+
expires: cookieConfig.expires?.getTime(),
102+
sameSite: cookieConfig.sameSite as 'Strict' | 'Lax' | 'None',
103+
}
104+
await page.context().addCookies([newConfig])
101105
return user
102106
})
103107
await prisma.user.deleteMany({ where: { id: userId } })

0 commit comments

Comments
 (0)