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

Feature request: run tests in same tab instead of separate browser instances #111

Open
simondib opened this issue Nov 13, 2018 · 5 comments

Comments

@simondib
Copy link

Currently testing a responsive component or page layout across multiple breakpoints requires a separate headless browser instance.

It might be much more efficient to resize the same browser window instead of spawning a new instance for each test. This would reduce test execution times dramatically.

@NimaSoroush
Copy link
Owner

Just realised that you need this basically https://github.com/NimaSoroush/differencify/blob/master/API.md#share-browser

This will still open new tab per test but that latency is really minimal. Hope this is what you are looking for

@simondib
Copy link
Author

I've given this suggestion a go, but still seeing fairly length page load times for are essentially just window resizes:

✓ appears correctly on x-small devices (4808ms)
✓ appears correctly on small-medium devices (7286ms)
✓ appears correctly on medium devices (7191ms)
✓ appears correctly on large devices (8775ms)

Is this expected? I'd think the initial page load would be longer, but subsequent tests only requiring a change in viewport size (and not a page refresh) would be much quicker?

@NimaSoroush
Copy link
Owner

window resize should not take that long. Can you run them in non-headless mode and see what is going on?

@NimaSoroush
Copy link
Owner

BTW, I am working on a new feature that will boost the test execution a lot (like 20 times faster). Still at POC level but planning to release it soon. So if the current performance does not bother you much you can wait for that

@simondib
Copy link
Author

simondib commented Nov 15, 2018

Non-headless mode opens a single browser, but launches each test in a new tab - so the load time is still lengthy.

I tried removing .newPage() for subsequent tests to attempt to force the test in the same tab, but was getting strange test results. For example, the first test passed showing correct styles but subsequent tests gave false positives (logo on the right should not be appearing):

it("appear correctly on large devices", async () => {
  await differencify
    .init()
    .newPage()

    .setViewport(getViewport('large', VIEWPORT_HEIGHT))
    .goto(TEST_HOST + PATH)
    .waitFor(DELAY)

    .screenshot()
    .toMatchSnapshot()
    .close()
    .end();
});

it("appear correctly on medium devices", async () => {
  await differencify
    .init()
    // .newPage()

    .setViewport(getViewport('medium', VIEWPORT_HEIGHT))
    .goto(TEST_HOST + PATH)
    .waitFor(DELAY)

    .screenshot()
    .toMatchSnapshot()
    .close()
    .end();
});

image

Ideally testing a simple viewport change could be run in the same tab.

Great to hear about he POC speed boost. Loving Differencify, just looking at ways we can get the most out of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants