docbrown/cypress/integration/seededFlows/notificationsFlows/followUserFromNotifications.spec.js
Keshav Biswa 086813afd4
Accessible names for follow buttons (#14687)
* added aria-pressed value to all follow_buttons

* added check to remove aria pressed attribute and added cypress tests

* removed unfollow aria-label setting and cypress test fixes

* fixed cypress failing tests

* failing cypress test fix

* added steps to check correct states are loaded when page refreshed

* refreshed alias after page reload
2021-09-22 10:34:34 +07:00

27 lines
912 B
JavaScript

describe('Follow user from notifications', () => {
beforeEach(() => {
cy.testSetup();
cy.fixture('users/notificationsUser.json').as('user');
cy.get('@user').then((user) => {
cy.loginAndVisit(user, '/notifications');
});
});
it('Follows and unfollows a user from a follow notification', () => {
cy.findByRole('heading', { name: 'Notifications' });
cy.findByRole('button', { name: 'Follow user back: User' }).as(
'followButton',
);
cy.get('@followButton').should('have.attr', 'aria-pressed', 'false');
cy.get('@followButton').click();
cy.get('@followButton').should('have.text', 'Following');
cy.get('@followButton').should('have.attr', 'aria-pressed', 'true');
cy.get('@followButton').click();
cy.get('@followButton').should('have.text', 'Follow back');
cy.get('@followButton').should('have.attr', 'aria-pressed', 'false');
});
});