Skip to content

Commit 0a019af

Browse files
committed
fix(studio): drop the unused act imports; the live journey presses Save for the extension
The customize journey's extension step now asserts the new save: nothing is written before the top bar's Save, which writes the extension's draft into the pair and publishes that one item there, leaving no draft. Claude-Session: https://claude.ai/code/session_01ADHkmPsv99YG2tCHoSe8Nb Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1d6c084 commit 0a019af

8 files changed

Lines changed: 41 additions & 14 deletions

‎ui/e2e/live/studio-customize-journey.spec.ts‎

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test as base, expect, type APIRequestContext, type Page, type Response } from '@playwright/test';
1+
import { test as base, expect, type APIRequestContext, type Page, type Request, type Response } from '@playwright/test';
22

33
/**
44
* Live e2e for the ADR-0146 customization journey, walked through the Studio
@@ -12,9 +12,10 @@ import { test as base, expect, type APIRequestContext, type Page, type Response
1212
* type's list) — not what the canvas draws.
1313
* 2. Restore package original: the pair's draft and row are deleted at the
1414
* pair, and the three reads serve the shipped column set again.
15-
* 3. Add `region__c`: Add field on the base object's Form writes an
16-
* `object_extension` into the pair; once published, the base object is
17-
* served with the field and the pair's own read and export carry it.
15+
* 3. Add `region__c`: Add field on the base object's Form, then the top
16+
* bar's Save (objectstack#36511), writes an `object_extension` into the
17+
* pair and publishes that one item there, so the base object is served
18+
* with the field at once and the pair's own read and export carry it.
1819
* 4. Uninstall the base: the uninstall door refuses the read-only showcase
1920
* with 422 `WRITABLE_PACKAGE_REQUIRED` and removes nothing. This is the
2021
* refusal `main` answers here, and the one asserted: `DELETE
@@ -230,19 +231,45 @@ test('a read-only base is customized, restored and extended through Studio, and
230231
await page.getByTestId('add-field-label-input').fill(FIELD.label);
231232
await expect(page.getByTestId('add-field-api-name-preview')).toContainText(FIELD.name);
232233

234+
// objectstack#36511 — the add stays on the page until the top bar's
235+
// Save: no write of the extension leaves before it is pressed.
236+
const extensionWrites: string[] = [];
237+
const onRequest = (r: Request) => {
238+
if (r.method() !== 'GET' && r.url().includes(`/api/v1/meta/object_extension/${OBJECT}`)) {
239+
extensionWrites.push(`${r.method()} ${r.url()}`);
240+
}
241+
};
242+
page.on('request', onRequest);
243+
await page.getByTestId('add-field-create').click();
244+
await expect(page.getByTestId('studio-save')).toBeVisible();
245+
expect(extensionWrites).toEqual([]);
246+
247+
// Save writes the extension's draft into the pair, then publishes that
248+
// one item there: live at once, with no package publish.
233249
const drafted = page.waitForResponse(
234250
(r) => r.request().method() === 'PUT' && r.url().includes(`/api/v1/meta/object_extension/${OBJECT}?`),
235251
);
236-
await page.getByTestId('add-field-create').click();
252+
const published = page.waitForResponse(
253+
(r) => r.request().method() === 'POST' && r.url().includes(`/api/v1/meta/object_extension/${OBJECT}/publish`),
254+
);
255+
await page.getByTestId('studio-save').click();
237256
const draft = await drafted;
238257
expect(draft.ok(), await draft.text()).toBeTruthy();
239258
expect(new URL(draft.url()).searchParams.get('package')).toBe(PAIR);
259+
expect(new URL(draft.url()).searchParams.get('mode')).toBe('draft');
240260
expect(draft.request().postDataJSON()).toEqual({
241261
extend: OBJECT,
242262
fields: { [FIELD.name]: { type: 'text', label: FIELD.label } },
243263
});
244-
245-
await publishPair(page);
264+
const publish = await published;
265+
expect(publish.ok(), await publish.text()).toBeTruthy();
266+
expect(new URL(publish.url()).searchParams.get('package')).toBe(PAIR);
267+
// The Save left nothing to save, and no draft for the package publish.
268+
await expect(page.getByTestId('studio-save')).toHaveCount(0);
269+
page.off('request', onRequest);
270+
expect(extensionWrites.map((w) => w.split(' ')[0])).toEqual(['PUT', 'POST']);
271+
const pending = await request.get(`${API}/api/v1/meta/object_extension/${OBJECT}?state=draft&package=${PAIR}`);
272+
expect(pending.status(), await pending.text()).toBe(404);
246273
const object = await request.get(`${API}/api/v1/meta/object/${OBJECT}`);
247274
expect(object.ok(), await object.text()).toBeTruthy();
248275
const objectBody = await object.json();

‎ui/packages/app-shell/src/views/studio-design/DataPillar.actionRefusal-26736.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import '@testing-library/jest-dom/vitest';
2828
import * as React from 'react';
2929
import { afterEach, describe, expect, it, vi } from 'vitest';
30-
import { render, screen, fireEvent, cleanup, act, waitFor, within } from '@testing-library/react';
30+
import { render, screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react';
3131
import { MemoryRouter } from 'react-router-dom';
3232
import { MetadataClient } from '@object-ui/data-objectstack';
3333
import { ActionSchema } from '@objectstack/spec/ui';

‎ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import '@testing-library/jest-dom/vitest';
2828
import * as React from 'react';
2929
import { afterEach, describe, expect, it, vi } from 'vitest';
30-
import { render, screen, fireEvent, cleanup, act, within } from '@testing-library/react';
30+
import { render, screen, fireEvent, cleanup, within } from '@testing-library/react';
3131
import userEvent from '@testing-library/user-event';
3232
import { MemoryRouter } from 'react-router-dom';
3333
import { MetadataClient } from '@object-ui/data-objectstack';

‎ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import '@testing-library/jest-dom/vitest';
3030
import * as React from 'react';
3131
import { afterEach, describe, expect, it, vi } from 'vitest';
32-
import { render, screen, fireEvent, cleanup, waitFor, act } from '@testing-library/react';
32+
import { render, screen, fireEvent, cleanup, waitFor } from '@testing-library/react';
3333
import userEvent from '@testing-library/user-event';
3434
import { MemoryRouter } from 'react-router-dom';
3535
import { MetadataClient } from '@object-ui/data-objectstack';

‎ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import '@testing-library/jest-dom/vitest';
2525
import * as React from 'react';
2626
import { afterEach, describe, expect, it, vi } from 'vitest';
27-
import { render, screen, fireEvent, cleanup, act, waitFor, within } from '@testing-library/react';
27+
import { render, screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react';
2828
import userEvent from '@testing-library/user-event';
2929
import { MemoryRouter } from 'react-router-dom';
3030
import { MetadataClient } from '@object-ui/data-objectstack';

‎ui/packages/app-shell/src/views/studio-design/DataPillar.picklistServedOptions-10202.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
2323
// Module scope as well as in the `vi.mock` factory below: the cold transform is paid
2424
// during collection, which no test or hook timeout clocks (AGENTS.md, flaky-test discipline).
2525
import '@object-ui/components';
26-
import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
26+
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
2727
import { MemoryRouter } from 'react-router-dom';
2828
import { MetadataClient } from '@object-ui/data-objectstack';
2929

‎ui/packages/app-shell/src/views/studio-design/DataPillar.showMeFocus-26730.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import '@testing-library/jest-dom/vitest';
1818
import * as React from 'react';
1919
import { afterEach, describe, expect, it, vi } from 'vitest';
20-
import { render, screen, fireEvent, cleanup, act, waitFor, within } from '@testing-library/react';
20+
import { render, screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react';
2121
import { MemoryRouter } from 'react-router-dom';
2222
import { MetadataClient } from '@object-ui/data-objectstack';
2323

‎ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import '@testing-library/jest-dom/vitest';
2121
import * as React from 'react';
2222
import { afterEach, describe, expect, it, vi } from 'vitest';
23-
import { render, screen, fireEvent, cleanup, act, waitFor, within } from '@testing-library/react';
23+
import { render, screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react';
2424
import { MemoryRouter } from 'react-router-dom';
2525
import { MetadataClient } from '@object-ui/data-objectstack';
2626

0 commit comments

Comments
 (0)