-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.ts
38 lines (27 loc) · 910 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* Arquivo: demo-03/index.ts
* Data: 01/05/2021
* Descrição: arquivo responsável por realizar a demo automatizando testes usando o Playwright com TypeScript
* Autora: Glaucia Lemos
* Twitter: <@glaucia_lemos86>
*/
import * as playwright from 'playwright';
async function main() {
const { chromium, firefox, webkit } = playwright;
for (const browserType of [chromium, webkit, firefox]) {
// Launch the Browser:
const browser = await playwright.chromium.launch({
headless: false
});
// Create a await context.close();
const context = await browser.newContext();
// Create the Page:
const page = await context.newPage();
// Some actions
await page.goto('https://glaucialemos.netlify.app/');
await page.screenshot({ path: `demo-03/screenshots/${browserType.name()}.png` });
// Close the browser:
await browser.close();
}
}
main();