Restore scratch setup bootstrap and live frontdoor sweep
This commit is contained in:
@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';
|
||||
|
||||
import { chromium } from 'playwright';
|
||||
|
||||
import { authenticateFrontdoor } from './live-frontdoor-auth.mjs';
|
||||
import { authenticateFrontdoor, createAuthenticatedContext } from './live-frontdoor-auth.mjs';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
@@ -21,23 +21,14 @@ const REPORT_PATH = path.join(outputDirectory, 'live-frontdoor-auth-report.json'
|
||||
const RESULT_PATH = path.join(outputDirectory, 'live-releases-deployments-check.json');
|
||||
|
||||
async function seedAuthenticatedPage(browser, authReport) {
|
||||
const context = await browser.newContext({
|
||||
ignoreHTTPSErrors: true,
|
||||
acceptDownloads: true,
|
||||
storageState: STATE_PATH,
|
||||
const context = await createAuthenticatedContext(browser, authReport, {
|
||||
statePath: STATE_PATH,
|
||||
contextOptions: {
|
||||
acceptDownloads: true,
|
||||
},
|
||||
});
|
||||
const page = await context.newPage();
|
||||
|
||||
await page.goto(`${BASE_URL}/welcome`, { waitUntil: 'domcontentloaded', timeout: 30_000 });
|
||||
await page.evaluate((storage) => {
|
||||
sessionStorage.clear();
|
||||
for (const [key, value] of storage.sessionStorageEntries ?? []) {
|
||||
if (typeof key === 'string' && typeof value === 'string') {
|
||||
sessionStorage.setItem(key, value);
|
||||
}
|
||||
}
|
||||
}, authReport.storage);
|
||||
|
||||
await page.goto(LIST_URL, { waitUntil: 'networkidle', timeout: 30_000 });
|
||||
return { context, page };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user