From db4ab7cf6f5106b90e95a09b7f9ebde1ae752a98 Mon Sep 17 00:00:00 2001 From: Divlo Date: Wed, 29 Jun 2022 06:50:35 +0200 Subject: [PATCH] test(e2e): remove usage of @nextStaticAndImages intercept --- .../[guildId]/[channelId]/index.spec.ts | 58 ++++++++----------- .../pages/application/guilds/join.spec.ts | 6 +- 2 files changed, 26 insertions(+), 38 deletions(-) diff --git a/cypress/integration/pages/application/[guildId]/[channelId]/index.spec.ts b/cypress/integration/pages/application/[guildId]/[channelId]/index.spec.ts index c0b8a2f..3082661 100644 --- a/cypress/integration/pages/application/[guildId]/[channelId]/index.spec.ts +++ b/cypress/integration/pages/application/[guildId]/[channelId]/index.spec.ts @@ -41,9 +41,8 @@ describe('Pages > /application/[guildId]/[channelId]', () => { getGuildsHandler ]).setCookie('refreshToken', 'refresh-token') cy.intercept(`${API_URL}${getGuildsHandler.url}*`).as('getGuildsHandler') - cy.intercept(`/_next/*`).as('nextStaticAndImages') cy.visit(`/application/${guildExample.id}/${channelExample.id}`) - cy.wait(['@getGuildsHandler', '@nextStaticAndImages']).then(() => { + cy.wait(['@getGuildsHandler']).then(() => { cy.get('[data-cy=application-title]').should( 'have.text', `# ${channelExample.name}` @@ -74,9 +73,8 @@ describe('Pages > /application/[guildId]/[channelId]', () => { getGuildsHandler ]).setCookie('refreshToken', 'refresh-token') cy.intercept(`${API_URL}${getGuildsHandler.url}*`).as('getGuildsHandler') - cy.intercept(`/_next/*`).as('nextStaticAndImages') cy.visit(`/application/${guildExample.id}/${channelExample.id}`) - cy.wait(['@getGuildsHandler', '@nextStaticAndImages']).then(() => { + cy.wait(['@getGuildsHandler']).then(() => { cy.get('[data-cy=application-title]').should( 'have.text', `# ${channelExample.name}` @@ -103,21 +101,18 @@ describe('Pages > /application/[guildId]/[channelId]', () => { cy.intercept(`${API_URL}${getChannelsWithGuildIdHandler.url}*`).as( 'getChannelsWithGuildIdHandler' ) - cy.intercept(`/_next/*`).as('nextStaticAndImages') cy.visit(`/application/${guildExample.id}/${channelExample.id}`) - cy.wait(['@getChannelsWithGuildIdHandler', '@nextStaticAndImages']).then( - () => { - cy.get('.channels-list').children().should('have.length', 2) - cy.get('.channels-list [data-cy=channel-name]:first').should( - 'have.text', - `# ${channelExample.name}` - ) - cy.get('.channels-list [data-cy=channel-name]:last').should( - 'have.text', - `# ${channelExample2.name}` - ) - } - ) + cy.wait(['@getChannelsWithGuildIdHandler']).then(() => { + cy.get('.channels-list').children().should('have.length', 2) + cy.get('.channels-list [data-cy=channel-name]:first').should( + 'have.text', + `# ${channelExample.name}` + ) + cy.get('.channels-list [data-cy=channel-name]:last').should( + 'have.text', + `# ${channelExample2.name}` + ) + }) }) it('should succeeds and display the messages correctly', () => { @@ -146,11 +141,9 @@ describe('Pages > /application/[guildId]/[channelId]', () => { cy.intercept(`${API_URL}${getMessagesUploadsDownloadHandler.url}`).as( 'getMessagesUploadsDownloadHandler' ) - cy.intercept(`/_next/*`).as('nextStaticAndImages') cy.visit(`/application/${guildExample.id}/${channelExample.id}`) cy.wait([ '@getMessagesWithChannelIdHandler', - '@nextStaticAndImages', '@getMessagesUploadsImageHandler', '@getMessagesUploadsAudioHandler', '@getMessagesUploadsVideoHandler', @@ -226,21 +219,18 @@ describe('Pages > /application/[guildId]/[channelId]', () => { cy.intercept(`${API_URL}${getMembersWithGuildIdHandler.url}*`).as( 'getMembersWithGuildIdHandler' ) - cy.intercept(`/_next/*`).as('nextStaticAndImages') cy.visit(`/application/${guildExample.id}/${channelExample.id}`) - cy.wait(['@getMembersWithGuildIdHandler', '@nextStaticAndImages']).then( - () => { - cy.get('.members-list').should('not.be.visible') - cy.get('[data-cy=icon-button-right-sidebar-members]').click() - cy.get('.members-list').should('be.visible') - cy.get('[data-cy=members-title]').should('have.text', 'Member(s)') - cy.get('.members-list').children().should('have.length', 1) - cy.get('.members-list [data-cy=member-user-name]:first').should( - 'have.text', - memberExampleComplete.user.name - ) - } - ) + cy.wait(['@getMembersWithGuildIdHandler']).then(() => { + cy.get('.members-list').should('not.be.visible') + cy.get('[data-cy=icon-button-right-sidebar-members]').click() + cy.get('.members-list').should('be.visible') + cy.get('[data-cy=members-title]').should('have.text', 'Member(s)') + cy.get('.members-list').children().should('have.length', 1) + cy.get('.members-list [data-cy=member-user-name]:first').should( + 'have.text', + memberExampleComplete.user.name + ) + }) }) it('should redirect the user to `/404` if `guildId` or `channelId` are not numbers', () => { diff --git a/cypress/integration/pages/application/guilds/join.spec.ts b/cypress/integration/pages/application/guilds/join.spec.ts index d698a58..b5b6f2b 100644 --- a/cypress/integration/pages/application/guilds/join.spec.ts +++ b/cypress/integration/pages/application/guilds/join.spec.ts @@ -20,9 +20,8 @@ describe('Pages > /application/guilds/join', () => { cy.intercept(`${API_URL}${getGuildsPublicHandler.url}*`).as( 'getGuildsPublicHandler' ) - cy.intercept(`/_next/*`).as('nextStaticAndImages') cy.visit('/application/guilds/join') - cy.wait(['@getGuildsPublicHandler', '@nextStaticAndImages']).then(() => { + cy.wait(['@getGuildsPublicHandler']).then(() => { cy.get('[data-cy=application-title]').should('have.text', 'Join a Guild') cy.get('.guilds-public-list').children().should('have.length', 2) cy.get('.guilds-public-list [data-cy=guild-name]:first').should( @@ -45,8 +44,7 @@ describe('Pages > /application/guilds/join', () => { cy.intercept(`${API_URL}${getGuildsPublicHandler.url}*`).as( 'getGuildsPublicHandler' ) - cy.intercept(`/_next/*`).as('nextStaticAndImages') - cy.wait(['@getGuildsPublicHandler', '@nextStaticAndImages']).then(() => { + cy.wait(['@getGuildsPublicHandler']).then(() => { cy.get('[data-cy=search-guild-input]').type(guildExample2.name) cy.get('.guilds-public-list').children().should('have.length', 1) cy.get('.guilds-public-list [data-cy=guild-name]:first').should(