Skip to content
This repository has been archived by the owner on Feb 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #295 from multinet-app/puppeteer-timeout
Browse files Browse the repository at this point in the history
Add a timeout to puppeteer
  • Loading branch information
JackWilb committed Feb 4, 2020
2 parents c212843 + 47bf1f3 commit 8381691
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions client/test/e2e.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ function browser(width, height) {
});
}

// Sets up the browser with some default settings
async function setup() {
const b = await browser(width, height);
const p = await b.newPage();
await p.setViewport({ width, height });
await p.goto('http://127.0.0.1:58080/');
await p.setDefaultTimeout(30000); // Default timeout of 30 seconds
return [b, p];
}

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
Expand Down Expand Up @@ -87,10 +97,7 @@ async function elements_empty(element_type, p) {
// Start of tests
test('e2e - Check that actions that should work, do work', async (t) => {
// Arrange: Set up the page
const b = await browser(width, height);
const p = await b.newPage();
await p.setViewport({ width, height });
await p.goto('http://127.0.0.1:58080/');
const [b, p] = await setup();

// Act: Test creating a workspace
await create_workspace(p, 'puppeteer');
Expand All @@ -114,10 +121,7 @@ test('e2e - Check that actions that should work, do work', async (t) => {

test('e2e - Check that actions that shouldn\'t work, don\'t work', async (t) => {
// Arrange: Set up the page
const b = await browser(width, height);
const p = await b.newPage();
await p.setViewport({ width, height });
await p.goto('http://127.0.0.1:58080/');
const [b, p] = await setup();

// Act: Test creating invalid workspaces
await create_workspace(p, '123');
Expand Down

0 comments on commit 8381691

Please sign in to comment.