Skip to content

Commit 5c59665

Browse files
committed
fix: update success message and fix e2e
1 parent 1dc9936 commit 5c59665

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

packages/slice-machine/src/legacy/lib/builders/CustomTypeBuilder/SliceZone/index.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
334334
location={`${customType.format}_type`}
335335
typeName={customType.label ?? customType.id}
336336
availableSlices={availableSlicesToAdd}
337-
onSuccess={({ slices, library }) => {
337+
onSuccess={({ slices }) => {
338338
const newCustomType = addSlicesToSliceZone({
339339
customType,
340340
tabId,
@@ -343,12 +343,7 @@ const SliceZone: React.FC<SliceZoneProps> = ({
343343
setCustomType({
344344
customType: CustomTypes.fromSM(newCustomType),
345345
onSaveCallback: () => {
346-
toast.success(
347-
<ToastMessageWithPath
348-
message="Slice(s) added to slice zone and created at: "
349-
path={library ?? ""}
350-
/>,
351-
);
346+
toast.success("Slices successfully added");
352347
},
353348
});
354349
void completeStep("createSlice");

playwright/pages/components/Dialog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class Dialog {
66
readonly title: Locator;
77
readonly closeButton: Locator;
88
readonly cancelButton: Locator;
9-
readonly submitButton: Locator;
9+
protected submitButton: Locator;
1010

1111
constructor(
1212
page: Page,

playwright/pages/components/SelectExistingSlicesDialog.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,20 @@ export class SelectExistingSlicesDialog extends Dialog {
88

99
constructor(page: Page) {
1010
super(page, {
11-
title: `Select existing slices`,
11+
title: "Reuse an existing slice",
1212
submitName: "Add",
1313
});
1414

1515
/**
1616
* Static locators
1717
*/
1818
this.sharedSliceCard = this.dialog.getByTestId("shared-slice-card");
19-
this.addedMessage = page.getByText("Slice(s) added to slice zone", {
19+
this.addedMessage = page.getByText("Slices successfully added", {
20+
exact: true,
21+
});
22+
this.submitButton = this.dialog.getByRole("button", {
23+
// Match "Add to <slice zone name> (<number of slices>)"
24+
name: new RegExp(`^Add to .+ \\(\\d+\\)$`),
2025
exact: true,
2126
});
2227
}

0 commit comments

Comments
 (0)