test: update sameSite cookie expectations on WebKit Win (#8138)

This commit is contained in:
Yury Semikhatsky 2021-08-11 10:27:41 -07:00 committed by GitHub
parent 7c017a6c1f
commit e9e3349e2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 15 deletions

View File

@ -221,7 +221,7 @@ it('should set cookie with reasonable defaults', async ({context, server, browse
}]);
});
it('should set a cookie with a path', async ({context, page, server}) => {
it('should set a cookie with a path', async ({context, page, server, browserName, isWindows}) => {
await page.goto(server.PREFIX + '/grid.html');
await context.addCookies([{
domain: 'localhost',
@ -238,7 +238,7 @@ it('should set a cookie with a path', async ({context, page, server}) => {
expires: -1,
httpOnly: false,
secure: false,
sameSite: 'Lax',
sameSite: (browserName === 'webkit' && isWindows) ? 'None' : 'Lax',
}]);
expect(await page.evaluate('document.cookie')).toBe('gridcookie=GRID');
await page.goto(server.EMPTY_PAGE);
@ -296,7 +296,7 @@ it('should be able to set unsecure cookie for HTTP website', async ({context, pa
expect(cookie.secure).toBe(false);
});
it('should set a cookie on a different domain', async ({context, page, server}) => {
it('should set a cookie on a different domain', async ({context, page, server, browserName, isWindows}) => {
await page.goto(server.EMPTY_PAGE);
await context.addCookies([{
url: 'https://www.example.com',
@ -313,7 +313,7 @@ it('should set a cookie on a different domain', async ({context, page, server})
expires: -1,
httpOnly: false,
secure: true,
sameSite: 'Lax',
sameSite: (browserName === 'webkit' && isWindows) ? 'None' : 'Lax',
}]);
});

View File

@ -132,7 +132,7 @@ it('should get multiple cookies', async ({context, page, server, browserName}) =
]));
});
it('should get cookies from multiple urls', async ({context}) => {
it('should get cookies from multiple urls', async ({context, browserName, isWindows}) => {
await context.addCookies([{
url: 'https://foo.com',
name: 'doggo',
@ -158,7 +158,7 @@ it('should get cookies from multiple urls', async ({context}) => {
expires: -1,
httpOnly: false,
secure: true,
sameSite: 'Lax',
sameSite: (browserName === 'webkit' && isWindows) ? 'None' : 'Lax',
}, {
name: 'doggo',
value: 'woofs',
@ -171,7 +171,7 @@ it('should get cookies from multiple urls', async ({context}) => {
}]));
});
it('should work with subdomain cookie', async ({context, page, server}) => {
it('should work with subdomain cookie', async ({context, browserName, isWindows}) => {
await context.addCookies([{
domain: '.foo.com',
path: '/',
@ -188,7 +188,7 @@ it('should work with subdomain cookie', async ({context, page, server}) => {
expires: -1,
httpOnly: false,
secure: true,
sameSite: 'Lax',
sameSite: (browserName === 'webkit' && isWindows) ? 'None' : 'Lax',
}]);
expect(await context.cookies('https://sub.foo.com')).toEqual([{
name: 'doggo',
@ -198,7 +198,7 @@ it('should work with subdomain cookie', async ({context, page, server}) => {
expires: -1,
httpOnly: false,
secure: true,
sameSite: 'Lax',
sameSite: (browserName === 'webkit' && isWindows) ? 'None' : 'Lax',
}]);
});
@ -212,7 +212,7 @@ it('should not return cookies with empty value', async ({context, page, server})
expect(cookies.length).toBe(0);
});
it('should return secure cookies based on HTTP(S) protocol', async ({context}) => {
it('should return secure cookies based on HTTP(S) protocol', async ({context, browserName, isWindows}) => {
await context.addCookies([{
url: 'https://foo.com',
name: 'doggo',
@ -235,7 +235,7 @@ it('should return secure cookies based on HTTP(S) protocol', async ({context}) =
expires: -1,
httpOnly: false,
secure: false,
sameSite: 'Lax',
sameSite: (browserName === 'webkit' && isWindows) ? 'None' : 'Lax',
}, {
name: 'doggo',
value: 'woofs',
@ -244,7 +244,7 @@ it('should return secure cookies based on HTTP(S) protocol', async ({context}) =
expires: -1,
httpOnly: false,
secure: true,
sameSite: 'Lax',
sameSite: (browserName === 'webkit' && isWindows) ? 'None' : 'Lax',
}]));
expect(await context.cookies('http://foo.com/')).toEqual([{
name: 'catto',
@ -254,6 +254,6 @@ it('should return secure cookies based on HTTP(S) protocol', async ({context}) =
expires: -1,
httpOnly: false,
secure: false,
sameSite: 'Lax',
sameSite: (browserName === 'webkit' && isWindows) ? 'None' : 'Lax',
}]);
});

View File

@ -39,7 +39,7 @@ it('context.cookies() should work', async ({server, launchPersistent, browserNam
}]);
});
it('context.addCookies() should work', async ({server, launchPersistent}) => {
it('context.addCookies() should work', async ({server, launchPersistent, browserName, isWindows}) => {
const {page} = await launchPersistent();
await page.goto(server.EMPTY_PAGE);
await page.context().addCookies([{
@ -57,7 +57,7 @@ it('context.addCookies() should work', async ({server, launchPersistent}) => {
expires: -1,
httpOnly: false,
secure: false,
sameSite: 'Lax',
sameSite: (browserName === 'webkit' && isWindows) ? 'None' : 'Lax',
}]);
});