Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Add generic helper function to assert results #103

Open
amitaibu opened this issue Aug 6, 2015 · 4 comments
Open

Add generic helper function to assert results #103

amitaibu opened this issue Aug 6, 2015 · 4 comments
Assignees

Comments

@amitaibu
Copy link
Contributor

amitaibu commented Aug 6, 2015

Something along this:

var assertResult = function(err, res) {
  assert.ifError(err);

  Object.keys(res).forEach(function(key) {
    res[key].forEach(function(value) {
      if (!value.isWithinMisMatchTolerance) {
        console.log(res);
        throw new Error('Error in baseline image');
      }
    })
  });
};
@klamping
Copy link
Contributor

klamping commented Sep 2, 2015

I'm looking for something like this as well. I'd like tests to fail if it's not within tolerance, but I also don't want to write the same assertions again and again.

@elicwhite
Copy link
Contributor

I don't think this should be part of webdrivercss. Webdrivercss's job is to be a plugin to webdriverio to capture screenshots. Having assertion helpers seems like another package that would provide this value.

@klamping
Copy link
Contributor

klamping commented Sep 3, 2015

This is for a specific function of webdrivercss that handles whether the diff is out of bounds as far as mismatch goes. There's an example here: https://github.com/webdriverio/webdrivercss#let-your-test-fail-when-screenshots-differ

I really think the default setting should be this assertion already in place, with the ability to customize it if you'd like.

@elicwhite
Copy link
Contributor

I happen to be of the belief that webdrivercss should have nothing to do with testing itself and thus shouldn't even have a tolerance setting. I think webdrivercss should purely take screenshots and then there should be other packages on top of webdrivercss that adds the other testing functionality / uploading to aplitools, api, etc. But that is probably a bigger conversation.

In fact, I'm going to start an issue for that.

See #113

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

No branches or pull requests

3 participants