Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Chromeless.wait(timeout) is not waiting #394

Open
@tux4

Description

@tux4

This is a Bug Report

Description

Based on the API documentation here https://github.com/graphcool/chromeless/blob/master/docs/api.md#api-wait-timeout calling await chromeless.wait(timeout) should wait for the given timeout before continuing. But it doesn't seem to wait. This issue also seems to effect wait(selector).

I have created a minimal case to reproduce this bug here - https://github.com/tux4/chromeless-bug . Here is a summary -

The following test cases in jest should behave in similar manner -

const { Chromeless } = require("chromeless");

const chromeless = new Chromeless();

function myWait(time=3000) {
  return new Promise((resolve) => {
    setTimeout(resolve, time);
  });
}

describe("Reproduce bug", () => {
  it("this should wait for 3 seconds but it doesn't", async () => {
    await chromeless.wait(3000);
  });

  it("this should wait for 3 seconds and it does", async () => {
    await myWait(3000);
  });
});

afterAll(async () => {
  await chromeless.end();
});

However, the first test ends in 2ms while the second test takes over 3s:

➜  chromeless-bug yarn test
yarn test v1.0.2
$ yarn jest
 PASS  __tests__/wait-test.js (6.676s)
  Reproduce bug
    ✓ this should wait for 3 seconds but it doesn't (2ms)
    ✓ this should wait for 3 seconds and it does (3001ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        7.161s
Ran all test suites.
Done in 7.99s.

Similar or dependent issues:

Additional Data

Node Version - 8.5.0
Chromeless - 1.4.0
OS - Ubuntu 16.04.3 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions