jeudi 25 juin 2020

Cypress test string as HTML

I have a JSON file from which HTML is extracted by a third party.

I would like to use Cypress to test the validity of the HTML within the JSON.

it('Parses HTML from JSON and checks its validity', () => {
  cy
    .readFile(file)
    .then((obj) => {
      expect(obj).to.have.property('html');
      // next line is not valid
      cy.visit(obj.html);
      ...
    });
});

Is there a way to make Cypress treat string as a website?

Aucun commentaire:

Enregistrer un commentaire