verify browser account data isolation

This commit is contained in:
2026-09-06 19:32:39 +03:00
parent 24898f8384
commit e3e9c2d35a
4 changed files with 52 additions and 0 deletions
+32
View File
@@ -39,6 +39,24 @@ try {
await page.getByLabel('Ciro hedefi (TL)', { exact: true }).waitFor({ state: 'attached', timeout: 10_000 });
evidence.checks.analyticsTargetLabel = await page.getByLabel('Ciro hedefi (TL)', { exact: true }).count() === 1;
if (!evidence.checks.analyticsTargetLabel) throw new Error('Analitik ciro hedefi alanı erişilebilir ad taşımıyor.');
const primaryTarget = page.getByLabel('Ciro hedefi (TL)', { exact: true });
await primaryTarget.fill('1250');
await page.waitForFunction(() => localStorage.getItem('ihaleist_ciro_hedefi:browser-qa%40example.test') === '1250');
await page.goto(`${url.replace(/\/qa-signin$/, '')}/qa-switch-account?account=other`, { waitUntil: 'networkidle' });
await page.getByRole('button', { name: 'Pazar', exact: true }).click();
await page.getByRole('button', { name: 'Analitik Dashboard', exact: true }).click();
await page.getByLabel('Ciro hedefi (TL)', { exact: true }).waitFor({ state: 'attached', timeout: 10_000 });
evidence.checks.accountScopedAnalyticsTarget = await page.getByLabel('Ciro hedefi (TL)', { exact: true }).inputValue() === '';
if (!evidence.checks.accountScopedAnalyticsTarget) throw new Error('İkinci hesap ilk hesabın ciro hedefini devraldı.');
await page.getByLabel('Ciro hedefi (TL)', { exact: true }).fill('980');
await page.waitForFunction(() => localStorage.getItem('ihaleist_ciro_hedefi:browser-qa-other%40example.test') === '980');
await page.goto(`${url.replace(/\/qa-signin$/, '')}/qa-switch-account?account=primary`, { waitUntil: 'networkidle' });
await page.getByRole('button', { name: 'Pazar', exact: true }).click();
await page.getByRole('button', { name: 'Analitik Dashboard', exact: true }).click();
await page.getByRole('button', { name: 'Ciro hedefini düzenle', exact: true }).click();
await page.getByLabel('Ciro hedefi (TL)', { exact: true }).waitFor({ state: 'attached', timeout: 10_000 });
evidence.checks.primaryAnalyticsTargetRestored = await page.getByLabel('Ciro hedefi (TL)', { exact: true }).inputValue() === '1250';
if (!evidence.checks.primaryAnalyticsTargetRestored) throw new Error('İlk hesabın ciro hedefi hesap değişiminden sonra geri yüklenmedi.');
await page.getByRole('button', { name: 'Keşfet', exact: true }).click();
await page.getByRole('button', { name: 'İhale Takvimi' }).click();
await page.waitForLoadState('networkidle');
@@ -55,6 +73,20 @@ try {
await page.getByRole('button', { name: 'İhale Takvimi' }).click();
evidence.checks.icsPersistsAfterTabChange = await page.getByText('1 harici etkinlik içe aktarıldı.', { exact: true }).count() === 1;
if (!evidence.checks.icsPersistsAfterTabChange) throw new Error('ICS kaydı sekme değişiminden sonra korunmadı.');
await page.goto(`${url.replace(/\/qa-signin$/, '')}/qa-switch-account?account=other`, { waitUntil: 'networkidle' });
await page.getByRole('button', { name: 'Keşfet' }).click();
await page.getByRole('button', { name: 'İhale Takvimi' }).click();
evidence.checks.accountScopedIcs = await page.getByText('1 harici etkinlik içe aktarıldı.', { exact: true }).count() === 0;
if (!evidence.checks.accountScopedIcs) throw new Error('İkinci hesap ilk hesabın ICS etkinliğini devraldı.');
await page.goto(`${url.replace(/\/qa-signin$/, '')}/qa-switch-account?account=primary`, { waitUntil: 'networkidle' });
await page.getByRole('button', { name: 'Keşfet' }).click();
await page.getByRole('button', { name: 'İhale Takvimi' }).click();
await page.getByText('1 harici etkinlik içe aktarıldı.', { exact: true }).waitFor({ state: 'attached', timeout: 10_000 });
evidence.checks.primaryIcsRestored = await page.getByText('1 harici etkinlik içe aktarıldı.', { exact: true }).count() === 1;
if (!evidence.checks.primaryIcsRestored) {
const storage = await page.evaluate(() => Object.fromEntries(Object.keys(sessionStorage).map(key => [key, sessionStorage.getItem(key)])));
throw new Error(`İlk hesabın ICS etkinliği hesap değişiminden sonra geri yüklenmedi: ${JSON.stringify(storage)}`);
}
} finally { await rm(icsDir, { recursive: true, force: true }); }
const readyPage = await context.newPage();
await readyPage.setViewportSize({ width: 1440, height: 1000 });