diff --git a/cypress/e2e/seededFlows/articleFlows/followOrganization.spec.js b/cypress/e2e/seededFlows/articleFlows/followOrganization.spec.js index 7527da4f7..31207ce26 100644 --- a/cypress/e2e/seededFlows/articleFlows/followOrganization.spec.js +++ b/cypress/e2e/seededFlows/articleFlows/followOrganization.spec.js @@ -4,24 +4,23 @@ describe('Follow an organization from article sidebar', () => { cy.viewport('macbook-16'); cy.fixture('users/articleEditorV1User.json').as('user'); + cy.intercept('GET', '/follows/*').as('follows'); cy.get('@user').then((user) => { - cy.loginAndVisit( - user, - '/admin_mcadmin/test-organization-article-slug', - ).then(() => { - cy.get('[data-follow-clicks-initialized]'); - cy.findByRole('heading', { name: 'Organization test article' }); - }); + cy.loginAndVisit(user, '/admin_mcadmin/test-organization-article-slug'); }); + cy.wait('@follows'); + cy.get('[data-follow-clicks-initialized]'); + cy.findByRole('heading', { name: 'Organization test article' }); }); - it('Follows an organization from the sidebar', () => { + it('Follows and unfollow an organization from the sidebar', () => { cy.intercept('/follows').as('followRequest'); cy.contains('Follow').as('followButton'); // Follow cy.get('@followButton').click(); + cy.wait('@followRequest'); cy.get('@followButton').should('have.text', 'Following'); cy.get('@followButton').should('have.attr', 'aria-pressed', 'true'); @@ -35,18 +34,17 @@ describe('Follow an organization from article sidebar', () => { cy.findByRole('main') .findByRole('link', { name: 'Bachmanity' }) .should('exist'); - }); - - it('Unfollows an organization from the sidebar', () => { - cy.intercept('/follows').as('followRequest'); - - cy.contains('Follow').as('followButton'); - - // Follow - cy.get('@followButton').click(); // Unfollow + cy.visitAndWaitForUserSideEffects( + '/admin_mcadmin/test-organization-article-slug', + ); + // cy.intercept('/follows').as('followRequest'); + cy.contains('Following').as('followButton'); cy.get('@followButton').click(); + cy.wait('@followRequest'); + cy.contains('Following').should('not.exist'); + cy.contains('Follow').as('followButton'); cy.get('@followButton').should('have.text', 'Follow'); cy.get('@followButton').should('have.attr', 'aria-pressed', 'false'); diff --git a/cypress/e2e/seededFlows/moderationFlows/adjustPostTags.spec.js b/cypress/e2e/seededFlows/moderationFlows/adjustPostTags.spec.js index 204b329b0..3f9661b7b 100644 --- a/cypress/e2e/seededFlows/moderationFlows/adjustPostTags.spec.js +++ b/cypress/e2e/seededFlows/moderationFlows/adjustPostTags.spec.js @@ -16,9 +16,7 @@ describe('Adjust post tags', () => { .should('not.exist'); cy.getIframeBody('.actions-panel-iframe').within(() => { - cy.findByRole('button', { name: 'Open adjust tags section' }).click({ - force: true, - }); + cy.findByRole('button', { name: 'Open adjust tags section' }).click(); cy.findByTestId('add-tag-button').click(); cy.findByPlaceholderText('Add a tag').type('tag2'); cy.findByPlaceholderText('Reason to add tag (optional)').type( @@ -145,9 +143,7 @@ describe('Adjust post tags', () => { .should('not.exist'); cy.getIframeBody('.actions-panel-iframe').within(() => { - cy.findByRole('button', { name: 'Open adjust tags section' }).click({ - force: true, - }); + cy.findByRole('button', { name: 'Open adjust tags section' }).click(); cy.findByTestId('add-tag-button').click(); cy.findByPlaceholderText('Add a tag').type('tag2'); cy.findByPlaceholderText('Reason to add tag (optional)').type( diff --git a/cypress/e2e/seededFlows/profileFlows/profileUserActionsMenu.spec.js b/cypress/e2e/seededFlows/profileFlows/profileUserActionsMenu.spec.js index aade5c2d1..cbbee319c 100644 --- a/cypress/e2e/seededFlows/profileFlows/profileUserActionsMenu.spec.js +++ b/cypress/e2e/seededFlows/profileFlows/profileUserActionsMenu.spec.js @@ -30,13 +30,11 @@ describe('Profile User Actions Menu', () => { cy.fixture('users/adminUser.json').as('user'); cy.get('@user').then((user) => { - cy.loginAndVisit(user, '/'); + cy.loginAndVisit(user, '/article_editor_v1_user'); }); }); it("should show a dropdown menu when a user views another user's profile", () => { - cy.visit('/article_editor_v1_user'); - // Make sure the dropdown has initialized cy.get('[data-dropdown-initialized]'); @@ -73,8 +71,6 @@ describe('Profile User Actions Menu', () => { // Always accept the confirmation that pops up cy.on('window:confirm', () => true); - cy.visit('/article_editor_v1_user'); - // Make sure the dropdown has initialized cy.get('[data-dropdown-initialized]'); @@ -94,9 +90,6 @@ describe('Profile User Actions Menu', () => { it('should flag and unflag a user', () => { // Always accept the confirmation that pops up cy.on('window:confirm', () => true); - - cy.visit('/article_editor_v1_user'); - // Make sure the dropdown has initialized cy.get('[data-dropdown-initialized]'); @@ -104,8 +97,8 @@ describe('Profile User Actions Menu', () => { cy.findByRole('link', { name: 'Flag @article_editor_v1_user' }).click(); // Check that the menu option has updated - cy.findByRole('link', { name: 'Flag @article_editor_v1_user' }).should( - 'not.exist', + cy.findByRole('link', { name: 'Unflag @article_editor_v1_user' }).should( + 'exist', ); cy.findByRole('link', { name: 'Unflag @article_editor_v1_user' }).click();