Skip to content

Commit d4bd582

Browse files
timheilmanmarkerikson
authored andcommitted
test: issue 1278 re-enabling test that had failed on firefox,
which is not failing after the upgrade to MUI v5. See cypress-io#1278
1 parent e059d98 commit d4bd582

File tree

1 file changed

+52
-58
lines changed

1 file changed

+52
-58
lines changed

cypress/tests/ui/notifications.spec.ts

+52-58
Original file line numberDiff line numberDiff line change
@@ -26,65 +26,59 @@ describe("Notifications", function () {
2626
});
2727

2828
describe("notifications from user interactions", function () {
29-
it(
30-
"User A likes a transaction of User B; User B gets notification that User A liked transaction ",
31-
// NOTE: this test seems to have issues in Firefox UI/Mobile tests due to an issue with the Base Button component in MUI v4
32-
// we should try unskipping this test in Firefox once we upgrade MUI to v5+. @see https://github.com/cypress-io/cypress-realworld-app/issues/1278
33-
{ browser: { name: "!firefox" } },
34-
function () {
35-
cy.loginByXstate(ctx.userA.username);
36-
cy.wait("@getNotifications");
37-
38-
cy.database("find", "transactions", { senderId: ctx.userB.id }).then(
39-
(transaction: Transaction) => {
40-
cy.visit(`/transaction/${transaction.id}`);
41-
}
42-
);
43-
44-
cy.log("🚩 Renders the notifications badge with count");
45-
cy.wait("@getNotifications")
46-
.its("response.body.results.length")
47-
.then((notificationCount) => {
48-
cy.getBySel("nav-top-notifications-count").should("have.text", `${notificationCount}`);
49-
});
50-
cy.visualSnapshot("Renders the notifications badge with count");
51-
52-
const likesCountSelector = "[data-test*=transaction-like-count]";
53-
cy.contains(likesCountSelector, 0);
54-
cy.getBySelLike("like-button").click();
55-
// a successful "like" should disable the button and increment
56-
// the number of likes
57-
cy.getBySelLike("like-button").should("be.disabled");
58-
cy.contains(likesCountSelector, 1);
59-
cy.visualSnapshot("Like Count Incremented");
60-
61-
cy.switchUserByXstate(ctx.userB.username);
62-
cy.visualSnapshot(`Switch to User ${ctx.userB.username}`);
63-
64-
cy.wait("@getNotifications")
65-
.its("response.body.results.length")
66-
.as("preDismissedNotificationCount");
67-
68-
cy.visit("/notifications");
69-
70-
cy.wait("@getNotifications");
71-
72-
cy.getBySelLike("notification-list-item")
73-
.should("have.length", 9)
74-
.first()
75-
.should("contain", ctx.userA?.firstName)
76-
.and("contain", "liked");
77-
78-
cy.log("🚩 Marks notification as read");
79-
cy.getBySelLike("notification-mark-read").first().click({ force: true });
80-
cy.wait("@updateNotification");
81-
82-
cy.get("@preDismissedNotificationCount").then((count) => {
83-
cy.getBySelLike("notification-list-item").should("have.length.lessThan", Number(count));
29+
it("User A likes a transaction of User B; User B gets notification that User A liked transaction ", function () {
30+
cy.loginByXstate(ctx.userA.username);
31+
cy.wait("@getNotifications");
32+
33+
cy.database("find", "transactions", { senderId: ctx.userB.id }).then(
34+
(transaction: Transaction) => {
35+
cy.visit(`/transaction/${transaction.id}`);
36+
}
37+
);
38+
39+
cy.log("🚩 Renders the notifications badge with count");
40+
cy.wait("@getNotifications")
41+
.its("response.body.results.length")
42+
.then((notificationCount) => {
43+
cy.getBySel("nav-top-notifications-count").should("have.text", `${notificationCount}`);
8444
});
85-
cy.visualSnapshot("Notification count after notification dismissed");
86-
}
87-
);
45+
cy.visualSnapshot("Renders the notifications badge with count");
46+
47+
const likesCountSelector = "[data-test*=transaction-like-count]";
48+
cy.contains(likesCountSelector, 0);
49+
cy.getBySelLike("like-button").click();
50+
// a successful "like" should disable the button and increment
51+
// the number of likes
52+
cy.getBySelLike("like-button").should("be.disabled");
53+
cy.contains(likesCountSelector, 1);
54+
cy.visualSnapshot("Like Count Incremented");
55+
56+
cy.switchUserByXstate(ctx.userB.username);
57+
cy.visualSnapshot(`Switch to User ${ctx.userB.username}`);
58+
59+
cy.wait("@getNotifications")
60+
.its("response.body.results.length")
61+
.as("preDismissedNotificationCount");
62+
63+
cy.visit("/notifications");
64+
65+
cy.wait("@getNotifications");
66+
67+
cy.getBySelLike("notification-list-item")
68+
.should("have.length", 9)
69+
.first()
70+
.should("contain", ctx.userA?.firstName)
71+
.and("contain", "liked");
72+
73+
cy.log("🚩 Marks notification as read");
74+
cy.getBySelLike("notification-mark-read").first().click({ force: true });
75+
cy.wait("@updateNotification");
76+
77+
cy.get("@preDismissedNotificationCount").then((count) => {
78+
cy.getBySelLike("notification-list-item").should("have.length.lessThan", Number(count));
79+
});
80+
cy.visualSnapshot("Notification count after notification dismissed");
81+
});
8882

8983
it("User C likes a transaction between User A and User B; User A and User B get notifications that User C liked transaction", function () {
9084
cy.loginByXstate(ctx.userC.username);

0 commit comments

Comments
 (0)