Skip to content

Commit 2da10b2

Browse files
authored
V17 Removed test helper for new modal (#310)
* Updated test helper to avoid flaky tests * Cherry pick the test helper for workspace view * Added ui helper for dashboard tab * Removed test helper for new modal * Format code * Bumped version * Bumped version * Removed unused locator * Fixed comment
1 parent b6560ea commit 2da10b2

File tree

8 files changed

+22
-35
lines changed

8 files changed

+22
-35
lines changed

lib/helpers/DataTypeUiHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export class DataTypeUiHelper extends UiBaseLocators {
304304
this.tiptapExtensionsConfiguration = this.page.locator('umb-property-editor-ui-tiptap-extensions-configuration');
305305
this.propertyEditor = this.page.locator('umb-ref-property-editor-ui');
306306
this.selectIconBtn = page.getByLabel('Select icon');
307-
this.dataTypeBtn = this.createOptionActionListModal.locator('[name="Data Type"]');
307+
this.dataTypeBtn = this.createOptionActionListModal.locator('[name="New Data Type"]');
308308
this.dataTypesMenu = page.locator('#menu-item').getByRole('link', {name: 'Data Types'});
309309
this.tiptapStatusbarConfiguration = this.page.locator('umb-property-editor-ui-tiptap-statusbar-configuration');
310310

lib/helpers/DocumentTypeUiHelper.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,20 @@ export class DocumentTypeUiHelper extends UiBaseLocators {
1616
private readonly setAsDefaultBtn: Locator;
1717
private readonly tabGroup: Locator;
1818
private readonly documentTypesMenu: Locator;
19-
private readonly createDocumentModal: Locator;
2019

2120
constructor(page: Page) {
2221
super(page);
23-
this.createDocumentModal = page.locator('umb-entity-create-option-action-list-modal');
2422
this.newDocumentTypeBtn = page.getByLabel('New Document Type…');
2523
this.sharedAcrossCulturesToggle = page.locator('label').filter({hasText: 'Shared across cultures'}).locator('#toggle');
2624
this.tabGroup = page.getByTestId('workspace:view-links');
2725
this.documentTypeSettingsTabBtn = this.tabGroup.locator('[data-mark*="Settings"]');
2826
this.documentTypeTemplatesTabBtn = this.tabGroup.locator('[data-mark*="Templates"]');
2927
this.varyBySegmentsBtn = page.getByText('Vary by segment', {exact: true});
3028
this.varyByCultureBtn = page.getByText('Vary by culture', {exact: true});
31-
this.createDocumentTypeBtn = this.createDocumentModal.locator('umb-ref-item').getByText('Document Type', {exact: true});
32-
this.createDocumentTypeWithTemplateBtn = this.createDocumentModal.locator('umb-ref-item', {hasText: 'Document Type with template'});
33-
this.createElementTypeBtn = this.createDocumentModal.locator('umb-ref-item', {hasText: 'Element Type'});
34-
this.createDocumentFolderBtn = this.createDocumentModal.locator('umb-ref-item', {hasText: 'Folder'});
29+
this.createDocumentTypeBtn = page.locator('umb-ref-item').getByText('Document Type', {exact: true});
30+
this.createDocumentTypeWithTemplateBtn = page.locator('umb-ref-item').getByText('Document Type with Template', {exact: true});
31+
this.createElementTypeBtn = page.locator('umb-ref-item').getByText('Element Type', {exact: true});
32+
this.createDocumentFolderBtn = page.locator('umb-ref-item').getByText('Folder', {exact: true});
3533
this.preventCleanupBtn = page.getByText('Prevent clean up');
3634
this.setAsDefaultBtn = page.getByText('Set as default');
3735
this.documentTypesMenu = page.locator('#menu-item').getByRole('link', {name: 'Document Types'});

lib/helpers/PartialViewUiHelper.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@ export class PartialViewUiHelper extends UiBaseLocators {
77
private readonly partialViewTree: Locator;
88
private readonly partialViewUiLoader: Locator;
99
private readonly newFolderThreeDots: Locator;
10-
private readonly partialViewCreateModal: Locator;
1110

1211
constructor(page: Page) {
1312
super(page);
14-
this.partialViewCreateModal = page.locator('umb-partial-view-create-options-modal');
15-
this.newEmptyPartialViewBtn = this.partialViewCreateModal.locator('uui-menu-item', {hasText: 'Empty partial view'});
16-
this.newPartialViewFromSnippetBtn = this.partialViewCreateModal.locator('uui-menu-item', {hasText: 'Partial view from snippet'});
13+
this.newEmptyPartialViewBtn = page.getByLabel('New empty partial view');
14+
this.newPartialViewFromSnippetBtn = page.getByLabel('New partial view from snippet...');
1715
this.partialViewTree = page.locator('umb-tree[alias="Umb.Tree.PartialView"]');
1816
this.partialViewUiLoader = page.locator('uui-loader');
19-
this.newFolderThreeDots = this.partialViewCreateModal.locator('uui-menu-item', {hasText: 'Folder'});
17+
this.newFolderThreeDots = page.getByLabel('New Folder...');
2018
}
2119

2220
async clickActionsMenuForPartialView(name: string) {

lib/helpers/ScriptUiHelper.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ export class ScriptUiHelper extends UiBaseLocators{
66
private readonly newJavascriptFileBtn: Locator;
77
private readonly scriptTree: Locator;
88
private readonly newFolderThreeDots: Locator;
9-
private readonly scriptCreateModal: Locator;
109

1110
constructor(page: Page) {
1211
super(page);
13-
this.scriptCreateModal = page.locator('umb-script-create-options-modal');
14-
this.newJavascriptFileBtn = this.scriptCreateModal.locator('umb-ref-item', {hasText: 'JavaScript file'});
15-
this.newFolderThreeDots = this.scriptCreateModal.locator('umb-ref-item', {hasText: 'Folder'});
12+
this.newJavascriptFileBtn = page.getByRole('link', {name: 'New Javascript file'});
1613
this.scriptTree = page.locator('umb-tree[alias="Umb.Tree.Script"]');
14+
this.newFolderThreeDots = page.getByRole('button', {name: 'New Folder...'});
1715
}
1816

1917
async clickActionsMenuForScript(name: string) {

lib/helpers/StylesheetUiHelper.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
import {Page, Locator, expect} from "@playwright/test"
22
import {UiBaseLocators} from "./UiBaseLocators";
3-
import { ConstantHelper } from "./ConstantHelper";
3+
import {ConstantHelper} from "./ConstantHelper";
44

55
export class StylesheetUiHelper extends UiBaseLocators{
66
private readonly newStylesheetBtn: Locator;
7-
private readonly newStylesheetFolderBtn: Locator;
87
private readonly stylesheetNameTxt: Locator;
98
private readonly stylesheetTree: Locator;
10-
private readonly stylesheetCreateModal: Locator;
119

1210
constructor(page: Page) {
1311
super(page);
14-
this.stylesheetCreateModal = page.locator('umb-entity-create-option-action-list-modal');
15-
this.newStylesheetBtn = this.stylesheetCreateModal.locator('umb-ref-item', {hasText: 'Stylesheet'});
16-
this.newStylesheetFolderBtn = this.stylesheetCreateModal.locator('umb-ref-item', {hasText: 'Folder'});
1712
this.stylesheetNameTxt = page.locator('umb-stylesheet-workspace-editor').locator('#nameInput #input');
13+
this.newStylesheetBtn = this.createOptionActionListModal.locator('[name="New Stylesheet"]');
1814
this.stylesheetTree = page.locator('umb-tree[alias="Umb.Tree.Stylesheet"]');
1915
}
2016

@@ -24,7 +20,7 @@ export class StylesheetUiHelper extends UiBaseLocators{
2420

2521
async createStylesheetFolder(folderName: string) {
2622
await this.clickCreateActionMenuOption();
27-
await this.clickNewStylesheetFolderButton();
23+
await this.clickFolderButton();
2824
await this.enterFolderName(folderName);
2925
await this.clickConfirmCreateFolderButton();
3026
}
@@ -41,11 +37,6 @@ export class StylesheetUiHelper extends UiBaseLocators{
4137
await expect(this.newStylesheetBtn).toBeVisible();
4238
await this.newStylesheetBtn.click();
4339
}
44-
45-
async clickNewStylesheetFolderButton() {
46-
await expect(this.newStylesheetFolderBtn).toBeVisible();
47-
await this.newStylesheetFolderBtn.click();
48-
}
4940

5041
async waitForStylesheetToBeCreated() {
5142
await this.waitForNetworkToBeIdle();

lib/helpers/UiBaseLocators.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ export class UiBaseLocators {
152152
public readonly createNewDocumentBlueprintBtn: Locator;
153153
public readonly openedModal: Locator;
154154
public readonly uiLoader: Locator;
155-
public readonly createDocumentBlueprintModal: Locator;
156155

157156
constructor(page: Page) {
158157
this.page = page;
@@ -265,9 +264,8 @@ export class UiBaseLocators {
265264
this.gridBtn = page.getByLabel('Grid');
266265
this.listBtn = page.getByLabel('List');
267266
this.viewBundleBtn = page.locator('umb-collection-view-bundle uui-button svg');
268-
this.createDocumentBlueprintModal = page.locator('umb-document-blueprint-options-create-modal');
269267
this.createDocumentBlueprintBtn = page.getByLabel(/^Create Document Blueprint()?$/);
270-
this.createNewDocumentBlueprintBtn = this.createDocumentBlueprintModal.locator('umb-ref-item', {hasText: 'Document Blueprint for'});
268+
this.createNewDocumentBlueprintBtn = page.getByRole('button', { name: 'New Document Blueprint for...' });
271269
this.chooseDocumentInputBtn = page.locator('umb-input-document').getByLabel('Choose');
272270
this.chooseMediaInputBtn = page.locator('umb-input-media').getByLabel('Choose');
273271
this.container = page.locator('#container');
@@ -292,7 +290,7 @@ export class UiBaseLocators {
292290
this.createActionButtonCollection = page.locator('umb-collection-create-action-button');
293291
this.createActionBtn = this.createActionButtonCollection.locator('[label="Create"]');
294292
this.collectionTreeItemTableRow = page.locator('umb-collection-workspace-view umb-table uui-table-row');
295-
this.folderBtn = this.createOptionActionListModal.locator('umb-ref-item', {hasText: 'Folder'});
293+
this.folderBtn = this.createOptionActionListModal.locator('[name="Folder"]');
296294
this.reloadChildrenBtn = page.getByRole('button', {name: 'Reload children'});
297295
this.confirmActionModalEntityReferences = page.locator('umb-confirm-action-modal-entity-references,umb-confirm-bulk-action-modal-entity-references');
298296
this.referenceHeadline = this.confirmActionModalEntityReferences.locator('#reference-headline').first();
@@ -1425,4 +1423,8 @@ export class UiBaseLocators {
14251423
async isWorkspaceViewTabWithAliasVisible(alias: string, isVisible: boolean = true) {
14261424
await expect(this.page.getByTestId('workspace:view-link:' + alias)).toBeVisible({ visible: isVisible });
14271425
}
1426+
1427+
async isDashboardTabWithNameVisible(name: string, isVisible: boolean = true) {
1428+
await expect(this.page.locator('uui-tab[label="' + name + '"]')).toBeVisible({visible: isVisible});
1429+
}
14281430
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@umbraco/playwright-testhelpers",
3-
"version": "17.0.0-beta.8",
3+
"version": "17.0.0-beta.9",
44
"description": "Test helpers for making playwright tests for Umbraco solutions",
55
"main": "dist/lib/index.js",
66
"files": [

0 commit comments

Comments
 (0)