home.e2e.js 577 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 6
describe('Homepage', () => {
  it('it should have logo text', async () => {
jim's avatar
jim committed
7
    const browser = await puppeteer.launch({ args: ['--no-sandbox'] });
valleykid's avatar
valleykid committed
8
    const page = await browser.newPage();
9
    await page.goto(BASE_URL, { waitUntil: 'networkidle2' });
10
    await page.waitForSelector('#logo h1');
valleykid's avatar
valleykid committed
11
    const text = await page.evaluate(() => document.body.innerHTML);
afc163's avatar
afc163 committed
12
    expect(text).toContain('<h1>Ant Design Pro</h1>');
valleykid's avatar
valleykid committed
13 14
    await page.close();
    browser.close();
afc163's avatar
afc163 committed
15 16
  });
});