-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa298f4
commit 2ec11fa
Showing
72 changed files
with
1,756 additions
and
888 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
e2e/client/playwright/page-object-models/settings/content-profile.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import {Page, expect} from '@playwright/test'; | ||
import {s} from '../../utils'; | ||
import {TreeSelectDriver} from '../../utils/tree-select-driver'; | ||
|
||
interface IOptions { | ||
profileName: string; | ||
sectionName: string; | ||
fieldName: string; | ||
formattingOptionsToAdd: Array<string>; | ||
} | ||
|
||
export class ContentProfileSettings { | ||
private page: Page; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
} | ||
|
||
public async addFormattingOptionToContentProfile(options: IOptions) { | ||
await this.page.locator(s(`content-profile=${options.profileName}`)) | ||
.getByRole('button', {name: 'Actions'}) | ||
.click(); | ||
await this.page.locator(s('content-profile-actions-popover')).getByRole('button', {name: 'Edit'}).click(); | ||
|
||
await this.page.locator(s('content-profile-edit-view')).getByRole('tab', {name: options.sectionName}).click(); | ||
await this.page.locator(s('content-profile-edit-view', `field=${options.fieldName}`)).click(); | ||
|
||
await new TreeSelectDriver( | ||
this.page, | ||
this.page.locator(s('formatting-options-input')), | ||
).setValue(options.formattingOptionsToAdd); | ||
|
||
// this is required for validation. TODO: update DB snapshot to make current items already valid | ||
await this.page.locator(s('generic-list-page', 'item-view-edit', 'gform-input--sdWidth')).selectOption('Full'); | ||
|
||
await this.page.locator(s('generic-list-page', 'item-view-edit', 'toolbar')) | ||
.getByRole('button', {name: 'Apply'}) | ||
.click(); | ||
|
||
await this.page.locator(s('content-profile-edit-view--footer')).getByRole('button', {name: 'Save'}).click(); | ||
|
||
// wait for saving to finish and modal to close | ||
await expect(this.page.locator(s('content-profile-edit-view'))).not.toBeVisible(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import {Locator, Page} from '@playwright/test'; | ||
import {s} from '.'; | ||
|
||
export class TreeSelectDriver { | ||
private page: Page; | ||
private element: Locator; | ||
|
||
constructor(page, element) { | ||
this.page = page; | ||
this.element = element; | ||
|
||
this.getValue = this.getValue.bind(this); | ||
this.addValue = this.addValue.bind(this); | ||
this.setValue = this.setValue.bind(this); | ||
} | ||
|
||
public async getValue(): Promise<Array<string>> { | ||
return this.element.locator(s('item')).all().then((buttons) => | ||
Promise.all(buttons.map((button) => button.innerText())), | ||
); | ||
} | ||
|
||
public async addValue(...options: Array<Array<string> | string>): Promise<void> { | ||
const setOptions = async (options: Array<Array<string> | string>) => { | ||
for (const option of options) { | ||
if (typeof option == 'string') { | ||
await this.element.locator(s('open-popover')).click(); | ||
await this.page.locator(s('tree-select-popover')) | ||
.getByRole('button', {name: new RegExp(option, 'i')}) | ||
.click(); | ||
} else if (option != null) { | ||
await setOptions(option); | ||
} | ||
} | ||
}; | ||
|
||
await setOptions(options); | ||
} | ||
|
||
public async setValue(...options: Array<Array<string> | string>) { | ||
const removeButton = await this.element.getByRole('button', {name: 'remove-sign'}); | ||
const removeButtonVisible = await removeButton.isVisible(); | ||
|
||
if (removeButtonVisible) { | ||
await removeButton.click(); | ||
} | ||
|
||
await this.addValue(...options); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
editor3-tables only adds tables formatting option to story content profile. It can be merged to main. The only reason it was added as a separate record is to avoid merge conflicts on open PRs. | ||
# Can easily be ported to main snapshot: | ||
|
||
* editor3-tables - adds tables formatting option to story content profile. | ||
* custom-blocks - adds custom blocks to story/body_html content profile. Creates a new custom block vocabulary. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.