docbrown/cypress/e2e/seededFlows/policyFlows/limitPostCreationToAdmins.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

29 lines
1,023 B
JavaScript

/**
This is to verify visibility of buttons. The authorization tests are
asserted in their corresponding policy tests.
*/
describe('Limit Post Creation to Admins', () => {
beforeEach(() => {
cy.testSetup();
cy.fixture('users/articleEditorV1User.json').as('user');
cy.enableFeatureFlag('limit_post_creation_to_admins');
cy.get('@user').then((user) => {
cy.loginAndVisit(user, '/');
});
});
it('clicking on User Avatar should open User Dropdown menu and no Create Post is visible', () => {
cy.findByRole('button', { name: 'Navigation menu' }).as('menuButton');
cy.get('@menuButton')
.should('have.attr', 'aria-expanded', 'false')
.click()
.should('have.attr', 'aria-expanded', 'true');
cy.findByRole('link', {
name: 'Article Editor v1 User @article_editor_v1_user',
}).should('exist');
// The "Create Post" button either outside of the drop-down nor inside
cy.findByRole('link', { name: 'Create Post' }).should('not.exist');
});
});