docbrown/cypress/integration/notificationsFlows/notificationNavigation.spec.js
Suzanne Aitchison 783fb6fa24
Accessibility enhancements to navigation tabs (#13559)
* update storybook example and docs

* update desktop home feed tabs with a11y enhancements

* update storybook to reflect buttons usage, update post editor buttons

* update admin html variants tabs

* update admin sponsorships tabs

* re-add flex to the crayons-tab class to prevent regression in tab components not updated

* Revert "update admin sponsorships tabs"

This reverts commit d9e4a5e4b0d362e38a11c795b35ceb4442bc4d90.

* Revert "update admin html variants tabs"

This reverts commit 3d9f119e88dc2f2f102d664c57a1f56413490a36.

* update search tabs

* update v2 form erb html

* update tag index tabs

* update notifications tabs

* label the notifications nav

* update mod sidebar tabs

* update main analytics page tabs

* add cypress tests for home feed tabs

* add tab tests for the post editor

* add cypress tests for tags index navigation

* fix UI issue with search tabs, add search cypress tests

* add tests for the analytics dashboard tabs

* add mod nav tests

* add notifications navigation tests

* get new handles after view switch

* replace hardcoded mod paths

* apply review suggestions
2021-05-07 15:24:34 +01:00

58 lines
1.9 KiB
JavaScript

describe('Notification navigation', () => {
describe('mobile screens', () => {
beforeEach(() => {
cy.testSetup();
cy.fixture('users/adminUser.json').as('user');
cy.get('@user').then((user) => {
cy.loginUser(user).then(() => {
cy.viewport('iphone-6');
cy.visit('/notifications');
});
});
});
it('should show All by default', () => {
cy.findByRole('navigation', { name: 'Notifications' }).within(() => {
cy.findByRole('link', { name: 'All' }).as('all');
cy.findByRole('link', { name: 'Comments' }).as('comments');
cy.findByRole('link', { name: 'Posts' }).as('posts');
cy.get('@all').should('have.attr', 'aria-current', 'page');
cy.get('@comments').should('have.attr', 'aria-current', '');
cy.get('@posts').should('have.attr', 'aria-current', '');
});
});
it('should switch to Comments tab', () => {
cy.findByRole('navigation', { name: 'Notifications' }).within(() => {
cy.findByRole('link', { name: 'Comments' }).as('comments');
cy.get('@comments').should('have.attr', 'aria-current', '');
cy.get('@comments').click();
});
cy.url().should('contain', '/comments');
// Get a fresh handle as we're on a new page
cy.findByRole('link', { name: 'Comments' }).should(
'have.attr',
'aria-current',
'page',
);
});
it('should switch to Posts tab', () => {
cy.findByRole('navigation', { name: 'Notifications' }).within(() => {
cy.findByRole('link', { name: 'Posts' }).as('posts');
cy.get('@posts').should('have.attr', 'aria-current', '');
cy.get('@posts').click();
});
cy.url().should('contain', '/posts');
// Get a fresh handle as we're on a new page
cy.findByRole('link', { name: 'Posts' }).should(
'have.attr',
'aria-current',
'page',
);
});
});
});