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
11 changes: 7 additions & 4 deletions core-web/apps/dotcms-ui-e2e/src/pages/newEditContentForm.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ export class NewEditContentFormPage {
}

/**
* Clicks the primary workflow action button (Save or Publish) and waits for the API response.
* New content shows "Save", existing content shows "Publish".
* Clicks the workflow action that persists the content (Save or Publish) and waits for the API response.
* Prefer "Save" when both Save and Publish are visible — the new command bar can show multiple
* workflow buttons at once, so a single regex locator would match 2+ roles and break strict mode.
*/
async save() {
// Match either Save or Publish — the primary action button
const actionButton = this.page.getByRole('button', { name: /^(Save|Publish)$/ });
const saveButton = this.page.getByRole('button', { name: 'Save' });
const publishButton = this.page.getByRole('button', { name: 'Publish' });
const actionButton = (await saveButton.isVisible()) ? saveButton : publishButton;

await expect(actionButton).toBeVisible();

const responsePromise = this.page.waitForResponse((response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@
identifier: currentIdentifier
})
"
[actions]="actions"
[groupActions]="true" />
[actions]="actions" />
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
@for (action of $groupedActions(); track $index) {
@let mainAction = action.mainAction;
@let subActions = action.subActions;
@if (subActions.length) {
<p-splitButton
(onClick)="mainAction?.command({ originalEvent: $event })"
[disabled]="loading() || disabled()"
[size]="getButtonSize()"
[model]="subActions"
[outlined]="!$first"
[label]="mainAction.label" />
} @else {
<p-button
(onClick)="mainAction?.command({ originalEvent: $event })"
[loading]="loading()"
[disabled]="disabled()"
[size]="getButtonSize()"
[variant]="!$first ? 'outlined' : undefined"
[label]="mainAction.label" />
}
} @empty {
@if ($flatActions().length === 0) {
<p-button
[loading]="loading()"
[disabled]="!loading()"
[size]="getButtonSize()"
[label]="(loading() ? 'Loading' : 'edit.ema.page.no.workflow.action') | dm"
data-testId="empty-button" />
} @else {
@if ($overflowActions().length) {
<p-menu #overflowMenu [model]="$overflowActions()" [popup]="true" appendTo="body" />
<p-button
(onClick)="overflowMenu.toggle($event)"
[rounded]="true"
[size]="getButtonSize()"
[disabled]="loading() || disabled()"
icon="pi pi-ellipsis-v"
Comment thread
adrianjm-dotCMS marked this conversation as resolved.
[variant]="'outlined'"
data-testId="overflow-button" />
}
@for (action of $visibleActions(); track action.id; let idx = $index; let first = $first) {
<p-button
(onClick)="fireAction(action)"
[loading]="first && loading()"
[disabled]="loading() || disabled()"
[size]="getButtonSize()"
[variant]="getVariant(idx)"
[label]="action.name"
[attr.data-testId]="'action-button-' + action.id" />
}
}
Loading
Loading