wip
This commit is contained in:
@@ -4,7 +4,7 @@ import { PlaywrightAuthSessionService } from '../../../../packages/automation/in
|
||||
import type { PlaywrightBrowserSession } from '../../../../packages/automation/infrastructure/adapters/automation/core/PlaywrightBrowserSession';
|
||||
import type { SessionCookieStore } from '../../../../packages/automation/infrastructure/adapters/automation/auth/SessionCookieStore';
|
||||
import type { IPlaywrightAuthFlow } from '../../../../packages/automation/infrastructure/adapters/automation/auth/PlaywrightAuthFlow';
|
||||
import type { ILogger } from '../../../../packages/automation/application/ports/ILogger';
|
||||
import type { LoggerPort as ILogger } from '../../../../packages/automation/application/ports/LoggerPort';
|
||||
import { AuthenticationState } from '@gridpilot/automation/domain/value-objects/AuthenticationState';
|
||||
import { Result } from '../../../../packages/shared/result/Result';
|
||||
|
||||
@@ -25,6 +25,9 @@ describe('PlaywrightAuthSessionService.initiateLogin browser mode behaviour', ()
|
||||
info: vi.fn(),
|
||||
warn: vi.fn(),
|
||||
error: vi.fn(),
|
||||
fatal: vi.fn(),
|
||||
child: vi.fn(),
|
||||
flush: vi.fn().mockResolvedValue(undefined),
|
||||
};
|
||||
|
||||
mockPage = {
|
||||
@@ -107,7 +110,7 @@ describe('PlaywrightAuthSessionService.initiateLogin browser mode behaviour', ()
|
||||
}),
|
||||
);
|
||||
|
||||
const calledUrl = (mockPage.goto as unknown as ReturnType<typeof vi.fn>).mock.calls[0][0] as string;
|
||||
const calledUrl = (mockPage.goto as unknown as ReturnType<typeof vi.fn>).mock.calls[0]![0] as string;
|
||||
expect(calledUrl).not.toEqual('about:blank');
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { Page, Locator } from 'playwright';
|
||||
import { PlaywrightAuthSessionService } from '../../../../packages/automation/infrastructure/adapters/automation/auth/PlaywrightAuthSessionService';
|
||||
import { AuthenticationState } from '@gridpilot/automation/domain/value-objects/AuthenticationState';
|
||||
import { BrowserAuthenticationState } from '@gridpilot/automation/domain/value-objects/BrowserAuthenticationState';
|
||||
import type { ILogger } from '../../../../packages/automation/application/ports/ILogger';
|
||||
import type { LoggerPort as ILogger } from '../../../../packages/automation/application/ports/LoggerPort';
|
||||
import type { Result } from '../../../../packages/shared/result/Result';
|
||||
import type { PlaywrightBrowserSession } from '../../../../packages/automation/infrastructure/adapters/automation/core/PlaywrightBrowserSession';
|
||||
import type { SessionCookieStore } from '../../../../packages/automation/infrastructure/adapters/automation/auth/SessionCookieStore';
|
||||
@@ -21,6 +21,9 @@ describe('PlaywrightAuthSessionService.verifyPageAuthentication', () => {
|
||||
info: vi.fn(),
|
||||
warn: vi.fn(),
|
||||
error: vi.fn(),
|
||||
fatal: vi.fn(),
|
||||
child: vi.fn(),
|
||||
flush: vi.fn().mockResolvedValue(undefined),
|
||||
};
|
||||
|
||||
const mockLocator: Locator = {
|
||||
|
||||
@@ -197,7 +197,7 @@ describe('SessionCookieStore - Cookie Validation', () => {
|
||||
const validCookies = cookieStore.getValidCookiesForUrl(targetUrl);
|
||||
|
||||
expect(validCookies).toHaveLength(1);
|
||||
expect(validCookies[0].name).toBe('valid_cookie');
|
||||
expect(validCookies[0]!.name).toBe('valid_cookie');
|
||||
});
|
||||
|
||||
test('should filter out cookies with mismatched domains', async () => {
|
||||
@@ -228,7 +228,7 @@ describe('SessionCookieStore - Cookie Validation', () => {
|
||||
const validCookies = cookieStore.getValidCookiesForUrl(targetUrl);
|
||||
|
||||
expect(validCookies).toHaveLength(1);
|
||||
expect(validCookies[0].name).toBe('cookie1');
|
||||
expect(validCookies[0]!.name).toBe('cookie1');
|
||||
});
|
||||
|
||||
test('should filter out cookies with invalid paths', async () => {
|
||||
@@ -259,7 +259,7 @@ describe('SessionCookieStore - Cookie Validation', () => {
|
||||
const validCookies = cookieStore.getValidCookiesForUrl(targetUrl);
|
||||
|
||||
expect(validCookies).toHaveLength(1);
|
||||
expect(validCookies[0].name).toBe('valid_path_cookie');
|
||||
expect(validCookies[0]!.name).toBe('valid_path_cookie');
|
||||
});
|
||||
|
||||
test('should return empty array when no cookies are valid', async () => {
|
||||
|
||||
Reference in New Issue
Block a user