docbrown/cypress/e2e/seededFlows/moderationFlows/modNavigation.spec.js
Ben Halpern 456a5e61d2
Add filters to /mod (#20179)
* Add filters to /mod

* Adjust cypress to look for proper text

* Adjust cypress to be less sensitive
2023-10-02 11:47:49 +07: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 tags' }).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',
);
});
});
});