Skip to content

Commit

Permalink
Fix tests related to media messages
Browse files Browse the repository at this point in the history
  • Loading branch information
sushmi21 committed Aug 26, 2024
1 parent 02be292 commit b8a2c7e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 25 deletions.
10 changes: 0 additions & 10 deletions cypress/e2e/messages/audio.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,5 @@ describe("Message with Audio", () => {
cy.withMessageFixture('audio', () => {
cy.get(".webchat-message-row .webchat-media-template-audio");
})
})

it("should have sr-only default alternate text for audio", () => {
cy.withMessageFixture('audio', () => {
cy
.get(".webchat-message-row .webchat-media-template-audio span")
.contains("Attachment Audio")
.should("not.be.visible");
})
})

})
2 changes: 1 addition & 1 deletion cypress/e2e/messages/downloadableImage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("Message with Downloadable Image", () => {
it("should render download button", () => {
cy.withMessageFixture('downloadableImage', () => {
cy
.get("button").contains("Download");
.get(".webchat-message-row a").contains("Download");
})
});
})
11 changes: 5 additions & 6 deletions cypress/e2e/messages/image.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Message with Image", { retries: 3 }, () => {

it("should render image", () => {
cy.withMessageFixture("image", () => {
cy.get(".webchat-message-row > div > img").should("be.visible");
cy.get(".webchat-message-row img").should("be.visible");
});
});

Expand All @@ -20,15 +20,14 @@ describe("Message with Image", { retries: 3 }, () => {

it("should have alt attibute", () => {
cy.withMessageFixture("image", () => {
cy.get(".webchat-message-row > div > img")
.should("have.attr", "alt")
.and("match", /Attachment Image/);
cy.get(".webchat-media-template-image img")
.should("have.attr", "alt", "Attachment Image")
});
});

it("should render the image in a fixed aspect ratio", () => {
cy.withMessageFixture("image", () => {
cy.get(".webchat-media-template-image > img")
cy.get(".webchat-media-template-image img")
.should("be.visible")
.then(element => {
const imageRatio = (element.innerWidth() / element.innerHeight()).toFixed(1);
Expand All @@ -51,7 +50,7 @@ describe("Message with Image", { retries: 3 }, () => {
cy.startConversation();

cy.withMessageFixture("image", () => {
cy.get(".webchat-media-template-image > img")
cy.get(".webchat-media-template-image img")
.should("be.visible")
.then(element => {
expect(element.innerHeight().toFixed()).to.equal(
Expand Down
8 changes: 0 additions & 8 deletions cypress/e2e/messages/video.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,4 @@ describe("Message with Video", () => {
cy.get(".webchat-message-row .webchat-media-template-video");
})
})

it("should have sr-only default alternate text for video", () => {
cy.withMessageFixture('video', () => {
cy.get(".webchat-message-row .webchat-media-template-video .sr-only")
.contains("Attachment Video")
.should("not.be.visible");
})
})
})

0 comments on commit b8a2c7e

Please sign in to comment.