From 6bed507081b5a2b56bf9cb949e7478209404af23 Mon Sep 17 00:00:00 2001 From: Suzanne Aitchison Date: Thu, 1 Jul 2021 11:26:41 +0100 Subject: [PATCH] [15 min fix] Stub article network requests in pinPost cypress test (#14111) * stub unneeded network requests * add to stub, wait on page load --- .../articleFlows/pinArticle.spec.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cypress/integration/articleFlows/pinArticle.spec.js b/cypress/integration/articleFlows/pinArticle.spec.js index faf6e6e08..550a104e9 100644 --- a/cypress/integration/articleFlows/pinArticle.spec.js +++ b/cypress/integration/articleFlows/pinArticle.spec.js @@ -18,6 +18,23 @@ describe('Pin an article - Non admin user', () => { cy.testSetup(); cy.fixture('users/articleEditorV1User.json').as('user'); + // Responses from these requests are not required for this test, and are stubbed to prevent responses interfering with subsequent tests + cy.intercept('/reactions?article**', { + body: { + current_user: { id: '' }, + reactions: [], + article_reaction_counts: [], + }, + }); + cy.intercept('/reactions?commentable**', { + body: { + current_user: { id: '' }, + reactions: [], + public_reaction_counts: [], + }, + }); + cy.intercept('/follows**', {}); + cy.get('@user').then((user) => { cy.loginUser(user).then(() => { cy.createArticle({ @@ -27,6 +44,8 @@ describe('Pin an article - Non admin user', () => { published: true, }).then((response) => { cy.visitAndWaitForUserSideEffects(response.body.current_state_path); + // Wait for page to load + cy.findByRole('heading', { name: 'Test Article' }); }); }); });