Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions front/src/views/Box/BoxViewHistoryOverlay.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,6 @@ describe("3.1.12 - Box HistoryOverlay on BoxView", () => {
expect(may2023).toBeInTheDocument();
expect(jan2023).toBeInTheDocument();

// Wait a moment to ensure DOM is fully settled before position checking
await new Promise((resolve) => setTimeout(resolve, 50));

// Verify that the 2024 entry appears before the 2023 entries
// by checking the document position of the elements
const march2024Position = march2024.compareDocumentPosition(may2023);
Expand Down
4 changes: 4 additions & 0 deletions front/src/views/BoxCreate/BoxCreateView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,16 @@ describe("BoxCreateView", () => {

// Fill in the form
await selectOptionInSelectField(user, /product/i, "Snow trousers (Boy)", "Create New Box");
expect(await screen.findByText("Snow trousers (Boy)")).toBeInTheDocument();
await selectOptionInSelectField(user, /size/i, "S", "Create New Box");
expect(await screen.findByText("S")).toBeInTheDocument();
await selectOptionInSelectField(user, /location/i, "Warehouse", "Create New Box");
expect(await screen.findByText("Warehouse")).toBeInTheDocument();

const numberOfItemsInput = screen.getByRole("spinbutton");
await user.clear(numberOfItemsInput);
await user.type(numberOfItemsInput, "5");
await waitFor(() => expect(numberOfItemsInput).toHaveValue("5"));

//added new Tags
await user.type(screen.getByLabelText(/Tags/), "epic");
Expand Down
24 changes: 8 additions & 16 deletions front/src/views/Boxes/BoxesView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,6 @@ describe("4.8.2 - Selecting rows and performing bulk actions", () => {
await user.click(checkbox2);
await waitFor(() => expect(checkbox2).toBeChecked(), { timeout: 10000 });

// Add a delay to ensure state propagation in CI environments
await new Promise((resolve) => setTimeout(resolve, 500));

// Wait for the action buttons to be available (not in error state)
await waitFor(
() => {
Expand All @@ -668,21 +665,16 @@ describe("4.8.2 - Selecting rows and performing bulk actions", () => {

await user.click(moveBoxesButton);

expect(
await screen.findByRole(
"menuitem",
{
name: /wh1/i,
},
{ timeout: 10000 },
),
).toBeInTheDocument();

await user.click(
screen.getByRole("menuitem", {
// There may be multiple menuitems with the name 'WH1', so use findAllByRole
const wh1MenuItems = await screen.findAllByRole(
"menuitem",
{
name: /wh1/i,
}),
},
{ timeout: 10000 },
);
expect(wh1MenuItems.length).toBeGreaterThan(0);
await user.click(wh1MenuItems[0]);

// Wait for the UI to update after the action
await waitFor(
Expand Down
6 changes: 1 addition & 5 deletions front/src/views/Boxes/BoxesViewActions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -880,11 +880,7 @@ boxesViewActionsTests.forEach(({ name, mocks, clicks, toast, searchParams, trigg

if (clicks[1]) {
// Wait until the sub-action is present, ensuring all Menu updates are flushed
const subButton = await waitFor(
() => screen.getByText(clicks[1]),
{},
{ timeout: 10000 },
);
const subButton = await screen.findByText(clicks[1]);
expect(subButton).toBeInTheDocument();
await user.click(subButton);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,11 @@ it("4.3.1 - Initial load of Page", async () => {
// Test case 4.3.1.2 - Content: Displays Partner Orgs Select Options
await assertOptionsInSelectField(user, /organisation/i, [/boxcare/i], title);
await selectOptionInSelectField(user, /organisation/i, "BoxCare");
// Add a delay to ensure state propagation after selection
await new Promise((resolve) => setTimeout(resolve, 300));
expect(await screen.findByText("BoxCare", {}, { timeout: 10000 })).toBeInTheDocument();
// Test case 4.3.1.3 - Content: Displays Partner Bases Select Options When Partner Organisation Selected
await assertOptionsInSelectField(user, /base/i, [/samos/i, /thessaloniki/i, /athens/i], title);
await selectOptionInSelectField(user, /base/i, "Samos");
// Add a delay to ensure state propagation after selection
await new Promise((resolve) => setTimeout(resolve, 300));
expect(await screen.findByText("Samos", {}, { timeout: 10000 })).toBeInTheDocument();

// Breadcrumbs are there
expect(screen.getByRole("link", { name: /back to manage shipments/i })).toBeInTheDocument();
Expand Down
Loading