percy / percy-ember

Ember addon for visual regression testing with Percy
https://docs.percy.io/docs/ember
MIT License
73 stars 44 forks source link

Error fetching DOM library, disabling #271

Closed knownasilya closed 3 years ago

knownasilya commented 3 years ago

Getting this error in an Ember app. Both locally and in Github Actions.

{
    "ember-cli": "~3.24.0",
    "ember-source": "~3.24.0",
    "@percy/ember": "^2.1.4"
}
Robdel12 commented 3 years ago

👋🏼 Hey @knownasilya! How is Percy being ran? That means the DOM lib can't be fetched from the percy server: https://github.com/percy/ember-percy/blob/master/addon-test-support/%40percy/ember/index.js#L12

knownasilya commented 3 years ago

Hello!

import percySnapshot from '@percy/ember';

module('Acceptance | password reset', function (hooks) {
  setupApplicationTest(hooks);
  setupMirage(hooks);

  test('request password reset', async function (assert) {
    let user = this.server.create('user', {
      email: 'test@example.com',
      resetPasswordToken: undefined,
    });

    await visit('/');
    await click('[data-test-forgot-password]');

    assert.equal(currentURL(), '/forgot-password');
    await percySnapshot('forgot-password');

    await fillIn('[data-test-forgot-email]', user.email);
    await click('[data-test-request-reset');

    let found = this.server.schema.users.findBy({ email: 'test@example.com' });
    assert.equal(currentURL(), '/login');
    assert.ok(found.resetPasswordToken);
  });
Robdel12 commented 3 years ago

This error would come from running Percy without percy exec -- ember test. percy exec starts the local Percy server. Step 4 here: https://docs.percy.io/docs/ember#setup -- is that missing? 🤔

Also, fully acknowledge the error message is terrible. That changes in the next version: https://github.com/percy/ember-percy/blob/ww/new-cli/addon-test-support/%40percy/ember/index.js#L30 (https://docs.percy.io/docs/migrating-to-percy-cli#wip)

knownasilya commented 3 years ago

Yes. Didn't see that. It would be better if the docs had code blocks below each step, instead of showing the code inline. Easier to miss. Closing since it was an error on my part 😄

knownasilya commented 3 years ago

Could the new error mention using percy exec?

Robdel12 commented 3 years ago

I don't think there is -- there's many ways to start the server now (via @percy/core, percy exec:start or percy exec -- [sub command). So we can't assume how the consuming SDK is starting the server. Just that it's not available. It's also something that will be logged anytime tests are run without the Percy server running (a perfectly valid scenario), so verbosity is a consideration too.. 🤔 (Thinking about adding "did you mean to use percy exec?" but that's too specific)

knownasilya commented 3 years ago

Yeah, understand. I wonder if there could be a help page about the different ways to run it, and that could be linked.