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

Headless Browser testing using tape-run #55

Merged
merged 4 commits into from
Jul 12, 2017

Conversation

ccpandhare
Copy link
Collaborator

This PR adds headless browser testing to Image Sequencer.

There are three files in the test/ folder.
Out of these three, two JS files run perfectly in the headless browser test. But one doesn't. That file is test/image-manip.js Hence I have not included that file here. Can you help me? I tried a lot, but I couldn't realize why this may be failing.

Shell command to test the file:

$ browserify test/image-manip.js | tape-run

These are the tests that file contains:

var sequencer = ImageSequencer({ ui: "none" });
var image = "SOME DataURI";
sequencer.loadImages(image);

sequencer.addSteps(['do-nothing-pix','invert','invert']);
sequencer.run();

test("Inverted image isn't identical", function (t) {
  t.notEqual(sequencer.images.image1.steps[1].output.src, sequencer.images.image1.steps[2].output.src);
  t.end();
});

test("Twice inverted image is identical to original image", function (t) {
  t.equal(sequencer.images.image1.steps[1].output.src, sequencer.images.image1.steps[3].output.src);
  t.end();
});

@ccpandhare
Copy link
Collaborator Author

This fixes #38

@jywarren
Copy link
Member

Wow, cool, so this runs the entire suite in both Node and PhantomJS?

If it fails in one or the other, does it indicate whether if failed in one or the other? Maybe we just need a little more labeling in the tests?

I think there are some libs to make tape output a bit more readable, it could be worth a search around. Or just log out some notes like "Starting/ending phantomjs in-browser tests" and such. You could intersperse with ##################### to delineate a bit more too.

:-)

@ccpandhare
Copy link
Collaborator Author

Okay I will have a look at those modules.

First, the normal Node based tape test is run. (ALL TESTS)
Then, tape-run is run. (ALL TESTS)
Both these are triggered by the $ npm test command.

We can easily make out where the test is failing -- Node, or Browser.

What tape-run does: It runs the tests separately in Electron and outputs standard TAP output, just like tape.

@ccpandhare
Copy link
Collaborator Author

Changes

  • I have added descriptions for each test.
  • I have added tap-spec module for beautification

@ccpandhare
Copy link
Collaborator Author

So is this good? What do you think?

@jywarren
Copy link
Member

yep! merge!

@ccpandhare ccpandhare merged commit fc28f68 into publiclab:master Jul 12, 2017
@jywarren jywarren mentioned this pull request Oct 14, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants