From 299af89e793033d3e909ee08fb497a9ab7aa6f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20de=20Juvigny?= Date: Fri, 18 Nov 2022 16:41:55 +0100 Subject: [PATCH] Speed up plugin tests --- .../MarketplacePage/tests/plugins.test.js | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/core/admin/admin/src/pages/MarketplacePage/tests/plugins.test.js b/packages/core/admin/admin/src/pages/MarketplacePage/tests/plugins.test.js index d92ad08e1d..5718dd461b 100644 --- a/packages/core/admin/admin/src/pages/MarketplacePage/tests/plugins.test.js +++ b/packages/core/admin/admin/src/pages/MarketplacePage/tests/plugins.test.js @@ -199,10 +199,11 @@ describe('Marketplace page - plugins tab', () => { const collectionsButton = screen.getByTestId('Collections-button'); await user.click(collectionsButton); - const option = screen.getByRole('option', { name: `Made by Strapi (13)` }); + const option = screen.getByRole('option', { name: 'Made by Strapi (13)' }); await user.click(option); + await waitForReload(); - const optionTag = await screen.findByRole('button', { name: 'Made by Strapi' }); + const optionTag = screen.getByRole('button', { name: 'Made by Strapi' }); expect(optionTag).toBeVisible(); const collectionCards = screen.getAllByTestId('npm-package-card'); @@ -223,8 +224,9 @@ describe('Marketplace page - plugins tab', () => { const option = screen.getByRole('option', { name: `Custom fields (4)` }); await user.click(option); + await waitForReload(); - const optionTag = await screen.findByRole('button', { name: 'Custom fields' }); + const optionTag = screen.getByRole('button', { name: 'Custom fields' }); expect(optionTag).toBeVisible(); const categoryCards = screen.getAllByTestId('npm-package-card'); @@ -259,7 +261,8 @@ describe('Marketplace page - plugins tab', () => { const categoryOption = screen.getByRole('option', { name: `Custom fields (4)` }); await user.click(categoryOption); // When the page reloads they should see a tag for the selected option - const madeByStrapiTag = await screen.findByRole('button', { name: 'Made by Strapi' }); + await waitForReload(); + const madeByStrapiTag = screen.getByRole('button', { name: 'Made by Strapi' }); const customFieldsTag = screen.getByRole('button', { name: 'Custom fields' }); expect(madeByStrapiTag).toBeVisible(); expect(customFieldsTag).toBeVisible(); @@ -290,8 +293,9 @@ describe('Marketplace page - plugins tab', () => { screen.getByRole('combobox', { name: `Collections 1 collection selected Made by Strapi` }) ); await user.click(screen.getByRole('option', { name: `Verified (29)` })); + await waitForReload(); - const madeByStrapiTag = await screen.findByRole('button', { name: 'Made by Strapi' }); + const madeByStrapiTag = screen.getByRole('button', { name: 'Made by Strapi' }); const verifiedTag = screen.getByRole('button', { name: 'Verified' }); expect(madeByStrapiTag).toBeVisible(); expect(verifiedTag).toBeVisible(); @@ -313,8 +317,9 @@ describe('Marketplace page - plugins tab', () => { screen.getByRole('combobox', { name: `Categories 1 category selected Custom fields` }) ); await user.click(screen.getByRole('option', { name: `Monitoring (1)` })); + await waitForReload(); - const customFieldsTag = await screen.findByRole('button', { name: 'Custom fields' }); + const customFieldsTag = screen.getByRole('button', { name: 'Custom fields' }); const monitoringTag = screen.getByRole('button', { name: 'Monitoring' }); expect(customFieldsTag).toBeVisible(); expect(monitoringTag).toBeVisible(); @@ -333,8 +338,9 @@ describe('Marketplace page - plugins tab', () => { const option = screen.getByRole('option', { name: 'Made by Strapi (13)' }); await user.click(option); + await waitForReload(); - const optionTag = await screen.findByRole('button', { name: 'Made by Strapi' }); + const optionTag = screen.getByRole('button', { name: 'Made by Strapi' }); expect(optionTag).toBeVisible(); await user.click(optionTag);