annotate context type, defaultTimeout 30s -> 10s

This commit is contained in:
Ralf Vogler 2021-12-28 18:26:27 +01:00
parent 567365e46c
commit 83a4b064bd
2 changed files with 5 additions and 2 deletions

View file

@ -1,3 +1,4 @@
//@ts-check
const { existsSync } = require('fs');
if (!existsSync('auth.json')) {
console.error('Missing auth.json! Run `npm login` to login and create this file by closing the opened browser.');
@ -50,10 +51,12 @@ const newStealthContext = async (browser, contextOptions = {}) => {
channel: 'chrome',
headless: false,
});
/** @type {import('playwright').BrowserContext} */
const context = await newStealthContext(browser, {
storageState: 'auth.json',
viewport: { width: 1280, height: 1280 },
});
context.setDefaultTimeout(10000);
const page = await context.newPage();
await page.goto('https://www.epicgames.com/store/en-US/free-games');
// await expect(page.locator('a[role="button"]:has-text("Sign In")')).toHaveCount(0);