diff --git a/__tests__/index.html b/__tests__/index.html new file mode 100644 index 0000000000000000000000000000000000000000..15175ea0c42ccc59a6c5004f3a3eed97d2fcde0b --- /dev/null +++ b/__tests__/index.html @@ -0,0 +1,5 @@ +<!doctype html> +<html> + <head><title>hello</title></head + <body><p>text <a href="https://example.org/">and a link</a></p></body> +</html> diff --git a/__tests__/main.js b/__tests__/main.js index 9bd29d47ab681ee28868497e5bd512963fa676be..20e63dd1256daebf8cbd5c688d54e54555c0cb10 100644 --- a/__tests__/main.js +++ b/__tests__/main.js @@ -15,20 +15,20 @@ describe('Open example', () => { describe('Open local HTTP server', () => { beforeAll(async () => { - let response = await page.goto('http://127.0.0.1:4488'); + let response = await page.goto('http://127.0.0.1:4488/__tests__/index.html'); expect(response.status()).toBe(200); }); it('has the correct page title', async () => { const title = await page.title(); - expect(title).toBe('Index of /'); + expect(title).toBe('hello'); }); it('has the correct link', async () => { - await page.waitForSelector('a[href="./jest.json"]'); - await expect(page).toMatchElement('a[href="./jest.json"]'); + await page.waitForSelector('a[href="https://example.org/"]'); + await expect(page).toMatchElement('a[href="https://example.org/"]'); }); }); -describe('Open example', () => { +describe('Open example bis', () => { beforeAll(async () => { let response = await page.goto('https://example.org'); expect(response.status()).toBe(200); @@ -43,17 +43,17 @@ describe('Open example', () => { }); }); -describe('Open local HTTP server', () => { +describe('Open local HTTP server bis', () => { beforeAll(async () => { - let response = await page.goto('http://127.0.0.1:4488'); + let response = await page.goto('http://127.0.0.1:4488/__tests__/index.html'); expect(response.status()).toBe(200); }); it('has the correct page title', async () => { const title = await page.title(); - expect(title).toBe('Index of /'); + expect(title).toBe('hello'); }); it('has the correct link', async () => { - await page.waitForSelector('a[href="./jest.json"]'); - await expect(page).toMatchElement('a[href="./jest.json"]'); + await page.waitForSelector('a[href="https://example.org/"]'); + await expect(page).toMatchElement('a[href="https://example.org/"]'); }); });