This commit is contained in:
2025-12-01 19:28:49 +01:00
parent 98a09a3f2b
commit 086fdc1ea1
8 changed files with 406 additions and 86 deletions

View File

@@ -105,4 +105,55 @@ describeMaybe('Real-site hosted session smoke login and wizard entry (member
},
300_000,
);
it(
'detects login guard and does not attempt Create a Race when not authenticated',
async () => {
const step1Result = await adapter.executeStep(StepId.create(1), {});
expect(step1Result.success).toBe(true);
const page = adapter.getPage();
expect(page).not.toBeNull();
const currentUrl = page!.url();
expect(currentUrl).not.toEqual('about:blank');
expect(currentUrl.toLowerCase()).toContain('iracing');
expect(currentUrl.toLowerCase()).toSatisfy((u: string) =>
u.includes('oauth.iracing.com') ||
u.includes('members.iracing.com') ||
u.includes('/login'),
);
const emailInput = page!
.locator(IRACING_SELECTORS.login.emailInput)
.first();
const passwordInput = page!
.locator(IRACING_SELECTORS.login.passwordInput)
.first();
const hasEmail = (await emailInput.count()) > 0;
const hasPassword = (await passwordInput.count()) > 0;
if (!hasEmail && !hasPassword) {
return;
}
await emailInput.waitFor({
state: 'visible',
timeout: IRACING_TIMEOUTS.elementWait,
});
await passwordInput.waitFor({
state: 'visible',
timeout: IRACING_TIMEOUTS.elementWait,
});
const createRaceButton = page!
.locator(IRACING_SELECTORS.hostedRacing.createRaceButton)
.first();
const createRaceCount = await createRaceButton.count();
expect(createRaceCount).toBe(0);
},
300_000,
);
});