@umbraco/playwright-testhelpers 17.0.0-beta.1 → 17.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/lib/helpers/ApiHelpers.d.ts +23 -13
  2. package/dist/lib/helpers/ApiHelpers.js +107 -49
  3. package/dist/lib/helpers/ApiHelpers.js.map +1 -1
  4. package/dist/lib/helpers/ConstantHelper.d.ts +8 -3
  5. package/dist/lib/helpers/ConstantHelper.js +20 -15
  6. package/dist/lib/helpers/ConstantHelper.js.map +1 -1
  7. package/dist/lib/helpers/ContentUiHelper.d.ts +4 -3
  8. package/dist/lib/helpers/ContentUiHelper.js +16 -12
  9. package/dist/lib/helpers/ContentUiHelper.js.map +1 -1
  10. package/dist/lib/helpers/DataTypeApiHelper.d.ts +3 -0
  11. package/dist/lib/helpers/DataTypeApiHelper.js +21 -0
  12. package/dist/lib/helpers/DataTypeApiHelper.js.map +1 -1
  13. package/dist/lib/helpers/DataTypeUiHelper.d.ts +3 -0
  14. package/dist/lib/helpers/DataTypeUiHelper.js +15 -2
  15. package/dist/lib/helpers/DataTypeUiHelper.js.map +1 -1
  16. package/dist/lib/helpers/DocumentBlueprintUiHelper.d.ts +1 -0
  17. package/dist/lib/helpers/DocumentBlueprintUiHelper.js +3 -0
  18. package/dist/lib/helpers/DocumentBlueprintUiHelper.js.map +1 -1
  19. package/dist/lib/helpers/DocumentTypeUiHelper.d.ts +1 -0
  20. package/dist/lib/helpers/DocumentTypeUiHelper.js +6 -4
  21. package/dist/lib/helpers/DocumentTypeUiHelper.js.map +1 -1
  22. package/dist/lib/helpers/LanguageUiHelper.d.ts +1 -0
  23. package/dist/lib/helpers/LanguageUiHelper.js +3 -1
  24. package/dist/lib/helpers/LanguageUiHelper.js.map +1 -1
  25. package/dist/lib/helpers/LoginApiHelper.d.ts +7 -3
  26. package/dist/lib/helpers/LoginApiHelper.js +7 -5
  27. package/dist/lib/helpers/LoginApiHelper.js.map +1 -1
  28. package/dist/lib/helpers/PartialViewUiHelper.d.ts +1 -0
  29. package/dist/lib/helpers/PartialViewUiHelper.js +5 -3
  30. package/dist/lib/helpers/PartialViewUiHelper.js.map +1 -1
  31. package/dist/lib/helpers/RelationTypeUiHelper.js +1 -0
  32. package/dist/lib/helpers/RelationTypeUiHelper.js.map +1 -1
  33. package/dist/lib/helpers/ScriptUiHelper.d.ts +1 -0
  34. package/dist/lib/helpers/ScriptUiHelper.js +6 -2
  35. package/dist/lib/helpers/ScriptUiHelper.js.map +1 -1
  36. package/dist/lib/helpers/StylesheetUiHelper.d.ts +3 -0
  37. package/dist/lib/helpers/StylesheetUiHelper.js +11 -2
  38. package/dist/lib/helpers/StylesheetUiHelper.js.map +1 -1
  39. package/dist/lib/helpers/UiBaseLocators.d.ts +10 -1
  40. package/dist/lib/helpers/UiBaseLocators.js +42 -12
  41. package/dist/lib/helpers/UiBaseLocators.js.map +1 -1
  42. package/dist/lib/helpers/UserApiHelper.d.ts +6 -2
  43. package/dist/lib/helpers/UserApiHelper.js +1 -1
  44. package/dist/lib/helpers/UserApiHelper.js.map +1 -1
  45. package/dist/lib/helpers/UserGroupUiHelper.js +1 -1
  46. package/dist/lib/helpers/UserGroupUiHelper.js.map +1 -1
  47. package/dist/lib/helpers/UserUiHelper.d.ts +0 -1
  48. package/dist/lib/helpers/UserUiHelper.js +0 -2
  49. package/dist/lib/helpers/UserUiHelper.js.map +1 -1
  50. package/dist/tsconfig.tsbuildinfo +1 -1
  51. package/package.json +2 -2
