-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsamples.spec.ts
More file actions
34 lines (29 loc) · 871 Bytes
/
samples.spec.ts
File metadata and controls
34 lines (29 loc) · 871 Bytes
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
import * as puppeteer from "puppeteer";
let page: any;
let browser: any;
describe("Sandbox", () => {
beforeAll(async () => {
browser = await puppeteer.launch({args: ['--no-sandbox'],});
page = await browser.newPage();
console.log(process.env.APP_URL)
await page
.goto(process.env.APP_URL, {
waitUntil: "networkidle0",
})
// tslint:disable-next-line:no-empty
.catch(() => {});
});
afterAll(() => {
if (!page.isClosed()) {
browser.close();
}
});
test("should see the landing page", async () => {
await page.waitForSelector("h1");
const title = await page.$eval("h1", (el: { textContent: any }) => {
return el.textContent;
});
expect(await page.title()).toEqual("CloudHarness sample application");
expect(title).toEqual("Sample React application is working!");
});
});