home.e2e.js 612 Bytes
Newer Older
valleykid's avatar
valleykid committed
1
import puppeteer from 'puppeteer';
afc163's avatar
afc163 committed
2

3 4
const BASE_URL = `http://localhost:${process.env.PORT || 8000}`;

afc163's avatar
afc163 committed
5
describe('Homepage', () => {
ι™ˆεΈ…'s avatar
ι™ˆεΈ… committed
6 7 8
  beforeAll(async () => {
    jest.setTimeout(1000000);
  });
afc163's avatar
afc163 committed
9
  it('it should have logo text', async () => {
jim's avatar
jim committed
10
    const browser = await puppeteer.launch({ args: ['--no-sandbox'] });
valleykid's avatar
valleykid committed
11
    const page = await browser.newPage();
12
    await page.goto(BASE_URL, { waitUntil: 'networkidle2' });
13 14 15
    const text = await page.evaluate(() => document.getElementsByTagName('h1')[0].innerText);
    expect(text).toContain('Ant Design Pro');

valleykid's avatar
valleykid committed
16 17
    await page.close();
    browser.close();
afc163's avatar
afc163 committed
18 19
  });
});