CreateImageWizardV2: test included packages in group popover

This commit is contained in:
Sanne Raymaekers 2024-06-15 01:15:35 +02:00 committed by Klara Simickova
parent d0f52bb1d6
commit 737074eb49
2 changed files with 32 additions and 3 deletions

View file

@ -1,4 +1,4 @@
import { screen, waitFor } from '@testing-library/react';
import { screen, waitFor, within } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
@ -124,6 +124,13 @@ const deselectRecommendation = async () => {
);
};
const openIncludedPackagesPopover = async () => {
const popoverBtn = await screen.findByRole('button', {
name: /About included packages/i,
});
await userEvent.click(popoverBtn);
};
describe('packages request generated correctly', () => {
test('with custom packages', async () => {
await renderCreateMode();
@ -311,3 +318,22 @@ describe('pagination on packages step', () => {
await expect(bottom).toHaveTextContent('of 0');
});
});
describe('package groups on packages step', () => {
test('included packages popover', async () => {
await renderCreateMode();
await goToPackagesStep();
await searchForGroup();
await selectFirstPackage();
await openIncludedPackagesPopover();
const table = await screen.findByTestId('group-included-packages-table');
const rows = await within(table).findAllByRole('row');
expect(rows).toHaveLength(2);
const firstRowCells = await within(rows[0]).findAllByRole('cell');
expect(firstRowCells[0]).toHaveTextContent('fish1');
const secondRowCells = await within(rows[1]).findAllByRole('cell');
expect(secondRowCells[0]).toHaveTextContent('fish2');
});
});