mardi 12 février 2019

How to implement Percy in TestCafe

I'm using TestCafe and trying to integrate Percy for visual regression tests. I've already imported Percy SDK but I get this error ReferenceError: XMLHttpRequest is not defined. Any insight on how to implement this would be helpful.

const PercyAgent = require('@percy/agent').default;
export default class Helper {
  takeSnapshot(snapshotName: any, snapshotOptions: any) {
    const percyAgentClient = new PercyAgent({
      clientInfo: 'awesome-percy-sdk@0.0.1',
      environmentInfo: 'some helpful os or browser information for debugging',
    });
    percyAgentClient.snapshot(snapshotName, snapshotOptions);
  }
}

test('Regression | Login with wrong credentials | 102', async (t) => {
  loginPage.login('not_existent@xpta.com', 'RandomPassword1');
  await t.expect(loginPage.errorMessage.visible).ok();
  await t.debug();
  await t.expect(loginPage.errorMessage.innerText).eql('Invalid username or password.');
  await helper.takeSnapshot('wrong credentials', {});
});

Aucun commentaire:

Enregistrer un commentaire