docbrown/cypress/e2e/seededFlows/moderationFlows/modNavigation.spec.js
dependabot[bot] deb86efb0d
Bump cypress and @knapsack-pro/cypress (#18025)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-06 17:53:13 -04:00

48 lines
1.2 KiB
JavaScript

describe('Moderation navigation', () => {
describe('mobile screens', () => {
beforeEach(() => {
cy.testSetup();
cy.fixture('users/adminUser.json').as('user');
cy.viewport('iphone-6');
cy.get('@user').then((user) => {
cy.loginAndVisit(user, '/mod');
});
});
it('shows all topics by default', () => {
cy.findByRole('navigation', {
name: 'Mod center inbox navigation',
}).within(() => {
cy.findByRole('link', { name: 'All topics' }).should(
'have.attr',
'aria-current',
'page',
);
cy.findByRole('link', { name: '#tag1' }).should(
'have.attr',
'aria-current',
'',
);
});
});
it('should switch tab to a tag', () => {
cy.findByRole('navigation', {
name: 'Mod center inbox navigation',
}).within(() => {
cy.findByRole('link', { name: '#tag1' }).as('tag1');
cy.get('@tag1').should('have.attr', 'aria-current', '');
cy.get('@tag1').click();
});
// Get a new handle to element as a new page has loaded
cy.findByRole('link', { name: '#tag1' }).should(
'have.attr',
'aria-current',
'page',
);
});
});
});