@umbraco/playwright-testhelpers 2.0.0-beta.9 → 15.0.0-beta.2

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 (187) hide show
  1. package/dist/lib/helpers/ApiHelpers.d.ts +44 -4
  2. package/dist/lib/helpers/ApiHelpers.js +212 -7
  3. package/dist/lib/helpers/ApiHelpers.js.map +1 -1
  4. package/dist/lib/helpers/ConstantHelper.js +1 -1
  5. package/dist/lib/helpers/ConstantHelper.js.map +1 -1
  6. package/dist/lib/helpers/ContentUiHelper.d.ts +186 -0
  7. package/dist/lib/helpers/ContentUiHelper.js +559 -0
  8. package/dist/lib/helpers/ContentUiHelper.js.map +1 -0
  9. package/dist/lib/helpers/DataTypeApiHelper.d.ts +95 -14
  10. package/dist/lib/helpers/DataTypeApiHelper.js +829 -130
  11. package/dist/lib/helpers/DataTypeApiHelper.js.map +1 -1
  12. package/dist/lib/helpers/DataTypeUiHelper.d.ts +266 -0
  13. package/dist/lib/helpers/DataTypeUiHelper.js +850 -0
  14. package/dist/lib/helpers/DataTypeUiHelper.js.map +1 -0
  15. package/dist/lib/helpers/DictionaryApiHelper.d.ts +2 -1
  16. package/dist/lib/helpers/DictionaryApiHelper.js +17 -4
  17. package/dist/lib/helpers/DictionaryApiHelper.js.map +1 -1
  18. package/dist/lib/helpers/DictionaryUiHelper.d.ts +7 -9
  19. package/dist/lib/helpers/DictionaryUiHelper.js +33 -33
  20. package/dist/lib/helpers/DictionaryUiHelper.js.map +1 -1
  21. package/dist/lib/helpers/DocumentApiHelper.d.ts +38 -0
  22. package/dist/lib/helpers/DocumentApiHelper.js +365 -0
  23. package/dist/lib/helpers/DocumentApiHelper.js.map +1 -1
  24. package/dist/lib/helpers/DocumentBlueprintApiHelper.d.ts +18 -0
  25. package/dist/lib/helpers/DocumentBlueprintApiHelper.js +126 -0
  26. package/dist/lib/helpers/DocumentBlueprintApiHelper.js.map +1 -0
  27. package/dist/lib/helpers/DocumentBlueprintUiHelper.d.ts +17 -0
  28. package/dist/lib/helpers/DocumentBlueprintUiHelper.js +52 -0
  29. package/dist/lib/helpers/DocumentBlueprintUiHelper.js.map +1 -0
  30. package/dist/lib/helpers/DocumentTypeApiHelper.d.ts +42 -0
  31. package/dist/lib/helpers/DocumentTypeApiHelper.js +551 -0
  32. package/dist/lib/helpers/DocumentTypeApiHelper.js.map +1 -0
  33. package/dist/lib/helpers/DocumentTypeUiHelper.d.ts +35 -0
  34. package/dist/lib/helpers/DocumentTypeUiHelper.js +98 -0
  35. package/dist/lib/helpers/DocumentTypeUiHelper.js.map +1 -0
  36. package/dist/lib/helpers/ExamineManagementUiHelper.d.ts +15 -0
  37. package/dist/lib/helpers/ExamineManagementUiHelper.js +38 -0
  38. package/dist/lib/helpers/ExamineManagementUiHelper.js.map +1 -0
  39. package/dist/lib/helpers/HealthCheckApiHelper.d.ts +13 -0
  40. package/dist/lib/helpers/HealthCheckApiHelper.js +47 -0
  41. package/dist/lib/helpers/HealthCheckApiHelper.js.map +1 -0
  42. package/dist/lib/helpers/HealthCheckUiHelper.d.ts +23 -0
  43. package/dist/lib/helpers/HealthCheckUiHelper.js +59 -0
  44. package/dist/lib/helpers/HealthCheckUiHelper.js.map +1 -0
  45. package/dist/lib/helpers/IndexerApiHelper.d.ts +7 -0
  46. package/dist/lib/helpers/IndexerApiHelper.js +19 -0
  47. package/dist/lib/helpers/IndexerApiHelper.js.map +1 -0
  48. package/dist/lib/helpers/LanguageApiHelper.d.ts +8 -4
  49. package/dist/lib/helpers/LanguageApiHelper.js +46 -26
  50. package/dist/lib/helpers/LanguageApiHelper.js.map +1 -1
  51. package/dist/lib/helpers/LanguageUiHelper.d.ts +23 -0
  52. package/dist/lib/helpers/LanguageUiHelper.js +68 -0
  53. package/dist/lib/helpers/LanguageUiHelper.js.map +1 -0
  54. package/dist/lib/helpers/LogViewerUiHelper.d.ts +37 -0
  55. package/dist/lib/helpers/LogViewerUiHelper.js +102 -0
  56. package/dist/lib/helpers/LogViewerUiHelper.js.map +1 -0
  57. package/dist/lib/helpers/LoginApiHelper.d.ts +16 -0
  58. package/dist/lib/helpers/LoginApiHelper.js +107 -0
  59. package/dist/lib/helpers/LoginApiHelper.js.map +1 -0
  60. package/dist/lib/helpers/LoginUiHelper.d.ts +11 -0
  61. package/dist/lib/helpers/LoginUiHelper.js +30 -0
  62. package/dist/lib/helpers/LoginUiHelper.js.map +1 -0
  63. package/dist/lib/helpers/MediaApiHelper.d.ts +32 -0
  64. package/dist/lib/helpers/MediaApiHelper.js +245 -0
  65. package/dist/lib/helpers/MediaApiHelper.js.map +1 -0
  66. package/dist/lib/helpers/MediaTypeApiHelper.d.ts +32 -0
  67. package/dist/lib/helpers/MediaTypeApiHelper.js +390 -0
  68. package/dist/lib/helpers/MediaTypeApiHelper.js.map +1 -0
  69. package/dist/lib/helpers/MediaTypeUiHelper.d.ts +14 -0
  70. package/dist/lib/helpers/MediaTypeUiHelper.js +38 -0
  71. package/dist/lib/helpers/MediaTypeUiHelper.js.map +1 -0
  72. package/dist/lib/helpers/MediaUiHelper.d.ts +49 -0
  73. package/dist/lib/helpers/MediaUiHelper.js +145 -0
  74. package/dist/lib/helpers/MediaUiHelper.js.map +1 -0
  75. package/dist/lib/helpers/MemberApiHelper.d.ts +16 -0
  76. package/dist/lib/helpers/MemberApiHelper.js +88 -0
  77. package/dist/lib/helpers/MemberApiHelper.js.map +1 -0
  78. package/dist/lib/helpers/MemberGroupApiHelper.d.ts +14 -0
  79. package/dist/lib/helpers/MemberGroupApiHelper.js +62 -0
  80. package/dist/lib/helpers/MemberGroupApiHelper.js.map +1 -0
  81. package/dist/lib/helpers/MemberGroupUiHelper.d.ts +20 -0
  82. package/dist/lib/helpers/MemberGroupUiHelper.js +57 -0
  83. package/dist/lib/helpers/MemberGroupUiHelper.js.map +1 -0
  84. package/dist/lib/helpers/MemberTypeApiHelper.d.ts +17 -0
  85. package/dist/lib/helpers/MemberTypeApiHelper.js +121 -0
  86. package/dist/lib/helpers/MemberTypeApiHelper.js.map +1 -0
  87. package/dist/lib/helpers/MemberTypeUiHelper.d.ts +13 -0
  88. package/dist/lib/helpers/MemberTypeUiHelper.js +35 -0
  89. package/dist/lib/helpers/MemberTypeUiHelper.js.map +1 -0
  90. package/dist/lib/helpers/MemberUiHelper.d.ts +45 -0
  91. package/dist/lib/helpers/MemberUiHelper.js +130 -0
  92. package/dist/lib/helpers/MemberUiHelper.js.map +1 -0
  93. package/dist/lib/helpers/ModelsBuilderApiHelper.d.ts +6 -0
  94. package/dist/lib/helpers/ModelsBuilderApiHelper.js +15 -0
  95. package/dist/lib/helpers/ModelsBuilderApiHelper.js.map +1 -0
  96. package/dist/lib/helpers/ModelsBuilderUiHelper.d.ts +9 -0
  97. package/dist/lib/helpers/ModelsBuilderUiHelper.js +22 -0
  98. package/dist/lib/helpers/ModelsBuilderUiHelper.js.map +1 -0
  99. package/dist/lib/helpers/ObjectTypesApiHelper.d.ts +7 -0
  100. package/dist/lib/helpers/ObjectTypesApiHelper.js +25 -0
  101. package/dist/lib/helpers/ObjectTypesApiHelper.js.map +1 -0
  102. package/dist/lib/helpers/PackageApiHelper.d.ts +3 -2
  103. package/dist/lib/helpers/PackageApiHelper.js +6 -3
  104. package/dist/lib/helpers/PackageApiHelper.js.map +1 -1
  105. package/dist/lib/helpers/PackageUiHelper.d.ts +49 -0
  106. package/dist/lib/helpers/PackageUiHelper.js +134 -0
  107. package/dist/lib/helpers/PackageUiHelper.js.map +1 -0
  108. package/dist/lib/helpers/PartialViewApiHelper.d.ts +5 -4
  109. package/dist/lib/helpers/PartialViewApiHelper.js +36 -30
  110. package/dist/lib/helpers/PartialViewApiHelper.js.map +1 -1
  111. package/dist/lib/helpers/PartialViewUiHelper.d.ts +7 -11
  112. package/dist/lib/helpers/PartialViewUiHelper.js +27 -36
  113. package/dist/lib/helpers/PartialViewUiHelper.js.map +1 -1
  114. package/dist/lib/helpers/ProfilingUiHelper.d.ts +11 -0
  115. package/dist/lib/helpers/ProfilingUiHelper.js +27 -0
  116. package/dist/lib/helpers/ProfilingUiHelper.js.map +1 -0
  117. package/dist/lib/helpers/PublishedCacheApiHelper.d.ts +6 -0
  118. package/dist/lib/helpers/PublishedCacheApiHelper.js +15 -0
  119. package/dist/lib/helpers/PublishedCacheApiHelper.js.map +1 -0
  120. package/dist/lib/helpers/PublishedStatusUiHelper.d.ts +19 -0
  121. package/dist/lib/helpers/PublishedStatusUiHelper.js +47 -0
  122. package/dist/lib/helpers/PublishedStatusUiHelper.js.map +1 -0
  123. package/dist/lib/helpers/RedirectManagementApiHelper.d.ts +10 -0
  124. package/dist/lib/helpers/RedirectManagementApiHelper.js +30 -0
  125. package/dist/lib/helpers/RedirectManagementApiHelper.js.map +1 -0
  126. package/dist/lib/helpers/RedirectManagementUiHelper.d.ts +17 -0
  127. package/dist/lib/helpers/RedirectManagementUiHelper.js +45 -0
  128. package/dist/lib/helpers/RedirectManagementUiHelper.js.map +1 -0
  129. package/dist/lib/helpers/RelationTypeApiHelper.d.ts +15 -0
  130. package/dist/lib/helpers/{RelationType.js → RelationTypeApiHelper.js} +45 -58
  131. package/dist/lib/helpers/RelationTypeApiHelper.js.map +1 -0
  132. package/dist/lib/helpers/RelationTypeUiHelper.d.ts +21 -0
  133. package/dist/lib/helpers/RelationTypeUiHelper.js +55 -0
  134. package/dist/lib/helpers/RelationTypeUiHelper.js.map +1 -0
  135. package/dist/lib/helpers/ScriptApiHelper.d.ts +5 -3
  136. package/dist/lib/helpers/ScriptApiHelper.js +44 -26
  137. package/dist/lib/helpers/ScriptApiHelper.js.map +1 -1
  138. package/dist/lib/helpers/ScriptUiHelper.d.ts +8 -12
  139. package/dist/lib/helpers/ScriptUiHelper.js +31 -40
  140. package/dist/lib/helpers/ScriptUiHelper.js.map +1 -1
  141. package/dist/lib/helpers/StylesheetApiHelper.d.ts +6 -4
  142. package/dist/lib/helpers/StylesheetApiHelper.js +47 -41
  143. package/dist/lib/helpers/StylesheetApiHelper.js.map +1 -1
  144. package/dist/lib/helpers/StylesheetUiHelper.d.ts +17 -15
  145. package/dist/lib/helpers/StylesheetUiHelper.js +60 -47
  146. package/dist/lib/helpers/StylesheetUiHelper.js.map +1 -1
  147. package/dist/lib/helpers/TelemetryDataUiHelper.d.ts +10 -0
  148. package/dist/lib/helpers/TelemetryDataUiHelper.js +25 -0
  149. package/dist/lib/helpers/TelemetryDataUiHelper.js.map +1 -0
  150. package/dist/lib/helpers/TemplateApiHelper.d.ts +1 -0
  151. package/dist/lib/helpers/TemplateApiHelper.js +6 -0
  152. package/dist/lib/helpers/TemplateApiHelper.js.map +1 -1
  153. package/dist/lib/helpers/TemplateUiHelper.d.ts +14 -18
  154. package/dist/lib/helpers/TemplateUiHelper.js +65 -59
  155. package/dist/lib/helpers/TemplateUiHelper.js.map +1 -1
  156. package/dist/lib/helpers/TemporaryFileApiHelper.d.ts +17 -1
  157. package/dist/lib/helpers/TemporaryFileApiHelper.js +23 -10
  158. package/dist/lib/helpers/TemporaryFileApiHelper.js.map +1 -1
  159. package/dist/lib/helpers/UiBaseLocators.d.ts +213 -9
  160. package/dist/lib/helpers/UiBaseLocators.js +703 -39
  161. package/dist/lib/helpers/UiBaseLocators.js.map +1 -1
  162. package/dist/lib/helpers/UiHelpers.d.ts +49 -7
  163. package/dist/lib/helpers/UiHelpers.js +75 -21
  164. package/dist/lib/helpers/UiHelpers.js.map +1 -1
  165. package/dist/lib/helpers/UserApiHelper.d.ts +24 -10
  166. package/dist/lib/helpers/UserApiHelper.js +94 -22
  167. package/dist/lib/helpers/UserApiHelper.js.map +1 -1
  168. package/dist/lib/helpers/UserGroupApiHelper.d.ts +5 -3
  169. package/dist/lib/helpers/UserGroupApiHelper.js +20 -19
  170. package/dist/lib/helpers/UserGroupApiHelper.js.map +1 -1
  171. package/dist/lib/helpers/UserGroupUiHelper.d.ts +20 -0
  172. package/dist/lib/helpers/UserGroupUiHelper.js +56 -0
  173. package/dist/lib/helpers/UserGroupUiHelper.js.map +1 -0
  174. package/dist/lib/helpers/UserUiHelper.d.ts +81 -0
  175. package/dist/lib/helpers/UserUiHelper.js +223 -0
  176. package/dist/lib/helpers/UserUiHelper.js.map +1 -0
  177. package/dist/lib/helpers/WelcomeDashboardUiHelper.d.ts +9 -0
  178. package/dist/lib/helpers/WelcomeDashboardUiHelper.js +22 -0
  179. package/dist/lib/helpers/WelcomeDashboardUiHelper.js.map +1 -0
  180. package/dist/lib/helpers/testExtension.js +4 -0
  181. package/dist/lib/helpers/testExtension.js.map +1 -1
  182. package/dist/tsconfig.tsbuildinfo +1 -1
  183. package/dist/umbraco.config.js +1 -1
  184. package/dist/umbraco.config.js.map +1 -1
  185. package/package.json +9 -11
  186. package/dist/lib/helpers/RelationType.d.ts +0 -15
  187. package/dist/lib/helpers/RelationType.js.map +0 -1
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentBlueprintUiHelper = void 0;
4
+ const test_1 = require("@playwright/test");
5
+ const UiBaseLocators_1 = require("./UiBaseLocators");
6
+ const ConstantHelper_1 = require("./ConstantHelper");
7
+ class DocumentBlueprintUiHelper extends UiBaseLocators_1.UiBaseLocators {
8
+ documentBlueprintTree;
9
+ documentBlueprintNameTxt;
10
+ deleteMenu;
11
+ constructor(page) {
12
+ super(page);
13
+ this.documentBlueprintTree = page.locator('umb-tree[alias="Umb.Tree.DocumentBlueprint"]');
14
+ this.documentBlueprintNameTxt = page.locator('#name-input #input');
15
+ this.deleteMenu = page.locator('umb-section-sidebar #menu-item').getByLabel('Delete');
16
+ }
17
+ async clickActionsMenuForDocumentBlueprints(name) {
18
+ await this.clickActionsMenuForName(name);
19
+ }
20
+ async clickActionsMenuAtRoot() {
21
+ await this.clickActionsMenuForDocumentBlueprints('Document Blueprints');
22
+ }
23
+ async clickRootFolderCaretButton() {
24
+ await this.clickCaretButtonForName('Document Blueprints');
25
+ }
26
+ async reloadDocumentBlueprintsTree() {
27
+ await this.reloadTree('Document Blueprints');
28
+ }
29
+ async goToDocumentBlueprint(blueprintName) {
30
+ await this.goToSection(ConstantHelper_1.ConstantHelper.sections.settings);
31
+ await this.reloadDocumentBlueprintsTree();
32
+ await this.page.getByLabel(blueprintName).click();
33
+ }
34
+ async isDocumentBlueprintRootTreeItemVisible(blueprintName, isVisible = true, toReload = true) {
35
+ if (toReload) {
36
+ await this.reloadDocumentBlueprintsTree();
37
+ }
38
+ return (0, test_1.expect)(this.documentBlueprintTree.getByText(blueprintName, { exact: true })).toBeVisible({ visible: isVisible });
39
+ }
40
+ async clickCreateDocumentBlueprintButton() {
41
+ await this.createDocumentBlueprintBtn.click();
42
+ }
43
+ async enterDocumentBlueprintName(blueprintName) {
44
+ await (0, test_1.expect)(this.documentBlueprintNameTxt).toBeVisible();
45
+ await this.documentBlueprintNameTxt.fill(blueprintName);
46
+ }
47
+ async clickDeleteMenuButton() {
48
+ await this.deleteMenu.click();
49
+ }
50
+ }
51
+ exports.DocumentBlueprintUiHelper = DocumentBlueprintUiHelper;
52
+ //# sourceMappingURL=DocumentBlueprintUiHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentBlueprintUiHelper.js","sourceRoot":"","sources":["../../../lib/helpers/DocumentBlueprintUiHelper.ts"],"names":[],"mappings":";;;AAAA,2CAAsD;AACtD,qDAAgD;AAChD,qDAAgD;AAEhD,MAAa,yBAA0B,SAAQ,+BAAc;IAC1C,qBAAqB,CAAU;IAC/B,wBAAwB,CAAU;IAClC,UAAU,CAAU;IAErC,YAAY,IAAU;QACpB,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,OAAO,CAAC,8CAA8C,CAAC,CAAC;QAC1F,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACnE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACxF,CAAC;IAED,KAAK,CAAC,qCAAqC,CAAC,IAAY;QACtD,MAAM,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,sBAAsB;QAC1B,MAAM,IAAI,CAAC,qCAAqC,CAAC,qBAAqB,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,0BAA0B;QAC9B,MAAM,IAAI,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK,CAAC,4BAA4B;QAChC,MAAM,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,aAAqB;QAC/C,MAAM,IAAI,CAAC,WAAW,CAAC,+BAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACzD,MAAM,IAAI,CAAC,4BAA4B,EAAE,CAAC;QAC1C,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,sCAAsC,CAAC,aAAqB,EAAE,YAAqB,IAAI,EAAE,WAAoB,IAAI;QACrH,IAAI,QAAQ,EAAE;YACZ,MAAM,IAAI,CAAC,4BAA4B,EAAE,CAAC;SAC3C;QACD,OAAO,IAAA,aAAM,EAAC,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,aAAa,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EAAC,OAAO,EAAE,SAAS,EAAC,CAAC,CAAC;IACtH,CAAC;IAED,KAAK,CAAC,kCAAkC;QACtC,MAAM,IAAI,CAAC,0BAA0B,CAAC,KAAK,EAAE,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,0BAA0B,CAAC,aAAqB;QACpD,MAAM,IAAA,aAAM,EAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1D,MAAM,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC1D,CAAC;IAED,KAAK,CAAC,qBAAqB;QACzB,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;CACF;AArDD,8DAqDC","sourcesContent":["import {Page, Locator, expect} from \"@playwright/test\"\nimport {UiBaseLocators} from \"./UiBaseLocators\";\nimport {ConstantHelper} from \"./ConstantHelper\";\n\nexport class DocumentBlueprintUiHelper extends UiBaseLocators{\n private readonly documentBlueprintTree: Locator;\n private readonly documentBlueprintNameTxt: Locator;\n private readonly deleteMenu: Locator;\n\n constructor(page: Page) {\n super(page);\n this.documentBlueprintTree = page.locator('umb-tree[alias=\"Umb.Tree.DocumentBlueprint\"]');\n this.documentBlueprintNameTxt = page.locator('#name-input #input');\n this.deleteMenu = page.locator('umb-section-sidebar #menu-item').getByLabel('Delete');\n }\n\n async clickActionsMenuForDocumentBlueprints(name: string) {\n await this.clickActionsMenuForName(name);\n }\n\n async clickActionsMenuAtRoot() {\n await this.clickActionsMenuForDocumentBlueprints('Document Blueprints');\n }\n\n async clickRootFolderCaretButton() {\n await this.clickCaretButtonForName('Document Blueprints');\n }\n\n async reloadDocumentBlueprintsTree() {\n await this.reloadTree('Document Blueprints');\n }\n \n async goToDocumentBlueprint(blueprintName: string) {\n await this.goToSection(ConstantHelper.sections.settings);\n await this.reloadDocumentBlueprintsTree();\n await this.page.getByLabel(blueprintName).click();\n }\n\n async isDocumentBlueprintRootTreeItemVisible(blueprintName: string, isVisible: boolean = true, toReload: boolean = true){\n if (toReload) {\n await this.reloadDocumentBlueprintsTree();\n }\n return expect(this.documentBlueprintTree.getByText(blueprintName, {exact: true})).toBeVisible({visible: isVisible});\n }\n\n async clickCreateDocumentBlueprintButton() {\n await this.createDocumentBlueprintBtn.click();\n }\n\n async enterDocumentBlueprintName(blueprintName: string) {\n await expect(this.documentBlueprintNameTxt).toBeVisible();\n await this.documentBlueprintNameTxt.fill(blueprintName);\n }\n\n async clickDeleteMenuButton() {\n await this.deleteMenu.click();\n }\n}"]}
@@ -0,0 +1,42 @@
1
+ import { ApiHelpers } from "./ApiHelpers";
2
+ export declare class DocumentTypeApiHelper {
3
+ api: ApiHelpers;
4
+ constructor(api: ApiHelpers);
5
+ ensureNameNotExists(name: string): Promise<number | import("playwright-core").APIResponse | null | undefined>;
6
+ getAllAtRoot(): Promise<import("playwright-core").APIResponse>;
7
+ private recurseChildren;
8
+ private recurseDeleteChildren;
9
+ getChildren(id: string): Promise<any>;
10
+ create(documentType: any): Promise<string | undefined>;
11
+ get(id: string): Promise<any>;
12
+ getByName(name: string): Promise<any>;
13
+ doesNameExist(name: string): Promise<any>;
14
+ delete(id: string): Promise<number | undefined>;
15
+ getFolder(id: string): Promise<any>;
16
+ deleteFolder(id: string): Promise<import("playwright-core").APIResponse>;
17
+ createFolder(name: string, parentId?: string): Promise<string | undefined>;
18
+ renameFolder(folderId: string, folderName: string): Promise<import("playwright-core").APIResponse>;
19
+ createDefaultDocumentType(documentTypeName: string): Promise<string | undefined>;
20
+ createDocumentTypeWithPropertyEditor(documentTypeName: string, dataTypeName: string, dataTypeId: string, groupName?: string, varyByCulture?: boolean): Promise<string | undefined>;
21
+ createDocumentTypeWithPropertyEditorInTab(documentTypeName: string, dataTypeName: string, dataTypeId: string, tabName: string, groupName?: string, varyByCulture?: boolean): Promise<string | undefined>;
22
+ createDocumentTypeWithTwoPropertyEditors(documentTypeName: string, dataTypeNameOne: string, dataTypeIdOne: string, dataTypeNameTwo: string, dataTypeIdTwo: string, groupName?: string): Promise<string | undefined>;
23
+ createDefaultDocumentTypeWithAllowAsRoot(documentTypeName: string): Promise<string | undefined>;
24
+ createDocumentTypeWithAllowedChildNode(documentTypeName: string, allowedChildNodeId: string): Promise<string | undefined>;
25
+ createDocumentTypeWithAPropertyEditorAndAnAllowedChildNode(documentTypeName: string, dataTypeName: string, dataTypeId: string, allowedChildNodeId: string, groupName?: string): Promise<string | undefined>;
26
+ createDocumentTypeWithAllowedTemplate(documentTypeName: string, allowedTemplateId: string, isAllowedAsRoot?: boolean): Promise<string | undefined>;
27
+ createDocumentTypeWithTwoAllowedTemplates(documentTypeName: string, allowedTemplateOneId: string, allowedTemplateTwoId: string, isAllowedAsRoot?: boolean, defaultTemplateId?: string): Promise<string | undefined>;
28
+ createDocumentTypeWithTwoGroups(documentTypeName: string, dataType: string, dataTypeId: string, groupNameOne: string, groupNameTwo: string): Promise<string | undefined>;
29
+ createDocumentTypeWithAComposition(documentTypeName: string, compositionId: string): Promise<string | undefined>;
30
+ createEmptyElementType(elementTypeName: string): Promise<string | undefined>;
31
+ createDocumentTypeWithTwoTabs(documentTypeName: string, dataType: string, dataTypeId: string, tabNameOne: string, tabNameTwo: string): Promise<string | undefined>;
32
+ createDefaultElementType(elementName: string, groupName: string | undefined, dataTypeName: string | undefined, dataTypeId: string): Promise<string | undefined>;
33
+ doesGroupContainCorrectPropertyEditor(documentTypeName: string, dataTypeName: string, dataTypeId: string, groupName: string): Promise<any>;
34
+ doesTabContainCorrectPropertyEditorInGroup(documentTypeName: string, dataTypeName: string, dataTypeId: string, tabName: string, groupName: string): Promise<any>;
35
+ doesDocumentTypeGroupNameContainCorrectSortOrder(documentTypeName: string, groupName: string, sortOrder: number): Promise<boolean>;
36
+ doesDocumentTypeTabNameContainCorrectSortOrder(documentTypeName: string, tabName: string, sortOrder: number): Promise<boolean>;
37
+ getContainerIdWithName(documentTypeName: string, containerName: string): Promise<any>;
38
+ createDocumentTypeWithAllowedTwoChildNodes(documentTypeName: string, allowedChildNodeOneId: string, allowedChildNodeTwoId: string): Promise<string | undefined>;
39
+ createDocumentTypeWithAllowedChildNodeAndCollectionId(documentTypeName: string, allowedChildNodeId: string, collectionId: string): Promise<string | undefined>;
40
+ createDocumentTypeWithCollectionId(documentTypeName: string, collectionId: string): Promise<string | undefined>;
41
+ createDocumentTypeWithAllowVaryByCulture(documentTypeName: string): Promise<string | undefined>;
42
+ }
@@ -0,0 +1,551 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentTypeApiHelper = void 0;
4
+ const json_models_builders_1 = require("@umbraco/json-models-builders");
5
+ const AliasHelper_1 = require("./AliasHelper");
6
+ class DocumentTypeApiHelper {
7
+ api;
8
+ constructor(api) {
9
+ this.api = api;
10
+ }
11
+ async ensureNameNotExists(name) {
12
+ const rootDocumentTypes = await this.getAllAtRoot();
13
+ const jsonDocumentTypes = await rootDocumentTypes.json();
14
+ for (const documentType of jsonDocumentTypes.items) {
15
+ if (documentType.name === name) {
16
+ if (documentType.isFolder) {
17
+ return await this.recurseDeleteChildren(documentType);
18
+ }
19
+ return await this.delete(documentType.id);
20
+ }
21
+ else if (documentType.hasChildren) {
22
+ await this.recurseChildren(name, documentType.id, true);
23
+ }
24
+ }
25
+ return null;
26
+ }
27
+ async getAllAtRoot() {
28
+ return await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/document-type/root?skip=0&take=10000&foldersOnly=false');
29
+ }
30
+ async recurseChildren(name, id, toDelete) {
31
+ const items = await this.getChildren(id);
32
+ for (const child of items) {
33
+ if (child.name === name) {
34
+ if (!toDelete) {
35
+ if (child.isFolder) {
36
+ return await this.getFolder(child.id);
37
+ }
38
+ return await this.get(child.id);
39
+ }
40
+ if (child.isFolder) {
41
+ return await this.recurseDeleteChildren(child);
42
+ }
43
+ return await this.delete(child.id);
44
+ }
45
+ else if (child.hasChildren) {
46
+ return await this.recurseChildren(name, child.id, toDelete);
47
+ }
48
+ }
49
+ return false;
50
+ }
51
+ async recurseDeleteChildren(documentTypeFolder) {
52
+ if (!documentTypeFolder.hasChildren) {
53
+ return await this.deleteFolder(documentTypeFolder.id);
54
+ }
55
+ const items = await this.getChildren(documentTypeFolder.id);
56
+ for (const child of items) {
57
+ if (child.hasChildren) {
58
+ await this.recurseDeleteChildren(child);
59
+ }
60
+ else if (child.isFolder) {
61
+ await this.deleteFolder(child.id);
62
+ }
63
+ else {
64
+ await this.delete(child.id);
65
+ }
66
+ }
67
+ return await this.deleteFolder(documentTypeFolder.id);
68
+ }
69
+ async getChildren(id) {
70
+ const response = await this.api.get(`${this.api.baseUrl}/umbraco/management/api/v1/tree/document-type/children?parentId=${id}&skip=0&take=10000&foldersOnly=false`);
71
+ const items = await response.json();
72
+ return items.items;
73
+ }
74
+ async create(documentType) {
75
+ if (documentType == null) {
76
+ return;
77
+ }
78
+ const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/document-type', documentType);
79
+ return response.headers().location.split("/").pop();
80
+ }
81
+ async get(id) {
82
+ const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/document-type/' + id);
83
+ const json = await response.json();
84
+ if (json !== null) {
85
+ return json;
86
+ }
87
+ return null;
88
+ }
89
+ async getByName(name) {
90
+ const rootDocumentTypes = await this.getAllAtRoot();
91
+ const jsonDocumentTypes = await rootDocumentTypes.json();
92
+ for (const documentType of jsonDocumentTypes.items) {
93
+ if (documentType.name === name) {
94
+ if (documentType.isFolder) {
95
+ return this.getFolder(documentType.id);
96
+ }
97
+ return this.get(documentType.id);
98
+ }
99
+ else if (documentType.hasChildren) {
100
+ const result = await this.recurseChildren(name, documentType.id, false);
101
+ if (result) {
102
+ return result;
103
+ }
104
+ }
105
+ }
106
+ return false;
107
+ }
108
+ async doesNameExist(name) {
109
+ return await this.getByName(name);
110
+ }
111
+ async delete(id) {
112
+ if (id == null) {
113
+ return;
114
+ }
115
+ const response = await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/document-type/' + id);
116
+ return response.status();
117
+ }
118
+ // FOLDER
119
+ async getFolder(id) {
120
+ const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/document-type/folder/' + id);
121
+ return await response.json();
122
+ }
123
+ async deleteFolder(id) {
124
+ return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/document-type/folder/' + id);
125
+ }
126
+ async createFolder(name, parentId) {
127
+ const folder = {
128
+ name: name,
129
+ parent: parentId ? { id: parentId } : null
130
+ };
131
+ const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/document-type/folder', folder);
132
+ return response.headers().location.split("/").pop();
133
+ }
134
+ async renameFolder(folderId, folderName) {
135
+ const folder = {
136
+ name: folderName
137
+ };
138
+ return await this.api.put(this.api.baseUrl + '/umbraco/management/api/v1/document-type/folder/' + folderId, folder);
139
+ }
140
+ async createDefaultDocumentType(documentTypeName) {
141
+ await this.ensureNameNotExists(documentTypeName);
142
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
143
+ .withName(documentTypeName)
144
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
145
+ .build();
146
+ return await this.create(documentType);
147
+ }
148
+ async createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeId, groupName = "TestGroup", varyByCulture) {
149
+ const crypto = require('crypto');
150
+ const containerId = crypto.randomUUID();
151
+ const varyByCultureProperty = varyByCulture === undefined ? false : varyByCulture;
152
+ const varyByCultureDocumentType = varyByCulture === undefined ? false : true;
153
+ await this.ensureNameNotExists(documentTypeName);
154
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
155
+ .withName(documentTypeName)
156
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
157
+ .withAllowedAsRoot(true)
158
+ .addContainer()
159
+ .withName(groupName)
160
+ .withId(containerId)
161
+ .withType("Group")
162
+ .done()
163
+ .addProperty()
164
+ .withContainerId(containerId)
165
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataTypeName))
166
+ .withName(dataTypeName)
167
+ .withDataTypeId(dataTypeId)
168
+ .withVariesByCulture(varyByCultureProperty)
169
+ .done()
170
+ .withVariesByCulture(varyByCultureDocumentType)
171
+ .build();
172
+ return await this.create(documentType);
173
+ }
174
+ async createDocumentTypeWithPropertyEditorInTab(documentTypeName, dataTypeName, dataTypeId, tabName, groupName = "TestGroup", varyByCulture = false) {
175
+ const crypto = require('crypto');
176
+ const tabId = crypto.randomUUID();
177
+ const groupId = crypto.randomUUID();
178
+ await this.ensureNameNotExists(documentTypeName);
179
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
180
+ .withName(documentTypeName)
181
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
182
+ .addContainer()
183
+ .withName(tabName)
184
+ .withId(tabId)
185
+ .withType("Tab")
186
+ .done()
187
+ .addContainer()
188
+ .withName(groupName)
189
+ .withId(groupId)
190
+ .withType("Group")
191
+ .withParentId(tabId)
192
+ .done()
193
+ .addProperty()
194
+ .withContainerId(groupId)
195
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataTypeName))
196
+ .withName(dataTypeName)
197
+ .withDataTypeId(dataTypeId)
198
+ .done()
199
+ .withVariesByCulture(varyByCulture)
200
+ .build();
201
+ return await this.create(documentType);
202
+ }
203
+ async createDocumentTypeWithTwoPropertyEditors(documentTypeName, dataTypeNameOne, dataTypeIdOne, dataTypeNameTwo, dataTypeIdTwo, groupName = "TestGroup") {
204
+ const crypto = require('crypto');
205
+ const containerId = crypto.randomUUID();
206
+ await this.ensureNameNotExists(documentTypeName);
207
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
208
+ .withName(documentTypeName)
209
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
210
+ .addContainer()
211
+ .withName(groupName)
212
+ .withId(containerId)
213
+ .withType("Group")
214
+ .done()
215
+ .addProperty()
216
+ .withContainerId(containerId)
217
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataTypeNameOne))
218
+ .withName(dataTypeNameOne)
219
+ .withDataTypeId(dataTypeIdOne)
220
+ .done()
221
+ .addProperty()
222
+ .withContainerId(containerId)
223
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataTypeNameTwo))
224
+ .withName(dataTypeNameTwo)
225
+ .withDataTypeId(dataTypeIdTwo)
226
+ .done()
227
+ .build();
228
+ return await this.create(documentType);
229
+ }
230
+ async createDefaultDocumentTypeWithAllowAsRoot(documentTypeName) {
231
+ await this.ensureNameNotExists(documentTypeName);
232
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
233
+ .withName(documentTypeName)
234
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
235
+ .withAllowedAsRoot(true)
236
+ .build();
237
+ return await this.create(documentType);
238
+ }
239
+ async createDocumentTypeWithAllowedChildNode(documentTypeName, allowedChildNodeId) {
240
+ await this.ensureNameNotExists(documentTypeName);
241
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
242
+ .withName(documentTypeName)
243
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
244
+ .withAllowedAsRoot(true)
245
+ .addAllowedDocumentType()
246
+ .withId(allowedChildNodeId)
247
+ .done()
248
+ .build();
249
+ return await this.create(documentType);
250
+ }
251
+ async createDocumentTypeWithAPropertyEditorAndAnAllowedChildNode(documentTypeName, dataTypeName, dataTypeId, allowedChildNodeId, groupName = "TestGroup") {
252
+ await this.ensureNameNotExists(documentTypeName);
253
+ const crypto = require('crypto');
254
+ const containerId = crypto.randomUUID();
255
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
256
+ .withName(documentTypeName)
257
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
258
+ .withAllowedAsRoot(true)
259
+ .addContainer()
260
+ .withName(groupName)
261
+ .withId(containerId)
262
+ .withType("Group")
263
+ .done()
264
+ .addProperty()
265
+ .withContainerId(containerId)
266
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataTypeName))
267
+ .withName(dataTypeName)
268
+ .withDataTypeId(dataTypeId)
269
+ .done()
270
+ .addAllowedDocumentType()
271
+ .withId(allowedChildNodeId)
272
+ .done()
273
+ .build();
274
+ return await this.create(documentType);
275
+ }
276
+ async createDocumentTypeWithAllowedTemplate(documentTypeName, allowedTemplateId, isAllowedAsRoot = false) {
277
+ await this.ensureNameNotExists(documentTypeName);
278
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
279
+ .withName(documentTypeName)
280
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
281
+ .withAllowedAsRoot(isAllowedAsRoot)
282
+ .addAllowedTemplateId()
283
+ .withId(allowedTemplateId)
284
+ .done()
285
+ .withDefaultTemplateId(allowedTemplateId)
286
+ .build();
287
+ return await this.create(documentType);
288
+ }
289
+ async createDocumentTypeWithTwoAllowedTemplates(documentTypeName, allowedTemplateOneId, allowedTemplateTwoId, isAllowedAsRoot = false, defaultTemplateId) {
290
+ await this.ensureNameNotExists(documentTypeName);
291
+ const defaultTemplate = defaultTemplateId === undefined ? allowedTemplateOneId : defaultTemplateId;
292
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
293
+ .withName(documentTypeName)
294
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
295
+ .withAllowedAsRoot(isAllowedAsRoot)
296
+ .addAllowedTemplateId()
297
+ .withId(allowedTemplateOneId)
298
+ .done()
299
+ .addAllowedTemplateId()
300
+ .withId(allowedTemplateTwoId)
301
+ .done()
302
+ .withDefaultTemplateId(defaultTemplate)
303
+ .build();
304
+ return await this.create(documentType);
305
+ }
306
+ async createDocumentTypeWithTwoGroups(documentTypeName, dataType, dataTypeId, groupNameOne, groupNameTwo) {
307
+ const crypto = require('crypto');
308
+ const groupOneId = crypto.randomUUID();
309
+ const groupTwoId = crypto.randomUUID();
310
+ await this.ensureNameNotExists(documentTypeName);
311
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
312
+ .withName(documentTypeName)
313
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
314
+ .addContainer()
315
+ .withName(groupNameOne)
316
+ .withId(groupOneId)
317
+ .withType("Group")
318
+ .withSortOrder(0)
319
+ .done()
320
+ .addContainer()
321
+ .withName(groupNameTwo)
322
+ .withId(groupTwoId)
323
+ .withType("Group")
324
+ .withSortOrder(1)
325
+ .done()
326
+ .addProperty()
327
+ .withContainerId(groupOneId)
328
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataType + "One"))
329
+ .withName(dataType + "One")
330
+ .withDataTypeId(dataTypeId)
331
+ .done()
332
+ .addProperty()
333
+ .withContainerId(groupTwoId)
334
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataType + "Two"))
335
+ .withName(dataType + "Two")
336
+ .withDataTypeId(dataTypeId)
337
+ .done()
338
+ .build();
339
+ return await this.create(documentType);
340
+ }
341
+ async createDocumentTypeWithAComposition(documentTypeName, compositionId) {
342
+ await this.ensureNameNotExists(documentTypeName);
343
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
344
+ .withName(documentTypeName)
345
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
346
+ .addComposition()
347
+ .withDocumentTypeId(compositionId)
348
+ .done()
349
+ .build();
350
+ return await this.create(documentType);
351
+ }
352
+ async createEmptyElementType(elementTypeName) {
353
+ await this.ensureNameNotExists(elementTypeName);
354
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
355
+ .withName(elementTypeName)
356
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(elementTypeName))
357
+ .withIsElement(true)
358
+ .withIcon("icon-plugin")
359
+ .build();
360
+ return await this.create(documentType);
361
+ }
362
+ async createDocumentTypeWithTwoTabs(documentTypeName, dataType, dataTypeId, tabNameOne, tabNameTwo) {
363
+ const crypto = require('crypto');
364
+ const tabOneId = crypto.randomUUID();
365
+ const tabTwoId = crypto.randomUUID();
366
+ const groupOneId = crypto.randomUUID();
367
+ const groupTwoId = crypto.randomUUID();
368
+ await this.ensureNameNotExists(documentTypeName);
369
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
370
+ .withName(documentTypeName)
371
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
372
+ .addContainer()
373
+ .withName(tabNameOne)
374
+ .withId(tabOneId)
375
+ .withType("Tab")
376
+ .withSortOrder(0)
377
+ .done()
378
+ .addContainer()
379
+ .withName(tabNameTwo)
380
+ .withId(tabTwoId)
381
+ .withType("Tab")
382
+ .withSortOrder(1)
383
+ .done()
384
+ .addContainer()
385
+ .withName("GroupTestOne")
386
+ .withId(groupOneId)
387
+ .withType("Group")
388
+ .withParentId(tabOneId)
389
+ .done()
390
+ .addProperty()
391
+ .withContainerId(groupOneId)
392
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataType + "One"))
393
+ .withName(dataType + "One")
394
+ .withDataTypeId(dataTypeId)
395
+ .done()
396
+ .addContainer()
397
+ .withName("GroupTestTwo")
398
+ .withId(groupTwoId)
399
+ .withType("Group")
400
+ .withParentId(tabTwoId)
401
+ .done()
402
+ .addProperty()
403
+ .withContainerId(groupTwoId)
404
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataType + "Two"))
405
+ .withName(dataType + "Two")
406
+ .withDataTypeId(dataTypeId)
407
+ .done()
408
+ .build();
409
+ return await this.create(documentType);
410
+ }
411
+ async createDefaultElementType(elementName, groupName = 'TestGroup', dataTypeName = 'Textstring', dataTypeId) {
412
+ await this.ensureNameNotExists(elementName);
413
+ const crypto = require('crypto');
414
+ const containerId = crypto.randomUUID();
415
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
416
+ .withName(elementName)
417
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(elementName))
418
+ .withIsElement(true)
419
+ .addContainer()
420
+ .withName(groupName)
421
+ .withId(containerId)
422
+ .withType("Group")
423
+ .done()
424
+ .addProperty()
425
+ .withContainerId(containerId)
426
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataTypeName))
427
+ .withName(dataTypeName)
428
+ .withDataTypeId(dataTypeId)
429
+ .done()
430
+ .build();
431
+ return await this.create(documentType);
432
+ }
433
+ async doesGroupContainCorrectPropertyEditor(documentTypeName, dataTypeName, dataTypeId, groupName) {
434
+ const documentType = await this.getByName(documentTypeName);
435
+ const group = documentType.containers.find(x => x.name === groupName);
436
+ // Check if group is defined
437
+ if (group) {
438
+ // Check if the document type properties include the specified property, and it belongs to the group
439
+ return documentType.properties.find(x => x.name === dataTypeName && x.dataType.id === dataTypeId && x.container.id === group.id);
440
+ }
441
+ else {
442
+ // Group not found
443
+ return false;
444
+ }
445
+ }
446
+ async doesTabContainCorrectPropertyEditorInGroup(documentTypeName, dataTypeName, dataTypeId, tabName, groupName) {
447
+ const documentType = await this.getByName(documentTypeName);
448
+ const tab = documentType.containers.find(x => x.name === tabName);
449
+ // Check if tab is defined
450
+ if (tab) {
451
+ const group = documentType.containers.find(x => x.name === groupName && x.parent.id === tab.id);
452
+ // Check if group is defined
453
+ if (group) {
454
+ // Check if the document type properties include the specified property, and it belongs to the group
455
+ return documentType.properties.find(x => x.name === dataTypeName && x.dataType.id === dataTypeId && x.container.id === group.id);
456
+ }
457
+ else {
458
+ // Group not found
459
+ return false;
460
+ }
461
+ }
462
+ else {
463
+ // Tab not found
464
+ return false;
465
+ }
466
+ }
467
+ async doesDocumentTypeGroupNameContainCorrectSortOrder(documentTypeName, groupName, sortOrder) {
468
+ const documentType = await this.getByName(documentTypeName);
469
+ const group = documentType.containers.find(x => x.name === groupName);
470
+ // Check if group is defined
471
+ if (group) {
472
+ return group.sortOrder === sortOrder;
473
+ }
474
+ else {
475
+ // Group not found
476
+ return false;
477
+ }
478
+ }
479
+ async doesDocumentTypeTabNameContainCorrectSortOrder(documentTypeName, tabName, sortOrder) {
480
+ const documentType = await this.getByName(documentTypeName);
481
+ const tab = documentType.containers.find(x => x.name === tabName);
482
+ // Check if tab is defined
483
+ if (tab) {
484
+ return tab.sortOrder === sortOrder;
485
+ }
486
+ else {
487
+ // Tab not found
488
+ return false;
489
+ }
490
+ }
491
+ async getContainerIdWithName(documentTypeName, containerName) {
492
+ const documentType = await this.getByName(documentTypeName);
493
+ const container = documentType.containers.find(x => x.name === containerName);
494
+ if (container) {
495
+ return container.id;
496
+ }
497
+ else {
498
+ return null;
499
+ }
500
+ }
501
+ async createDocumentTypeWithAllowedTwoChildNodes(documentTypeName, allowedChildNodeOneId, allowedChildNodeTwoId) {
502
+ await this.ensureNameNotExists(documentTypeName);
503
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
504
+ .withName(documentTypeName)
505
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
506
+ .withAllowedAsRoot(true)
507
+ .addAllowedDocumentType()
508
+ .withId(allowedChildNodeOneId)
509
+ .done()
510
+ .addAllowedDocumentType()
511
+ .withId(allowedChildNodeTwoId)
512
+ .done()
513
+ .build();
514
+ return await this.create(documentType);
515
+ }
516
+ async createDocumentTypeWithAllowedChildNodeAndCollectionId(documentTypeName, allowedChildNodeId, collectionId) {
517
+ await this.ensureNameNotExists(documentTypeName);
518
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
519
+ .withName(documentTypeName)
520
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
521
+ .withAllowedAsRoot(true)
522
+ .addAllowedDocumentType()
523
+ .withId(allowedChildNodeId)
524
+ .done()
525
+ .withCollectionId(collectionId)
526
+ .build();
527
+ return await this.create(documentType);
528
+ }
529
+ async createDocumentTypeWithCollectionId(documentTypeName, collectionId) {
530
+ await this.ensureNameNotExists(documentTypeName);
531
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
532
+ .withName(documentTypeName)
533
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
534
+ .withAllowedAsRoot(true)
535
+ .withCollectionId(collectionId)
536
+ .build();
537
+ return await this.create(documentType);
538
+ }
539
+ async createDocumentTypeWithAllowVaryByCulture(documentTypeName) {
540
+ await this.ensureNameNotExists(documentTypeName);
541
+ const documentType = new json_models_builders_1.DocumentTypeBuilder()
542
+ .withName(documentTypeName)
543
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(documentTypeName))
544
+ .withAllowedAsRoot(true)
545
+ .withVariesByCulture(true)
546
+ .build();
547
+ return await this.create(documentType);
548
+ }
549
+ }
550
+ exports.DocumentTypeApiHelper = DocumentTypeApiHelper;
551
+ //# sourceMappingURL=DocumentTypeApiHelper.js.map