mirror of https://github.com/vector-im/riot-web
Use Cypress Testing Library - editing.spec.ts (#10480)
Signed-off-by: Suguru Hirahara <luixxiul@users.noreply.github.com>pull/28217/head
parent
6f1a3af895
commit
4ed6e39067
|
@ -46,12 +46,7 @@ describe("Editing", () => {
|
|||
|
||||
// Edit "Message"
|
||||
const editLastMessage = (edit: string) => {
|
||||
cy.get(".mx_EventTile_last").realHover();
|
||||
cy.get(".mx_EventTile_last .mx_MessageActionBar_optionsButton", { timeout: 1000 })
|
||||
.should("exist")
|
||||
.realHover()
|
||||
.get('.mx_EventTile_last [aria-label="Edit"]')
|
||||
.click({ force: false });
|
||||
cy.get(".mx_EventTile_last").realHover().findButton("Edit").click();
|
||||
cy.get(".mx_BasicMessageComposer_input").type(`{selectAll}{del}${edit}{enter}`);
|
||||
};
|
||||
|
||||
|
@ -67,11 +62,7 @@ describe("Editing", () => {
|
|||
|
||||
const clickButtonViewSource = () => {
|
||||
// Assert that "View Source" button is rendered and click it
|
||||
cy.get(".mx_EventTile .mx_EventTile_line")
|
||||
.realHover()
|
||||
.contains(".mx_AccessibleButton", "View Source")
|
||||
.should("exist")
|
||||
.click();
|
||||
cy.get(".mx_EventTile .mx_EventTile_line").realHover().findButton("View Source").click();
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
|
@ -93,7 +84,7 @@ describe("Editing", () => {
|
|||
it("should render and interact with the message edit history dialog", () => {
|
||||
// Click the "Remove" button on the message edit history dialog
|
||||
const clickButtonRemove = () => {
|
||||
cy.get(".mx_EventTile_line").realHover().contains(".mx_AccessibleButton", "Remove").click({ force: false });
|
||||
cy.get(".mx_EventTile_line").realHover().findButton("Remove").click();
|
||||
};
|
||||
|
||||
cy.visit("/#/room/" + roomId);
|
||||
|
@ -250,10 +241,7 @@ describe("Editing", () => {
|
|||
// Assert that the edited message is rendered
|
||||
cy.get(".mx_MessageEditHistoryDialog li:nth-child(2)").within(() => {
|
||||
// Assert that "Remove" button for the original message is rendered
|
||||
cy.get(".mx_EventTile .mx_EventTile_line")
|
||||
.realHover()
|
||||
.contains(".mx_AccessibleButton", "Remove")
|
||||
.should("exist");
|
||||
cy.get(".mx_EventTile .mx_EventTile_line").realHover().findButton("Remove");
|
||||
|
||||
clickButtonViewSource();
|
||||
});
|
||||
|
@ -283,11 +271,11 @@ describe("Editing", () => {
|
|||
sendEvent(roomId);
|
||||
|
||||
// Edit message
|
||||
cy.contains(".mx_RoomView_body .mx_EventTile .mx_EventTile_line", "Message").within(() => {
|
||||
cy.get('[aria-label="Edit"]').click({ force: true }); // Cypress has no ability to hover
|
||||
cy.checkA11y();
|
||||
cy.get(".mx_BasicMessageComposer_input").type("Foo{backspace}{backspace}{backspace}{enter}");
|
||||
cy.checkA11y();
|
||||
cy.contains(".mx_RoomView_body .mx_EventTile", "Message").within(() => {
|
||||
cy.get(".mx_EventTile_line").realHover().findButton("Edit").click().checkA11y();
|
||||
cy.get(".mx_EventTile_line .mx_BasicMessageComposer_input")
|
||||
.type("Foo{backspace}{backspace}{backspace}{enter}")
|
||||
.checkA11y();
|
||||
});
|
||||
cy.contains(".mx_RoomView_body .mx_EventTile[data-scroll-tokens]", "Message");
|
||||
|
||||
|
|
Loading…
Reference in New Issue