Skip to content

Commit

Permalink
correcting test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivam Agarwal authored and ci-build committed Oct 30, 2024
1 parent 92087e4 commit 5a68acd
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions ui.tests/test-module/specs/text/text.runtime.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,23 +115,10 @@
});
});

it("text hyperlink and new tab should be working", () => {
const [id, fieldView] = Object.entries(formContainer._fields)[6];
const model = formContainer._model.getElement(id);
// expect(model.value, " Text model value should have").contains("Test text");
// cy.get(`#${id}`).contains("Test text");
cy.get(`#${id}`).should('have.attr', 'href', 'https://google.com') // Ensure the link has the correct href
it("text hyperlink should have target attribute in runtime", () => {
const [id] = Object.entries(formContainer._fields)[4];
cy.get(`#${id}`).find('a').should('have.attr', 'href', 'https://www.google.com/') // Ensure the link has the correct href
.should('have.attr', 'target', '_blank'); // Ensure the link opens in a new tab

// Spy on the window.open event to ensure a new tab is being opened
cy.window().then((win) => {
cy.stub(win, 'open').as('windowOpen');
});

// Trigger a click on the link
cy.get(`#${id}`).click();
// Verify that window.open was called, meaning a new tab would open
cy.get('@windowOpen').should('be.calledWith', 'https://google.com');
});

})

0 comments on commit 5a68acd

Please sign in to comment.