Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests faster by avoiding unnecessary waiting #79

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions integration/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test('resolve #definitions in non-root schema', async () => {

await page.goto( rootUrl + "#/integration/schemas/def-non-root/User.json");

await page.waitFor(5000);
await page.waitFor('#doc .box .box .box .signature:nth-child(6) .property-name');

await expect(
page.evaluate( () => Array.from(document.querySelectorAll('.property-name').values()).map( s => s.innerText ) )
Expand All @@ -55,7 +55,7 @@ test('local schema, absolute path', async () => {

await page.goto( rootUrl + "#/integration/schemas/local-absolute/main.json");

await page.waitFor(5000);
await page.waitFor('#doc .box .box .desc');

await expect(
page.evaluate( () => Array.from(document.querySelectorAll('.desc').values()).map( s => s.innerText ) )
Expand All @@ -70,7 +70,7 @@ test('recursive schemas', async () => {

await page.goto( rootUrl + "#/integration/schemas/recursive/circle.json");

await page.waitFor(5000);
await page.waitFor('#doc .box .box .box .desc');

await expect(
page.evaluate( () => Array.from(document.querySelectorAll('.desc').values()).map( s => s.innerText ) )
Expand All @@ -84,7 +84,7 @@ test('recursive schemas, part II', async () => {
const page = await ( await browser ).newPage();

await page.goto( rootUrl + "#/integration/schemas/recursive/within_schema.json");
await page.waitFor(5000);
await page.waitFor('#doc .box .desc p');

let results = await
page.evaluate( () => Array.from(document.querySelectorAll('p').values()).map( s => s.innerText ) );
Expand Down
6 changes: 3 additions & 3 deletions integration/widget.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ const express = require('express');

const puppeteer = require('puppeteer')

const rootUrl = "http://localhost:3000/";
const rootUrl = "http://localhost:3001/";

jest.setTimeout(500000);

const server = new Promise( resolve => {
let app = require( '../src/server' )({ directory: path.join( __dirname, '..' ) });
let server;
server = app.listen( 3000, () => resolve(server) );
server = app.listen( 3001, () => resolve(server) );
}).catch( e => console.log(e) );

const browser = puppeteer.launch({ headless: false });
Expand All @@ -31,7 +31,7 @@ test( 'basic', async () => {

let frames = await page.frames();

await page.waitFor(2000);
await frames[1].waitFor('.title');

let title = await frames[1].evaluate(
() => document.querySelector('.title').innerText
Expand Down