home.e2e.js 639 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
    await page.waitForSelector('#logo h1');
valleykid's avatar
valleykid committed
14
    const text = await page.evaluate(() => document.body.innerHTML);
afc163's avatar
afc163 committed
15
    expect(text).toContain('<h1>Ant Design Pro</h1>');
valleykid's avatar
valleykid committed
16 17
    await page.close();
    browser.close();
afc163's avatar
afc163 committed
18 19
  });
});