1c4a7b5ef9
📁 Files changed: 21 📝 Lines changed: 749 • browser.d.ts • browser.d.ts.map • browser.js • browser.js.map • mcp.js • mcp.js.map • safari.d.ts • safari.d.ts.map • safari.js • safari.js.map • safari.test.d.ts • safari.test.d.ts.map • safari.test.js • safari.test.js.map • types.d.ts • types.d.ts.map • browser.ts • mcp.ts • safari.test.ts • safari.ts • types.ts
41 lines
1.6 KiB
JavaScript
41 lines
1.6 KiB
JavaScript
import { describe, expect, it } from 'vitest';
|
|
import { toPlaywrightCookie } from './safari.js';
|
|
describe('safari', () => {
|
|
describe('toPlaywrightCookie', () => {
|
|
it('should convert SafariCookie to Playwright format', () => {
|
|
const safariCookie = {
|
|
name: 'session_id',
|
|
value: 'abc123',
|
|
domain: '.example.com',
|
|
path: '/',
|
|
expires: 1735689600, // 2025-01-01
|
|
secure: true,
|
|
httpOnly: true,
|
|
};
|
|
const result = toPlaywrightCookie(safariCookie);
|
|
expect(result.name).toBe('session_id');
|
|
expect(result.value).toBe('abc123');
|
|
expect(result.domain).toBe('.example.com');
|
|
expect(result.path).toBe('/');
|
|
expect(result.expires).toBe(1735689600);
|
|
expect(result.secure).toBe(true);
|
|
expect(result.httpOnly).toBe(true);
|
|
expect(result.sameSite).toBe('None'); // Secure cookies get SameSite=None
|
|
});
|
|
it('should set SameSite to Lax for non-secure cookies', () => {
|
|
const safariCookie = {
|
|
name: 'tracking',
|
|
value: 'xyz',
|
|
domain: 'example.com',
|
|
path: '/',
|
|
expires: 1735689600,
|
|
secure: false,
|
|
httpOnly: false,
|
|
};
|
|
const result = toPlaywrightCookie(safariCookie);
|
|
expect(result.secure).toBe(false);
|
|
expect(result.sameSite).toBe('Lax');
|
|
});
|
|
});
|
|
});
|
|
//# sourceMappingURL=safari.test.js.map
|