@@ -151,6 +151,12 @@ class UiBaseLocators {
151
151
  caretBtn;
152
152
  workspaceActionMenuBtn;
153
153
  monacoEditor;
154
+ createNewDocumentBlueprintBtn;
155
+ openedModal;
156
+ uiLoader;
157
+ createDocumentBlueprintModal;
158
+ entityItem;
159
+ sectionLinks;
154
160
  constructor(page) {
155
161
  this.page = page;
156
162
  this.saveBtn = page.getByLabel('Save', { exact: true });
@@ -213,7 +219,7 @@ class UiBaseLocators {
213
219
  this.addPropertyBtn = page.getByLabel('Add property', { exact: true });
214
220
  this.typeToFilterSearchTxt = page.locator('[type="search"] #input');
215
221
  this.editorSettingsBtn = page.getByLabel('Editor settings');
216
- this.labelAboveBtn = page.locator('button').filter({ hasText: 'Label above' });
222
+ this.labelAboveBtn = page.locator('.appearance-option').filter({ hasText: 'Label above' });
217
223
  // tab: means that the tab is unnamed
218
224
  this.unnamedTabTxt = page.getByTestId('tab:').getByTestId('tab:name-input').locator('#input');
219
225
  this.deleteThreeDotsBtn = page.getByLabel('Delete…');
@@ -262,7 +268,9 @@ class UiBaseLocators {
262
268
  this.gridBtn = page.getByLabel('Grid');
263
269
  this.listBtn = page.getByLabel('List');
264
270
  this.viewBundleBtn = page.locator('umb-collection-view-bundle uui-button svg');
271
+ this.createDocumentBlueprintModal = page.locator('umb-document-blueprint-options-create-modal');
265
272
  this.createDocumentBlueprintBtn = page.getByLabel(/^Create Document Blueprint(…)?$/);
273
+ this.createNewDocumentBlueprintBtn = this.createDocumentBlueprintModal.locator('umb-ref-item', { hasText: 'Document Blueprint for' });
266
274
  this.chooseDocumentInputBtn = page.locator('umb-input-document').getByLabel('Choose');
267
275
  this.chooseMediaInputBtn = page.locator('umb-input-media').getByLabel('Choose');
268
276
  this.container = page.locator('#container');
@@ -287,21 +295,24 @@ class UiBaseLocators {
287
295
  this.createActionButtonCollection = page.locator('umb-collection-create-action-button');
288
296
  this.createActionBtn = this.createActionButtonCollection.locator('[label="Create"]');
289
297
  this.collectionTreeItemTableRow = page.locator('umb-collection-workspace-view umb-table uui-table-row');
290
- this.folderBtn = this.createOptionActionListModal.locator('[name="Folder"]');
298
+ this.folderBtn = this.createOptionActionListModal.locator('umb-ref-item', { hasText: 'Folder' });
291
299
  this.reloadChildrenBtn = page.getByRole('button', { name: 'Reload children' });
292
300
  this.confirmActionModalEntityReferences = page.locator('umb-confirm-action-modal-entity-references,umb-confirm-bulk-action-modal-entity-references');
293
- this.referenceHeadline = this.confirmActionModalEntityReferences.locator('#reference-headline');
294
- this.entityItemRef = this.confirmActionModalEntityReferences.locator('umb-entity-item-ref');
301
+ this.referenceHeadline = this.confirmActionModalEntityReferences.locator('#reference-headline').first();
302
+ this.entityItemRef = this.confirmActionModalEntityReferences.locator('uui-ref-list').first().getByTestId('entity-item-ref');
295
303
  this.validationMessage = page.locator('umb-form-validation-message').locator('#messages');
296
304
  this.successStateIcon = this.successState.locator('#state');
297
305
  this.workspaceAction = page.locator('umb-workspace-action');
298
306
  this.caretBtn = page.locator('#caret-button');
307
+ this.sectionLinks = page.getByTestId('section-links');
299
308
  // Entity Action
300
309
  this.entityAction = page.locator('umb-entity-action-list umb-entity-action');
301
310
  this.openEntityAction = page.locator('#action-modal[open]').locator(this.entityAction);
302
311
  // Workspace Entity Action
303
312
  this.workspaceActionMenuBtn = page.getByTestId('workspace:action-menu-button');
304
313
  this.monacoEditor = page.locator('.monaco-editor');
314
+ this.openedModal = page.locator('uui-modal-container[backdrop]');
315
+ this.uiLoader = page.locator('uui-loader');
305
316
  }
306
317
  async clickActionsMenuForNameInSectionSidebar(name) {
307
318
  await this.sectionSidebar.locator('[label="' + name + '"]').hover();
@@ -309,6 +320,8 @@ class UiBaseLocators {
309
320
  }
310
321
  async clickActionsMenuForName(name) {
311
322
  await (0, test_1.expect)(this.page.locator('uui-menu-item[label="' + name + '"]').locator('#menu-item').first()).toBeVisible();
323
+ // We need to wait for the load to be finished, otherwise we would run into flaky tests
324
+ await this.page.waitForTimeout(2000);
312
325
  await this.page.locator('uui-menu-item[label="' + name + '"]').locator('#menu-item').first().hover({ force: true });
313
326
  await this.page.locator('uui-menu-item[label="' + name + '"] #action-modal').first().click({ force: true });
314
327
  }
@@ -583,10 +596,17 @@ class UiBaseLocators {
583
596
  async goToSection(sectionName, checkSections = true) {
584
597
  if (checkSections) {
585
598
  for (let section in ConstantHelper_1.ConstantHelper.sections) {
586
- await (0, test_1.expect)(this.backOfficeHeader.getByRole('tab', { name: ConstantHelper_1.ConstantHelper.sections[section] })).toBeVisible({ timeout: 30000 });
599
+ await (0, test_1.expect)(this.sectionLinks.getByRole('tab', { name: ConstantHelper_1.ConstantHelper.sections[section] })).toBeVisible({ timeout: 30000 });
587
600
  }
588
601
  }
589
- await this.backOfficeHeader.getByRole('tab', { name: sectionName }).click();
602
+ // We need to check if we are on the section tab already, if we are, then we need to reload the page instead of clicking again
603
+ const alreadySelected = await this.sectionLinks.locator('[active]').getByText(sectionName).isVisible();
604
+ if (alreadySelected) {
605
+ await this.page.reload();
606
+ }
607
+ else {
608
+ await this.backOfficeHeader.getByRole('tab', { name: sectionName }).click();
609
+ }
590
610
  }
591
611
  async goToSettingsTreeItem(settingsTreeItemName) {
592
612
  await this.goToSection(ConstantHelper_1.ConstantHelper.sections.settings);
@@ -1005,9 +1025,10 @@ class UiBaseLocators {
1005
1025
  await (0, test_1.expect)(this.mediaPickerModalSubmitBtn).toBeVisible();
1006
1026
  await this.mediaPickerModalSubmitBtn.click();
1007
1027
  }
1008
- async selectMediaWithName(mediaName) {
1009
- await (0, test_1.expect)(this.mediaCardItems.filter({ hasText: mediaName })).toBeVisible();
1010
- await this.mediaCardItems.filter({ hasText: mediaName }).click({ position: { x: 0.5, y: 0.5 } });
1028
+ async selectMediaWithName(mediaName, isForce = false) {
1029
+ const mediaLocator = this.mediaCardItems.filter({ hasText: mediaName });
1030
+ await (0, test_1.expect)(mediaLocator).toBeVisible();
1031
+ await mediaLocator.click({ position: { x: 0.5, y: 0.5 }, force: isForce });
1011
1032
  }
1012
1033
  async selectMediaWithTestId(mediaKey) {
1013
1034
  const locator = this.page.getByTestId('media:' + mediaKey);
@@ -1080,7 +1101,7 @@ class UiBaseLocators {
1080
1101
  await this.folderBtn.click();
1081
1102
  }
1082
1103
  async doesReferenceHeadlineHaveText(text) {
1083
- await (0, test_1.expect)(this.referenceHeadline).toHaveText(text);
1104
+ await (0, test_1.expect)(this.referenceHeadline).toContainText(text);
1084
1105
  }
1085
1106
  async isReferenceHeadlineVisible(isVisible) {
1086
1107
  await (0, test_1.expect)(this.referenceHeadline).toBeVisible({ visible: isVisible });
@@ -1174,8 +1195,8 @@ class UiBaseLocators {
1174
1195
  await this.clickEntityActionWithName('Update');
1175
1196
  }
1176
1197
  async clickModalMenuItemWithName(name) {
1177
- await (0, test_1.expect)(this.sidebarModal.locator('uui-menu-item[label="' + name + '"]')).toBeVisible();
1178
- await this.sidebarModal.locator('uui-menu-item[label="' + name + '"]').click();
1198
+ await (0, test_1.expect)(this.openedModal.locator('uui-menu-item[label="' + name + '"]')).toBeVisible();
1199
+ await this.openedModal.locator('uui-menu-item[label="' + name + '"]').click();
1179
1200
  }
1180
1201
  async isModalMenuItemWithNameDisabled(name) {
1181
1202
  await (0, test_1.expect)(this.sidebarModal.locator('uui-menu-item[label="' + name + '"]')).toHaveAttribute('disabled');
@@ -1203,6 +1224,9 @@ class UiBaseLocators {
1203
1224
  async clickLockActionMenuOption() {
1204
1225
  await this.clickEntityActionWithName('Lock');
1205
1226
  }
1227
+ async isDashboardTabWithNameVisible(name, isVisible = true) {
1228
+ await (0, test_1.expect)(this.page.locator('uui-tab[label="' + name + '"]')).toBeVisible({ visible: isVisible });
1229
+ }
1206
1230
  async enterMonacoEditorValue(value) {
1207
1231
  await (0, test_1.expect)(this.monacoEditor).toBeVisible();
1208
1232
  await this.monacoEditor.click();
@@ -1210,6 +1234,12 @@ class UiBaseLocators {
1210
1234
  await this.page.keyboard.press('Backspace');
1211
1235
  await this.page.keyboard.insertText(value);
1212
1236
  }
1237
+ async waitUntilUiLoaderIsNoLongerVisible() {
1238
+ await (0, test_1.expect)(this.uiLoader).toBeVisible({ visible: false, timeout: 10000 });
1239
+ }
1240
+ async isWorkspaceViewTabWithAliasVisible(alias, isVisible = true) {
1241
+ await (0, test_1.expect)(this.page.getByTestId('workspace:view-link:' + alias)).toBeVisible({ visible: isVisible });
1242
+ }
1213
1243
  }
1214
1244
  exports.UiBaseLocators = UiBaseLocators;
1215
1245
  //# sourceMappingURL=UiBaseLocators.js.map