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: 3 additions & 8 deletions lib/helpers/PartialViewUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,9 @@ export class PartialViewUiHelper extends UiBaseLocators {
async enterPartialViewContent(partialViewContent: string) {
// The waits in this method is currently needed as the test will fail with expects
await this.waitUntilPartialViewLoaderIsNoLongerVisible();
await expect(this.textAreaInputArea).toBeVisible();
await this.textAreaInputArea.click({force: true});
await this.page.waitForTimeout(500);
await this.textAreaInputArea.clear();
await this.page.waitForTimeout(500);
await expect(this.textAreaInputArea).toHaveValue('');
await this.textAreaInputArea.fill(partialViewContent);
await this.page.waitForTimeout(500);
await this.enterMonacoEditorValue(partialViewContent);
// We need this wait, to be sure that the partial view content is loaded.
await this.page.waitForTimeout(200);
}

async openPartialViewAtRoot(partialViewName: string) {
Expand Down
4 changes: 1 addition & 3 deletions lib/helpers/ScriptUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ export class ScriptUiHelper extends UiBaseLocators{
}

async enterScriptContent(scriptContent: string) {
await expect(this.textAreaInputArea).toBeVisible();
await this.textAreaInputArea.clear();
await this.textAreaInputArea.fill(scriptContent);
await this.enterMonacoEditorValue(scriptContent);
}

async openScriptAtRoot(scriptName: string) {
Expand Down
3 changes: 1 addition & 2 deletions lib/helpers/StylesheetUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ export class StylesheetUiHelper extends UiBaseLocators{
}

async enterStylesheetContent(stylesheetContent: string) {
await this.textAreaInputArea.clear();
await this.textAreaInputArea.fill(stylesheetContent);
await this.enterMonacoEditorValue(stylesheetContent);
}

async openStylesheetByNameAtRoot(stylesheetName: string) {
Expand Down
3 changes: 1 addition & 2 deletions lib/helpers/TemplateUiHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ export class TemplateUiHelper extends UiBaseLocators {
async enterTemplateContent(templateContent: string) {
// We need this wait, to be sure that the template content is loaded.
await this.page.waitForTimeout(200);
await this.textAreaInputArea.clear();
await this.textAreaInputArea.fill(templateContent);
await this.enterMonacoEditorValue(templateContent);
}

async isMasterTemplateNameVisible(templateName: string, isVisible: boolean = true) {
Expand Down
12 changes: 11 additions & 1 deletion lib/helpers/UiBaseLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export class UiBaseLocators {
public readonly openEntityAction: Locator;
public readonly caretBtn: Locator;
public readonly workspaceActionMenuBtn: Locator;
public readonly monacoEditor: Locator;

constructor(page: Page) {
this.page = page;
Expand All @@ -166,7 +167,7 @@ export class UiBaseLocators {
this.queryBuilderOrderedBy = page.locator('#property-alias-dropdown').getByLabel('Property alias');
this.queryBuilderCreateDate = page.locator('#property-alias-dropdown').getByText('CreateDate').locator("..");
this.folderNameTxt = page.getByLabel('Enter a folder name');
this.textAreaInputArea = page.locator('textarea.inputarea');
this.textAreaInputArea = page.locator('textarea.ime-text-area');
this.wherePropertyAliasBtn = page.locator('#property-alias-dropdown');
this.whereOperatorBtn = page.locator('#operator-dropdown');
this.whereConstrainValueTxt = page.getByLabel('constrain value');
Expand Down Expand Up @@ -299,6 +300,7 @@ export class UiBaseLocators {
this.openEntityAction = page.locator('#action-modal[open]').locator(this.entityAction);
// Workspace Entity Action
this.workspaceActionMenuBtn = page.getByTestId('workspace:action-menu-button');
this.monacoEditor = page.locator('.monaco-editor');
}

async clickActionsMenuForNameInSectionSidebar(name: string) {
Expand Down Expand Up @@ -1398,4 +1400,12 @@ export class UiBaseLocators {
async clickLockActionMenuOption() {
await this.clickEntityActionWithName('Lock');
}

async enterMonacoEditorValue(value: string) {
await expect(this.monacoEditor).toBeVisible();
await this.monacoEditor.click();
await this.page.keyboard.press('Control+A');
await this.page.keyboard.press('Backspace');
await this.page.keyboard.insertText(value);
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umbraco/playwright-testhelpers",
"version": "16.0.49",
"version": "16.0.50",
"description": "Test helpers for making playwright tests for Umbraco solutions",
"main": "dist/lib/index.js",
"files": [
Expand Down