Skip to content

Commit c35e874

Browse files
committed
test(dashboard): Add e2e test for modify-page address update path
Regression test for the customFields blocker: editing a shipping address on the modify page via the 'New address' tab and clicking Preview must not produce a GraphQL variable coercion error (UpdateOrderAddressInput has no customFields field). The test exercises the exact path where the bug lived: modify page → Edit → New address → fill → Update address → Preview → assert dialog opens without error.
1 parent 6e59c21 commit c35e874

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

packages/dashboard/e2e/tests/sales/orders.spec.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,45 @@ test.describe('Orders', () => {
435435
await expect(page.getByRole('tab', { name: 'Existing address' })).toBeVisible();
436436
});
437437

438+
// Regression test for the customFields blocker: editing an address on the modify page
439+
// via the "New address" tab and clicking Preview should not produce a GraphQL variable
440+
// coercion error (UpdateOrderAddressInput has no customFields field).
441+
test('should update shipping address on modify page without GraphQL error', async ({ page }) => {
442+
test.setTimeout(60_000);
443+
444+
const orderId = await createModifyingOrder(page);
445+
446+
await page.goto(`/orders/${orderId}/modify`);
447+
await expect(page.getByRole('heading', { name: 'Modify order' })).toBeVisible({ timeout: 10_000 });
448+
449+
// Click "Edit" on shipping address
450+
const editButtons = page.getByRole('button', { name: 'Edit' });
451+
await editButtons.first().click();
452+
453+
// The address selector popover opens — switch to the "New address" tab
454+
const popover = page.locator('[data-slot="popover-content"]');
455+
await expect(popover).toBeVisible({ timeout: 5_000 });
456+
await popover.getByRole('tab', { name: /New address/i }).click();
457+
458+
// Fill in a new address
459+
await popover.getByLabel('Street Address').fill('456 Modified Ave');
460+
await popover.getByLabel('City').fill('Modifiedton');
461+
await popover.getByLabel('Postal Code').fill('99999');
462+
// Country — open and pick the first available
463+
await popover.getByRole('combobox').click();
464+
await page.getByRole('option').first().click();
465+
await popover.getByRole('button', { name: /Update address/i }).click();
466+
467+
// The address should appear in the modification summary
468+
await expect(page.getByText('456 Modified Ave')).toBeVisible({ timeout: 10_000 });
469+
470+
// Click Preview — this is where the customFields blocker used to cause a GraphQL error
471+
await page.getByRole('button', { name: /Preview/i }).click();
472+
473+
// The preview dialog should open without an error toast
474+
await expect(page.getByRole('dialog')).toBeVisible({ timeout: 10_000 });
475+
});
476+
438477
// #4393 — order modify page should show a "Recalculate shipping" checkbox
439478
test('should show recalculate shipping checkbox on modify page', async ({ page }) => {
440479
test.setTimeout(60_000);

0 commit comments

Comments
 (0)