Speed up plugin tests

This commit is contained in:
Rémi de Juvigny 2022-11-18 16:41:55 +01:00 committed by Fernando Chavez
parent 478105f0ee
commit 299af89e79

View File

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