-
Notifications
You must be signed in to change notification settings - Fork 36
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
add package ava-browser-fixture #16
Conversation
I'm a bit confused by the purpose of this module. What does it do and what problem does it solve? |
This module adds fixtures for browser-based testing for your frontend-modules, as ava cant do this out of the box, as ava runs only on the cli and therefore no browser environment is present. This module use It just implements, which is already documented in the ava docs: https://github.com/avajs/ava/blob/master/docs/recipes/browser-testing.md |
@vadimdemedes I added an example, is it better understandable now? https://github.com/WeltN24/ava-browser-fixture/blob/master/test/test.js import test from "ava";
import {Fixture, window} from "../index";
test.beforeEach('setup fixture', t => Fixture("./test/test.html", (document) => {
t.context.document = document;
t.context.window = window;
}));
test("test example", t => {
t.is(t.context.document.documentElement.querySelector("h1").textContent, "Hello Test");
}); |
Hey, sorry, was under piles of work, didn't have a chance to reply back. Oh, so Does it accept URLs along with fs paths? |
No Problem! On the other hand, testing a running web-application with this approach will still not be possible, you need a headless browser like phantomjs for this, |
I think your readme needs to be better at answering what problem the module solves.
Why not simplify it a bit: test.beforeEach('setup fixture', fixture('test/test.html'));
|
Thanks for the feedback @sindresorhus Updated the Code and the README: https://github.com/WeltN24/ava-browser-fixture And rebased against master. 🚀 ? |
Going to pass on this for now. As it currently is, it's not something I would recommend. The docs are lacking. Only one test. And the description has a lot of typos. |
Thanks for your feedback anyway. |
Hi,
I wrote a little helper to add browser-testing with
ava
andbrowser-env
, as already suggested in the docs: https://github.com/avajs/ava/blob/master/docs/recipes/browser-testing.mdPackage: https://www.npmjs.com/package/ava-browser-fixture
Github: https://github.com/WeltN24/ava-browser-fixture
( I added the npmjs.org link - should I better add the github-link?)