[15 min fix] Stub article network requests in pinPost cypress test (#14111)

* stub unneeded network requests

* add to stub, wait on page load
This commit is contained in:
Suzanne Aitchison 2021-07-01 11:26:41 +01:00 committed by GitHub
parent e492324f0b
commit 6bed507081
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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' });
});
});
});