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

Supporting PhantomJS for running tests #167

Merged
merged 10 commits into from
Mar 3, 2016
Merged

Supporting PhantomJS for running tests #167

merged 10 commits into from
Mar 3, 2016

Conversation

aaronpowell
Copy link
Owner

This should close #113

@aaronpowell
Copy link
Owner Author

@brettz9 I've got PhantomJS tests running now as part of the build now, but as you can see from the last test run it failed.

I can repo the failure locally and it's because these two expect's fail:

expect(ev.oldVersion).to.equal(initialVersion);
expect(ev.newVersion).to.equal(null);

I'd say there's something going amiss in the err.resume stuff. That's from one of the recent PR's right? Any thought on it?

@aaronpowell
Copy link
Owner Author

Ok so I'm thinking:

  • Should the event handler in the resume promise try and patch it
  • Look at detecting phantomJS and skipping those asserts

I'm leaning towards the former

@brettz9
Copy link
Contributor

brettz9 commented Mar 2, 2016

It's not a bug in our code; it's a bug in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1220279 . It works fine in Chrome. Those checks are in blocked-events.js. I don't think the test should patch it, since it really is what is expected.


req.onblocked = function () {
console.log('db blocked', arguments);
};
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you removed done in this block here? I think deleteDatabase might not always immediately complete its action which could be a problem if the next test depends on the database being deleted.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reason this particular one was causing phantomjs to fail. Given that the tests generate a unique DB name each time (a guid) there's less a need to wait for it to finish.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd think it should still work with done() in onerror or onblocked, but gotcha re: unique DB name...

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I tried adding those calls but nothing was working

@aaronpowell
Copy link
Owner Author

Regarding the FF bug - sure, but one of the things I tried to solve in db.js at the start was to normalise the quirks across browsers (back when there was the setVersion vs onversionchange events, and such).

Now there's less quirks (except IE/Edge not supporting multi-key indexes) but something like this I'd like to normalise down where possible, so if I can patch it in db.js's core then that meets that goal.

@brettz9
Copy link
Contributor

brettz9 commented Mar 2, 2016

Oh, patching it within db.js--was thinking you were talking about the tests...Gotcha... Cool...

@aaronpowell
Copy link
Owner Author

Check out 2e091af it has the patch I'm talking about in there.

@aaronpowell
Copy link
Owner Author

@MartijnR you might be interested in what's happening here.

@brettz9
Copy link
Contributor

brettz9 commented Mar 2, 2016

Yeah, that's cool. Maybe a comment would be nice with the bug link though in case this gets fixed in the future and therefore no longer any need to keep patching.

aaronpowell added a commit that referenced this pull request Mar 3, 2016
Supporting PhantomJS for running tests
@aaronpowell aaronpowell merged commit 31b85ab into master Mar 3, 2016
@aaronpowell aaronpowell deleted the phantomjs branch March 9, 2016 01:28
brettz9 pushed a commit to brettz9/db.js that referenced this pull request Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prototype PhantomJS as a test runner
2 participants