@umbraco/playwright-testhelpers 2.0.0-beta.34 → 2.0.0-beta.35
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.
- package/dist/lib/helpers/ApiHelpers.d.ts +6 -0
- package/dist/lib/helpers/ApiHelpers.js +9 -0
- package/dist/lib/helpers/ApiHelpers.js.map +1 -1
- package/dist/lib/helpers/MemberApiHelper.d.ts +16 -0
- package/dist/lib/helpers/MemberApiHelper.js +88 -0
- package/dist/lib/helpers/MemberApiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberGroupApiHelper.d.ts +14 -0
- package/dist/lib/helpers/MemberGroupApiHelper.js +63 -0
- package/dist/lib/helpers/MemberGroupApiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberGroupUiHelper.d.ts +16 -0
- package/dist/lib/helpers/MemberGroupUiHelper.js +42 -0
- package/dist/lib/helpers/MemberGroupUiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberTypeApiHelper.d.ts +17 -0
- package/dist/lib/helpers/MemberTypeApiHelper.js +121 -0
- package/dist/lib/helpers/MemberTypeApiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberTypeUiHelper.d.ts +13 -0
- package/dist/lib/helpers/MemberTypeUiHelper.js +35 -0
- package/dist/lib/helpers/MemberTypeUiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberUiHelper.d.ts +40 -0
- package/dist/lib/helpers/MemberUiHelper.js +114 -0
- package/dist/lib/helpers/MemberUiHelper.js.map +1 -0
- package/dist/lib/helpers/UiBaseLocators.js +2 -1
- package/dist/lib/helpers/UiBaseLocators.js.map +1 -1
- package/dist/lib/helpers/UiHelpers.d.ts +6 -0
- package/dist/lib/helpers/UiHelpers.js +9 -0
- package/dist/lib/helpers/UiHelpers.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -24,6 +24,9 @@ import { ModelsBuilderApiHelper } from "./ModelsBuilderApiHelper";
|
|
|
24
24
|
import { HealthCheckApiHelper } from "./HealthCheckApiHelper";
|
|
25
25
|
import { IndexerApiHelper } from "./IndexerApiHelper";
|
|
26
26
|
import { PublishedCacheApiHelper } from "./PublishedCacheApiHelper";
|
|
27
|
+
import { MemberGroupApiHelper } from './MemberGroupApiHelper';
|
|
28
|
+
import { MemberApiHelper } from './MemberApiHelper';
|
|
29
|
+
import { MemberTypeApiHelper } from "./MemberTypeApiHelper";
|
|
27
30
|
export declare class ApiHelpers {
|
|
28
31
|
baseUrl: string;
|
|
29
32
|
page: Page;
|
|
@@ -52,6 +55,9 @@ export declare class ApiHelpers {
|
|
|
52
55
|
healthCheck: HealthCheckApiHelper;
|
|
53
56
|
indexer: IndexerApiHelper;
|
|
54
57
|
publishedCache: PublishedCacheApiHelper;
|
|
58
|
+
memberGroup: MemberGroupApiHelper;
|
|
59
|
+
member: MemberApiHelper;
|
|
60
|
+
memberType: MemberTypeApiHelper;
|
|
55
61
|
constructor(page: Page);
|
|
56
62
|
getBearerToken(): Promise<string>;
|
|
57
63
|
getCookie(): Promise<string>;
|
|
@@ -28,6 +28,9 @@ const ModelsBuilderApiHelper_1 = require("./ModelsBuilderApiHelper");
|
|
|
28
28
|
const HealthCheckApiHelper_1 = require("./HealthCheckApiHelper");
|
|
29
29
|
const IndexerApiHelper_1 = require("./IndexerApiHelper");
|
|
30
30
|
const PublishedCacheApiHelper_1 = require("./PublishedCacheApiHelper");
|
|
31
|
+
const MemberGroupApiHelper_1 = require("./MemberGroupApiHelper");
|
|
32
|
+
const MemberApiHelper_1 = require("./MemberApiHelper");
|
|
33
|
+
const MemberTypeApiHelper_1 = require("./MemberTypeApiHelper");
|
|
31
34
|
class ApiHelpers {
|
|
32
35
|
baseUrl = umbraco_config_1.umbracoConfig.environment.baseUrl;
|
|
33
36
|
page;
|
|
@@ -56,6 +59,9 @@ class ApiHelpers {
|
|
|
56
59
|
healthCheck;
|
|
57
60
|
indexer;
|
|
58
61
|
publishedCache;
|
|
62
|
+
memberGroup;
|
|
63
|
+
member;
|
|
64
|
+
memberType;
|
|
59
65
|
constructor(page) {
|
|
60
66
|
this.page = page;
|
|
61
67
|
this.alias = new AliasHelper_1.AliasHelper();
|
|
@@ -83,6 +89,9 @@ class ApiHelpers {
|
|
|
83
89
|
this.healthCheck = new HealthCheckApiHelper_1.HealthCheckApiHelper(this);
|
|
84
90
|
this.indexer = new IndexerApiHelper_1.IndexerApiHelper(this);
|
|
85
91
|
this.publishedCache = new PublishedCacheApiHelper_1.PublishedCacheApiHelper(this);
|
|
92
|
+
this.memberGroup = new MemberGroupApiHelper_1.MemberGroupApiHelper(this);
|
|
93
|
+
this.member = new MemberApiHelper_1.MemberApiHelper(this);
|
|
94
|
+
this.memberType = new MemberTypeApiHelper_1.MemberTypeApiHelper(this);
|
|
86
95
|
}
|
|
87
96
|
async getBearerToken() {
|
|
88
97
|
let someStorage = await this.page.context().storageState();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiHelpers.js","sourceRoot":"","sources":["../../../lib/helpers/ApiHelpers.ts"],"names":[],"mappings":";;;AACA,yDAAmD;AACnD,iDAA4C;AAC5C,qEAAgE;AAChE,2DAAsD;AACtD,+DAA0D;AAC1D,mEAA8D;AAC9D,6DAAwD;AACxD,2DAAsD;AACtD,+CAA0C;AAC1C,2DAAsD;AACtD,mDAA8C;AAC9C,qEAAgE;AAChE,yDAAoD;AACpD,uDAAkD;AAClD,iEAA4D;AAC5D,+DAA0D;AAC1D,yBAAyB;AACzB,6DAAwD;AACxD,mEAA8D;AAC9D,2DAAsD;AACtD,6DAAwD;AACxD,qDAAgD;AAChD,iEAA4D;AAC5D,qEAAgE;AAChE,iEAA4D;AAC5D,yDAAoD;AACpD,uEAAkE;AAElE,MAAa,UAAU;IACrB,OAAO,GAAW,8BAAa,CAAC,WAAW,CAAC,OAAO,CAAC;IACpD,IAAI,CAAO;IACX,KAAK,CAAc;IACnB,MAAM,CAAe;IACrB,SAAS,CAAyB;IAClC,QA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} from \"../../umbraco.config\";\nimport {ReportHelper} from \"./ReportHelper\";\nimport {TelemetryDataApiHelper} from \"./TelemetryDataApiHelper\";\nimport {LanguageApiHelper} from \"./LanguageApiHelper\";\nimport {DictionaryApiHelper} from \"./DictionaryApiHelper\";\nimport {RelationTypeApiHelper} from \"./RelationTypeApiHelper\";\nimport {UserGroupApiHelper} from \"./UserGroupApiHelper\";\nimport {TemplateApiHelper} from \"./TemplateApiHelper\";\nimport {AliasHelper} from \"./AliasHelper\";\nimport {DataTypeApiHelper} from \"./DataTypeApiHelper\";\nimport {UserApiHelper} from \"./UserApiHelper\";\nimport {TemporaryFileApiHelper} from \"./TemporaryFileApiHelper\";\nimport {PackageApiHelper} from \"./PackageApiHelper\";\nimport {ScriptApiHelper} from \"./ScriptApiHelper\";\nimport {PartialViewApiHelper} from \"./PartialViewApiHelper\";\nimport {StylesheetApiHelper} from \"./StylesheetApiHelper\";\nimport * as fs from \"fs\";\nimport {LogViewerApiHelper} from \"./LogViewerApiHelper\";\nimport {DocumentTypeApiHelper} from \"./DocumentTypeApiHelper\";\nimport {DocumentApiHelper} from \"./DocumentApiHelper\";\nimport {MediaTypeApiHelper} from \"./MediaTypeApiHelper\";\nimport {MediaApiHelper} from \"./MediaApiHelper\";\nimport {ObjectTypesApiHelper} from \"./ObjectTypesApiHelper\";\nimport {ModelsBuilderApiHelper} from \"./ModelsBuilderApiHelper\";\nimport {HealthCheckApiHelper} from \"./HealthCheckApiHelper\";\nimport {IndexerApiHelper} from \"./IndexerApiHelper\";\nimport {PublishedCacheApiHelper} from \"./PublishedCacheApiHelper\";\n\nexport class ApiHelpers {\n baseUrl: string = umbracoConfig.environment.baseUrl;\n page: Page;\n alias: AliasHelper;\n report: ReportHelper;\n telemetry: TelemetryDataApiHelper;\n language: LanguageApiHelper;\n dictionary: DictionaryApiHelper;\n relationType: RelationTypeApiHelper;\n userGroup: UserGroupApiHelper;\n template: TemplateApiHelper;\n dataType: DataTypeApiHelper;\n user: UserApiHelper;\n temporaryFile: TemporaryFileApiHelper;\n documentType: DocumentTypeApiHelper;\n document: DocumentApiHelper;\n package: PackageApiHelper;\n script: ScriptApiHelper;\n partialView: PartialViewApiHelper;\n stylesheet: StylesheetApiHelper;\n logViewer: LogViewerApiHelper;\n mediaType: MediaTypeApiHelper;\n media: MediaApiHelper;\n objectTypes: ObjectTypesApiHelper;\n modelsBuilder: ModelsBuilderApiHelper;\n healthCheck: HealthCheckApiHelper;\n indexer: IndexerApiHelper;\n publishedCache: PublishedCacheApiHelper;\n\n constructor(page: Page) {\n this.page = page;\n this.alias = new AliasHelper();\n this.report = new ReportHelper(this);\n this.telemetry = new TelemetryDataApiHelper(this);\n this.language = new LanguageApiHelper(this);\n this.dictionary = new DictionaryApiHelper(this);\n this.relationType = new RelationTypeApiHelper(this);\n this.userGroup = new UserGroupApiHelper(this);\n this.template = new TemplateApiHelper(this);\n this.dataType = new DataTypeApiHelper(this);\n this.user = new UserApiHelper(this);\n this.temporaryFile = new TemporaryFileApiHelper(this);\n this.documentType = new DocumentTypeApiHelper(this);\n this.document = new DocumentApiHelper(this);\n this.package = new PackageApiHelper(this);\n this.script = new ScriptApiHelper(this);\n this.partialView = new PartialViewApiHelper(this);\n this.stylesheet = new StylesheetApiHelper(this);\n this.logViewer = new LogViewerApiHelper(this);\n this.mediaType = new MediaTypeApiHelper(this);\n this.media = new MediaApiHelper(this);\n this.objectTypes = new ObjectTypesApiHelper(this);\n this.modelsBuilder = new ModelsBuilderApiHelper(this);\n this.healthCheck = new HealthCheckApiHelper(this);\n this.indexer = new IndexerApiHelper(this);\n this.publishedCache = new PublishedCacheApiHelper(this);\n }\n\n async getBearerToken() {\n let someStorage = await this.page.context().storageState();\n let someObject = JSON.parse(someStorage.origins[0].localStorage[0].value);\n return 'Bearer ' + someObject.access_token;\n }\n\n async getCookie() {\n let someStorage = await this.page.context().storageState();\n let cookieString = \"\";\n for (let cookie of someStorage.cookies) {\n cookieString += cookie.name + '=' + cookie.value + ';';\n }\n return cookieString;\n }\n\n async getHeaders() {\n return {\n 'Authorization': await this.getBearerToken(),\n 'Cookie': await this.getCookie(),\n }\n }\n\n async get(url: string, params?: { [key: string]: string | number | boolean; }) {\n const options = {\n headers: await this.getHeaders(),\n params: params,\n ignoreHTTPSErrors: true\n }\n return this.page.request.get(url, options);\n }\n\n async saveCodeFile(codeFile) {\n if (codeFile == null) {\n return;\n }\n return await this.post(umbracoConfig.environment.baseUrl + '/umbraco/backoffice/UmbracoApi/CodeFile/PostSave', codeFile);\n }\n\n async post(url: string, data?: object) {\n const options = {\n headers: await this.getHeaders(),\n data: data,\n ignoreHTTPSErrors: true\n }\n return await this.page.request.post(url, options);\n }\n\n async delete(url: string, data?: object) {\n const options = {\n headers: await this.getHeaders(),\n data: data,\n ignoreHTTPSErrors: true\n }\n return await this.page.request.delete(url, options);\n }\n\n async put(url: string, data?: object) {\n const options = {\n headers: await this.getHeaders(),\n data: data,\n ignoreHTTPSErrors: true\n }\n return await this.page.request.put(url, options);\n }\n\n async postMultiPartForm(url: string, id, name: string, mimeType: string, filePath) {\n const options = {\n headers: await this.getHeaders(),\n multipart: {\n Id: id,\n File: {\n name: name,\n mimeType: mimeType,\n buffer: fs.readFileSync(filePath)\n }\n },\n ignoreHTTPSErrors: true\n }\n return await this.page.request.post(url, options);\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"ApiHelpers.js","sourceRoot":"","sources":["../../../lib/helpers/ApiHelpers.ts"],"names":[],"mappings":";;;AACA,yDAAmD;AACnD,iDAA4C;AAC5C,qEAAgE;AAChE,2DAAsD;AACtD,+DAA0D;AAC1D,mEAA8D;AAC9D,6DAAwD;AACxD,2DAAsD;AACtD,+CAA0C;AAC1C,2DAAsD;AACtD,mDAA8C;AAC9C,qEAAgE;AAChE,yDAAoD;AACpD,uDAAkD;AAClD,iEAA4D;AAC5D,+DAA0D;AAC1D,yBAAyB;AACzB,6DAAwD;AACxD,mEAA8D;AAC9D,2DAAsD;AACtD,6DAAwD;AACxD,qDAAg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,CAAC,iBAAiB,CAAC,GAAW,EAAE,EAAE,EAAE,IAAY,EAAE,QAAgB,EAAE,QAAQ;QAC/E,MAAM,OAAO,GAAG;YACd,OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE;YAChC,SAAS,EAAE;gBACT,EAAE,EAAE,EAAE;gBACN,IAAI,EAAE;oBACJ,IAAI,EAAE,IAAI;oBACV,QAAQ,EAAE,QAAQ;oBAClB,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC;iBAClC;aACF;YACD,iBAAiB,EAAE,IAAI;SACxB,CAAA;QACD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;CACF;AAhJD,gCAgJC","sourcesContent":["import {Page} from \"@playwright/test\"\nimport {umbracoConfig} from \"../../umbraco.config\";\nimport {ReportHelper} from \"./ReportHelper\";\nimport {TelemetryDataApiHelper} from \"./TelemetryDataApiHelper\";\nimport {LanguageApiHelper} from \"./LanguageApiHelper\";\nimport {DictionaryApiHelper} from \"./DictionaryApiHelper\";\nimport {RelationTypeApiHelper} from \"./RelationTypeApiHelper\";\nimport {UserGroupApiHelper} from \"./UserGroupApiHelper\";\nimport {TemplateApiHelper} from \"./TemplateApiHelper\";\nimport {AliasHelper} from \"./AliasHelper\";\nimport {DataTypeApiHelper} from \"./DataTypeApiHelper\";\nimport {UserApiHelper} from \"./UserApiHelper\";\nimport {TemporaryFileApiHelper} from \"./TemporaryFileApiHelper\";\nimport {PackageApiHelper} from \"./PackageApiHelper\";\nimport {ScriptApiHelper} from \"./ScriptApiHelper\";\nimport {PartialViewApiHelper} from \"./PartialViewApiHelper\";\nimport {StylesheetApiHelper} from \"./StylesheetApiHelper\";\nimport * as fs from \"fs\";\nimport {LogViewerApiHelper} from \"./LogViewerApiHelper\";\nimport {DocumentTypeApiHelper} from \"./DocumentTypeApiHelper\";\nimport {DocumentApiHelper} from \"./DocumentApiHelper\";\nimport {MediaTypeApiHelper} from \"./MediaTypeApiHelper\";\nimport {MediaApiHelper} from \"./MediaApiHelper\";\nimport {ObjectTypesApiHelper} from \"./ObjectTypesApiHelper\";\nimport {ModelsBuilderApiHelper} from \"./ModelsBuilderApiHelper\";\nimport {HealthCheckApiHelper} from \"./HealthCheckApiHelper\";\nimport {IndexerApiHelper} from \"./IndexerApiHelper\";\nimport {PublishedCacheApiHelper} from \"./PublishedCacheApiHelper\";\nimport {MemberGroupApiHelper} from './MemberGroupApiHelper';\nimport {MemberApiHelper} from './MemberApiHelper';\nimport {MemberTypeApiHelper} from \"./MemberTypeApiHelper\";\n\nexport class ApiHelpers {\n baseUrl: string = umbracoConfig.environment.baseUrl;\n page: Page;\n alias: AliasHelper;\n report: ReportHelper;\n telemetry: TelemetryDataApiHelper;\n language: LanguageApiHelper;\n dictionary: DictionaryApiHelper;\n relationType: RelationTypeApiHelper;\n userGroup: UserGroupApiHelper;\n template: TemplateApiHelper;\n dataType: DataTypeApiHelper;\n user: UserApiHelper;\n temporaryFile: TemporaryFileApiHelper;\n documentType: DocumentTypeApiHelper;\n document: DocumentApiHelper;\n package: PackageApiHelper;\n script: ScriptApiHelper;\n partialView: PartialViewApiHelper;\n stylesheet: StylesheetApiHelper;\n logViewer: LogViewerApiHelper;\n mediaType: MediaTypeApiHelper;\n media: MediaApiHelper;\n objectTypes: ObjectTypesApiHelper;\n modelsBuilder: ModelsBuilderApiHelper;\n healthCheck: HealthCheckApiHelper;\n indexer: IndexerApiHelper;\n publishedCache: PublishedCacheApiHelper;\n memberGroup: MemberGroupApiHelper;\n member: MemberApiHelper;\n memberType: MemberTypeApiHelper;\n\n constructor(page: Page) {\n this.page = page;\n this.alias = new AliasHelper();\n this.report = new ReportHelper(this);\n this.telemetry = new TelemetryDataApiHelper(this);\n this.language = new LanguageApiHelper(this);\n this.dictionary = new DictionaryApiHelper(this);\n this.relationType = new RelationTypeApiHelper(this);\n this.userGroup = new UserGroupApiHelper(this);\n this.template = new TemplateApiHelper(this);\n this.dataType = new DataTypeApiHelper(this);\n this.user = new UserApiHelper(this);\n this.temporaryFile = new TemporaryFileApiHelper(this);\n this.documentType = new DocumentTypeApiHelper(this);\n this.document = new DocumentApiHelper(this);\n this.package = new PackageApiHelper(this);\n this.script = new ScriptApiHelper(this);\n this.partialView = new PartialViewApiHelper(this);\n this.stylesheet = new StylesheetApiHelper(this);\n this.logViewer = new LogViewerApiHelper(this);\n this.mediaType = new MediaTypeApiHelper(this);\n this.media = new MediaApiHelper(this);\n this.objectTypes = new ObjectTypesApiHelper(this);\n this.modelsBuilder = new ModelsBuilderApiHelper(this);\n this.healthCheck = new HealthCheckApiHelper(this);\n this.indexer = new IndexerApiHelper(this);\n this.publishedCache = new PublishedCacheApiHelper(this);\n this.memberGroup = new MemberGroupApiHelper(this);\n this.member = new MemberApiHelper(this);\n this.memberType = new MemberTypeApiHelper(this);\n }\n\n async getBearerToken() {\n let someStorage = await this.page.context().storageState();\n let someObject = JSON.parse(someStorage.origins[0].localStorage[0].value);\n return 'Bearer ' + someObject.access_token;\n }\n\n async getCookie() {\n let someStorage = await this.page.context().storageState();\n let cookieString = \"\";\n for (let cookie of someStorage.cookies) {\n cookieString += cookie.name + '=' + cookie.value + ';';\n }\n return cookieString;\n }\n\n async getHeaders() {\n return {\n 'Authorization': await this.getBearerToken(),\n 'Cookie': await this.getCookie(),\n }\n }\n\n async get(url: string, params?: { [key: string]: string | number | boolean; }) {\n const options = {\n headers: await this.getHeaders(),\n params: params,\n ignoreHTTPSErrors: true\n }\n return this.page.request.get(url, options);\n }\n\n async saveCodeFile(codeFile) {\n if (codeFile == null) {\n return;\n }\n return await this.post(umbracoConfig.environment.baseUrl + '/umbraco/backoffice/UmbracoApi/CodeFile/PostSave', codeFile);\n }\n\n async post(url: string, data?: object) {\n const options = {\n headers: await this.getHeaders(),\n data: data,\n ignoreHTTPSErrors: true\n }\n return await this.page.request.post(url, options);\n }\n\n async delete(url: string, data?: object) {\n const options = {\n headers: await this.getHeaders(),\n data: data,\n ignoreHTTPSErrors: true\n }\n return await this.page.request.delete(url, options);\n }\n\n async put(url: string, data?: object) {\n const options = {\n headers: await this.getHeaders(),\n data: data,\n ignoreHTTPSErrors: true\n }\n return await this.page.request.put(url, options);\n }\n\n async postMultiPartForm(url: string, id, name: string, mimeType: string, filePath) {\n const options = {\n headers: await this.getHeaders(),\n multipart: {\n Id: id,\n File: {\n name: name,\n mimeType: mimeType,\n buffer: fs.readFileSync(filePath)\n }\n },\n ignoreHTTPSErrors: true\n }\n return await this.page.request.post(url, options);\n }\n}"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiHelpers } from "./ApiHelpers";
|
|
2
|
+
export declare class MemberApiHelper {
|
|
3
|
+
api: ApiHelpers;
|
|
4
|
+
constructor(api: ApiHelpers);
|
|
5
|
+
get(id: string): Promise<any>;
|
|
6
|
+
create(member: any): Promise<string | undefined>;
|
|
7
|
+
delete(id: string): Promise<number | undefined>;
|
|
8
|
+
getAll(): Promise<import("playwright-core").APIResponse>;
|
|
9
|
+
filterByMemberTypeId(memberTypeId: string): Promise<import("playwright-core").APIResponse>;
|
|
10
|
+
doesExist(id: string): Promise<boolean>;
|
|
11
|
+
doesNameExist(name: string): Promise<any>;
|
|
12
|
+
getByName(name: string): Promise<any>;
|
|
13
|
+
ensureNameNotExists(name: string): Promise<number | null | undefined>;
|
|
14
|
+
createDefaultMember(memberName: string, memberTypeId: string, email: string, username: string, password: string): Promise<string | undefined>;
|
|
15
|
+
createMemberWithMemberGroup(memberName: string, memberTypeId: string, email: string, username: string, password: string, memberGroupId: string): Promise<string | undefined>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemberApiHelper = void 0;
|
|
4
|
+
const json_models_builders_1 = require("@umbraco/json-models-builders");
|
|
5
|
+
class MemberApiHelper {
|
|
6
|
+
api;
|
|
7
|
+
constructor(api) {
|
|
8
|
+
this.api = api;
|
|
9
|
+
}
|
|
10
|
+
async get(id) {
|
|
11
|
+
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member/' + id);
|
|
12
|
+
return await response.json();
|
|
13
|
+
}
|
|
14
|
+
async create(member) {
|
|
15
|
+
if (member == null) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/member', member);
|
|
19
|
+
return response.headers().location.split("v1/member/").pop();
|
|
20
|
+
}
|
|
21
|
+
async delete(id) {
|
|
22
|
+
if (id == null) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const response = await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/member/' + id);
|
|
26
|
+
return response.status();
|
|
27
|
+
}
|
|
28
|
+
async getAll() {
|
|
29
|
+
return await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/filter/member?orderBy=username&skip=0&take=10000');
|
|
30
|
+
}
|
|
31
|
+
async filterByMemberTypeId(memberTypeId) {
|
|
32
|
+
return await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/filter/member?memberTypeId=' + memberTypeId + '&orderBy=username&skip=0&take=100');
|
|
33
|
+
}
|
|
34
|
+
async doesExist(id) {
|
|
35
|
+
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member/' + id);
|
|
36
|
+
return response.status() === 200;
|
|
37
|
+
}
|
|
38
|
+
async doesNameExist(name) {
|
|
39
|
+
return await this.getByName(name);
|
|
40
|
+
}
|
|
41
|
+
async getByName(name) {
|
|
42
|
+
const rootMembers = await this.getAll();
|
|
43
|
+
const jsonMembers = await rootMembers.json();
|
|
44
|
+
for (const member of jsonMembers.items) {
|
|
45
|
+
if (member.variants[0].name === name) {
|
|
46
|
+
return this.get(member.id);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
async ensureNameNotExists(name) {
|
|
52
|
+
const rootMembers = await this.getAll();
|
|
53
|
+
const jsonMembers = await rootMembers.json();
|
|
54
|
+
for (const member of jsonMembers.items) {
|
|
55
|
+
if (member.variants[0].name === name) {
|
|
56
|
+
return this.delete(member.id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
async createDefaultMember(memberName, memberTypeId, email, username, password) {
|
|
62
|
+
const member = new json_models_builders_1.MemberBuilder()
|
|
63
|
+
.addVariant()
|
|
64
|
+
.withName(memberName)
|
|
65
|
+
.done()
|
|
66
|
+
.withEmail(email)
|
|
67
|
+
.withUsername(username)
|
|
68
|
+
.withPassword(password)
|
|
69
|
+
.withMemberTypeId(memberTypeId)
|
|
70
|
+
.build();
|
|
71
|
+
return await this.create(member);
|
|
72
|
+
}
|
|
73
|
+
async createMemberWithMemberGroup(memberName, memberTypeId, email, username, password, memberGroupId) {
|
|
74
|
+
const member = new json_models_builders_1.MemberBuilder()
|
|
75
|
+
.addVariant()
|
|
76
|
+
.withName(memberName)
|
|
77
|
+
.done()
|
|
78
|
+
.withEmail(email)
|
|
79
|
+
.withUsername(username)
|
|
80
|
+
.withPassword(password)
|
|
81
|
+
.withMemberTypeId(memberTypeId)
|
|
82
|
+
.addGroup(memberGroupId)
|
|
83
|
+
.build();
|
|
84
|
+
return await this.create(member);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.MemberApiHelper = MemberApiHelper;
|
|
88
|
+
//# sourceMappingURL=MemberApiHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberApiHelper.js","sourceRoot":"","sources":["../../../lib/helpers/MemberApiHelper.ts"],"names":[],"mappings":";;;AACA,wEAA4D;AAE5D,MAAa,eAAe;IAC1B,GAAG,CAAa;IAEhB,YAAY,GAAe;QACzB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,GAAG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AAU,EAAE;aACV,QAAQ,CAAC,UAAU,CAAC;aACpB,IAAI,EAAE;aACR,SAAS,CAAC,KAAK,CAAC;aAChB,YAAY,CAAC,QAAQ,CAAC;aACtB,YAAY,CAAC,QAAQ,CAAC;aACtB,gBAAgB,CAAC,YAAY,CAAC;aAC9B,KAAK,EAAE,CAAC;QACX,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,2BAA2B,CAAC,UAAkB,EAAE,YAAoB,EAAE,KAAa,EAAE,QAAgB,EAAE,QAAgB,EAAE,aAAqB;QAClJ,MAAM,MAAM,GAAG,IAAI,oCAAa,EAAE;aAC/B,UAAU,EAAE;aACV,QAAQ,CAAC,UAAU,CAAC;aACpB,IAAI,EAAE;aACR,SAAS,CAAC,KAAK,CAAC;aAChB,YAAY,CAAC,QAAQ,CAAC;aACtB,YAAY,CAAC,QAAQ,CAAC;aACtB,gBAAgB,CAAC,YAAY,CAAC;aAC9B,QAAQ,CAAC,aAAa,CAAC;aACvB,KAAK,EAAE,CAAC;QACX,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;CACF;AA/FD,0CA+FC","sourcesContent":["import {ApiHelpers} from \"./ApiHelpers\";\nimport {MemberBuilder} from \"@umbraco/json-models-builders\";\n\nexport class MemberApiHelper {\n api: ApiHelpers;\n\n constructor(api: ApiHelpers) {\n this.api = api;\n }\n\n async get(id: string) {\n const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member/' + id);\n return await response.json();\n }\n\n async create(member) {\n if (member == null) {\n return;\n }\n const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/member', member);\n return response.headers().location.split(\"v1/member/\").pop();\n }\n\n async delete(id: string) {\n if (id == null) {\n return;\n }\n const response = await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/member/' + id);\n return response.status();\n }\n\n async getAll() {\n return await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/filter/member?orderBy=username&skip=0&take=10000');\n }\n\n async filterByMemberTypeId(memberTypeId: string) {\n return await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/filter/member?memberTypeId='+ memberTypeId + '&orderBy=username&skip=0&take=100');\n }\n\n async doesExist(id: string) {\n const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member/' + id);\n return response.status() === 200;\n }\n\n async doesNameExist(name: string) {\n return await this.getByName(name);\n }\n\n async getByName(name: string) {\n const rootMembers = await this.getAll();\n const jsonMembers = await rootMembers.json();\n\n for (const member of jsonMembers.items) {\n if (member.variants[0].name === name) {\n return this.get(member.id);\n }\n }\n return false;\n }\n\n async ensureNameNotExists(name: string) {\n const rootMembers = await this.getAll();\n const jsonMembers = await rootMembers.json();\n\n for (const member of jsonMembers.items) {\n if (member.variants[0].name === name) {\n return this.delete(member.id);\n }\n }\n return null;\n }\n\n async createDefaultMember(memberName: string, memberTypeId: string, email: string, username: string, password: string) {\n const member = new MemberBuilder()\n .addVariant()\n .withName(memberName)\n .done()\n .withEmail(email)\n .withUsername(username)\n .withPassword(password)\n .withMemberTypeId(memberTypeId)\n .build();\n return await this.create(member);\n }\n\n async createMemberWithMemberGroup(memberName: string, memberTypeId: string, email: string, username: string, password: string, memberGroupId: string) {\n const member = new MemberBuilder()\n .addVariant()\n .withName(memberName)\n .done()\n .withEmail(email)\n .withUsername(username)\n .withPassword(password)\n .withMemberTypeId(memberTypeId)\n .addGroup(memberGroupId)\n .build();\n return await this.create(member);\n }\n}"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiHelpers } from "./ApiHelpers";
|
|
2
|
+
export declare class MemberGroupApiHelper {
|
|
3
|
+
api: ApiHelpers;
|
|
4
|
+
constructor(api: ApiHelpers);
|
|
5
|
+
get(id: string): Promise<any>;
|
|
6
|
+
create(name: string, id?: string): Promise<any>;
|
|
7
|
+
rename(id: string, name: string): Promise<import("playwright-core").APIResponse>;
|
|
8
|
+
delete(id: string): Promise<import("playwright-core").APIResponse>;
|
|
9
|
+
getAll(): Promise<import("playwright-core").APIResponse>;
|
|
10
|
+
doesExist(id: string): Promise<boolean>;
|
|
11
|
+
doesNameExist(name: string): Promise<any>;
|
|
12
|
+
getByName(name: string): Promise<any>;
|
|
13
|
+
ensureNameNotExists(name: string): Promise<import("playwright-core").APIResponse | null>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemberGroupApiHelper = void 0;
|
|
4
|
+
class MemberGroupApiHelper {
|
|
5
|
+
api;
|
|
6
|
+
constructor(api) {
|
|
7
|
+
this.api = api;
|
|
8
|
+
}
|
|
9
|
+
async get(id) {
|
|
10
|
+
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member-group/' + id);
|
|
11
|
+
return await response.json();
|
|
12
|
+
}
|
|
13
|
+
async create(name, id) {
|
|
14
|
+
const memberGroupData = {
|
|
15
|
+
"name": name,
|
|
16
|
+
"id": id ? id : null,
|
|
17
|
+
};
|
|
18
|
+
const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/member-group', memberGroupData);
|
|
19
|
+
const json = await response.json();
|
|
20
|
+
return json.id;
|
|
21
|
+
}
|
|
22
|
+
async rename(id, name) {
|
|
23
|
+
const memberGroupData = {
|
|
24
|
+
"name": name
|
|
25
|
+
};
|
|
26
|
+
return await this.api.put(this.api.baseUrl + '/umbraco/management/api/v1/member-group/' + id, memberGroupData);
|
|
27
|
+
}
|
|
28
|
+
async delete(id) {
|
|
29
|
+
return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/member-group/' + id);
|
|
30
|
+
}
|
|
31
|
+
async getAll() {
|
|
32
|
+
return await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/member-group/root?skip=0&take=10000');
|
|
33
|
+
}
|
|
34
|
+
async doesExist(id) {
|
|
35
|
+
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member-group/' + id);
|
|
36
|
+
return response.status() === 200;
|
|
37
|
+
}
|
|
38
|
+
async doesNameExist(name) {
|
|
39
|
+
return await this.getByName(name);
|
|
40
|
+
}
|
|
41
|
+
async getByName(name) {
|
|
42
|
+
const rootMemberGroups = await this.getAll();
|
|
43
|
+
const jsonMemberGroups = await rootMemberGroups.json();
|
|
44
|
+
for (const memberGroup of jsonMemberGroups.items) {
|
|
45
|
+
if (memberGroup.name === name) {
|
|
46
|
+
return this.get(memberGroup.id);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
async ensureNameNotExists(name) {
|
|
52
|
+
const rootMemberGroups = await this.getAll();
|
|
53
|
+
const jsonMemberGroups = await rootMemberGroups.json();
|
|
54
|
+
for (const memberGroup of jsonMemberGroups.items) {
|
|
55
|
+
if (memberGroup.name === name) {
|
|
56
|
+
return this.delete(memberGroup.id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.MemberGroupApiHelper = MemberGroupApiHelper;
|
|
63
|
+
//# sourceMappingURL=MemberGroupApiHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberGroupApiHelper.js","sourceRoot":"","sources":["../../../lib/helpers/MemberGroupApiHelper.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IAC/B,GAAG,CAAa;IAEhB,YAAY,GAAe;QACzB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,0CAA0C,GAAG,EAAE,CAAC,CAAC;QACxG,OAAO,MAAM,QAAQ,CAAC,IAAI,EAA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AAC;IACnC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAAY;QAC9B,OAAO,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAY;QAC1B,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QAC7C,MAAM,gBAAgB,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAC;QAEvD,KAAK,MAAM,WAAW,IAAI,gBAAgB,CAAC,KAAK,EAAE;YAChD,IAAI,WAAW,CAAC,IAAI,KAAK,IAAI,EAAE;gBAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;aACjC;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,IAAY;QACpC,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QAC7C,MAAM,gBAAgB,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,CAAC;QAEvD,KAAK,MAAM,WAAW,IAAI,gBAAgB,CAAC,KAAK,EAAE;YAChD,IAAI,WAAW,CAAC,IAAI,KAAK,IAAI,EAAE;gBAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;aACpC;SACF;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AArED,oDAqEC","sourcesContent":["import {ApiHelpers} from \"./ApiHelpers\";\n\nexport class MemberGroupApiHelper {\n api: ApiHelpers;\n\n constructor(api: ApiHelpers) {\n this.api = api;\n }\n\n async get(id: string) {\n const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member-group/' + id);\n return await response.json();\n }\n\n async create(name: string, id?: string) {\n const memberGroupData = {\n \"name\": name,\n \"id\": id ? id : null,\n };\n const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/member-group', memberGroupData);\n const json = await response.json();\n return json.id;\n }\n\n async rename(id: string, name: string) {\n const memberGroupData = {\n \"name\": name\n };\n return await this.api.put(this.api.baseUrl + '/umbraco/management/api/v1/member-group/' + id, memberGroupData);\n }\n\n async delete(id: string) {\n return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/member-group/' + id);\n }\n\n async getAll() {\n return await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/member-group/root?skip=0&take=10000');\n }\n\n async doesExist(id: string) {\n const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member-group/' + id);\n return response.status() === 200;\n }\n\n async doesNameExist(name: string) {\n return await this.getByName(name);\n }\n\n async getByName(name: string) {\n const rootMemberGroups = await this.getAll();\n const jsonMemberGroups = await rootMemberGroups.json();\n\n for (const memberGroup of jsonMemberGroups.items) {\n if (memberGroup.name === name) {\n return this.get(memberGroup.id);\n }\n }\n return false;\n }\n\n async ensureNameNotExists(name: string) {\n const rootMemberGroups = await this.getAll();\n const jsonMemberGroups = await rootMemberGroups.json();\n\n for (const memberGroup of jsonMemberGroups.items) {\n if (memberGroup.name === name) {\n return this.delete(memberGroup.id);\n }\n }\n return null;\n }\n}"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Page } from "@playwright/test";
|
|
2
|
+
import { UiBaseLocators } from "./UiBaseLocators";
|
|
3
|
+
export declare class MemberGroupUiHelper extends UiBaseLocators {
|
|
4
|
+
private readonly memberGroupsTab;
|
|
5
|
+
private readonly memberGroupNameTxt;
|
|
6
|
+
private readonly actionsBtn;
|
|
7
|
+
private readonly leftArrowBtn;
|
|
8
|
+
private readonly memberGroupView;
|
|
9
|
+
constructor(page: Page);
|
|
10
|
+
clickMemberGroupsTab(): Promise<void>;
|
|
11
|
+
enterMemberGroupName(name: string): Promise<void>;
|
|
12
|
+
clickMemberGroupLinkByName(memberGroupName: string): Promise<void>;
|
|
13
|
+
clickActionsButton(): Promise<void>;
|
|
14
|
+
clickLeftArrowButton(): Promise<void>;
|
|
15
|
+
isMemberGroupNameVisible(memberGroupName: string, isVisible?: boolean): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemberGroupUiHelper = void 0;
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const UiBaseLocators_1 = require("./UiBaseLocators");
|
|
6
|
+
class MemberGroupUiHelper extends UiBaseLocators_1.UiBaseLocators {
|
|
7
|
+
memberGroupsTab;
|
|
8
|
+
memberGroupNameTxt;
|
|
9
|
+
actionsBtn;
|
|
10
|
+
leftArrowBtn;
|
|
11
|
+
memberGroupView;
|
|
12
|
+
constructor(page) {
|
|
13
|
+
super(page);
|
|
14
|
+
this.memberGroupsTab = page.locator('uui-tab[label="Member Groups"]');
|
|
15
|
+
this.memberGroupNameTxt = page.locator('input#input');
|
|
16
|
+
this.actionsBtn = page.getByLabel('Actions', { exact: true });
|
|
17
|
+
this.leftArrowBtn = page.locator('[name="icon-arrow-left"] svg');
|
|
18
|
+
this.memberGroupView = page.locator('umb-member-group-table-collection-view');
|
|
19
|
+
}
|
|
20
|
+
async clickMemberGroupsTab() {
|
|
21
|
+
await this.memberGroupsTab.click();
|
|
22
|
+
}
|
|
23
|
+
async enterMemberGroupName(name) {
|
|
24
|
+
await (0, test_1.expect)(this.memberGroupNameTxt).toBeVisible();
|
|
25
|
+
await this.memberGroupNameTxt.clear();
|
|
26
|
+
await this.memberGroupNameTxt.fill(name);
|
|
27
|
+
}
|
|
28
|
+
async clickMemberGroupLinkByName(memberGroupName) {
|
|
29
|
+
await this.page.getByRole('link', { name: memberGroupName }).click();
|
|
30
|
+
}
|
|
31
|
+
async clickActionsButton() {
|
|
32
|
+
await this.actionsBtn.click();
|
|
33
|
+
}
|
|
34
|
+
async clickLeftArrowButton() {
|
|
35
|
+
await this.leftArrowBtn.click();
|
|
36
|
+
}
|
|
37
|
+
async isMemberGroupNameVisible(memberGroupName, isVisible = true) {
|
|
38
|
+
return (0, test_1.expect)(this.memberGroupView.filter({ hasText: memberGroupName })).toBeVisible({ visible: isVisible, timeout: 500 });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.MemberGroupUiHelper = MemberGroupUiHelper;
|
|
42
|
+
//# sourceMappingURL=MemberGroupUiHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberGroupUiHelper.js","sourceRoot":"","sources":["../../../lib/helpers/MemberGroupUiHelper.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AACvD,qDAAgD;AAEhD,MAAa,mBAAoB,SAAQ,+BAAc;IACpC,eAAe,CAAU;IACzB,kBAAkB,CAAU;IAC5B,UAAU,CAAU;IACpB,YAAY,CAAU;IACtB,eAAe,CAAU;IAE1C,YAAY,IAAU;QACpB,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;QACtE,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACtD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;QAC5D,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,8BAA8B,CAAC,CAAC;QACjE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,wCAAwC,CAAC,CAAC;IAChF,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,IAAY;QACrC,MAAM,IAAA,aAAM,EAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,WAAW,EAAE,CAAC;QACpD,MAAM,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QACtC,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,0BAA0B,CAAC,eAAuB;QACtD,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAC,IAAI,EAAE,eAAe,EAAC,CAAC,CAAC,KAAK,EAAE,CAAC;IACrE,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,MAAM,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,eAAuB,EAAE,YAAqB,IAAI;QAC/E,OAAO,IAAA,aAAM,EAAC,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,EAAC,OAAO,EAAE,eAAe,EAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EAAC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,EAAC,CAAC,CAAC;IACzH,CAAC;CACF;AAzCD,kDAyCC","sourcesContent":["import {Page, Locator, expect} from \"@playwright/test\";\nimport {UiBaseLocators} from \"./UiBaseLocators\";\n\nexport class MemberGroupUiHelper extends UiBaseLocators {\n private readonly memberGroupsTab: Locator;\n private readonly memberGroupNameTxt: Locator;\n private readonly actionsBtn: Locator;\n private readonly leftArrowBtn: Locator;\n private readonly memberGroupView: Locator;\n\n constructor(page: Page) {\n super(page);\n this.memberGroupsTab = page.locator('uui-tab[label=\"Member Groups\"]');\n this.memberGroupNameTxt = page.locator('input#input');\n this.actionsBtn = page.getByLabel('Actions', {exact: true});\n this.leftArrowBtn = page.locator('[name=\"icon-arrow-left\"] svg');\n this.memberGroupView = page.locator('umb-member-group-table-collection-view');\n }\n\n async clickMemberGroupsTab() {\n await this.memberGroupsTab.click();\n }\n\n async enterMemberGroupName(name: string) {\n await expect(this.memberGroupNameTxt).toBeVisible();\n await this.memberGroupNameTxt.clear();\n await this.memberGroupNameTxt.fill(name);\n }\n\n async clickMemberGroupLinkByName(memberGroupName: string) {\n await this.page.getByRole('link', {name: memberGroupName}).click();\n }\n\n async clickActionsButton() {\n await this.actionsBtn.click();\n }\n\n async clickLeftArrowButton() {\n await this.leftArrowBtn.click();\n }\n\n async isMemberGroupNameVisible(memberGroupName: string, isVisible: boolean = true) {\n return expect(this.memberGroupView.filter({hasText: memberGroupName})).toBeVisible({visible: isVisible, timeout: 500});\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ApiHelpers } from "./ApiHelpers";
|
|
2
|
+
export declare class MemberTypeApiHelper {
|
|
3
|
+
api: ApiHelpers;
|
|
4
|
+
constructor(api: ApiHelpers);
|
|
5
|
+
ensureNameNotExists(name: string): Promise<number | null | undefined>;
|
|
6
|
+
create(memberType: any): Promise<string | undefined>;
|
|
7
|
+
update(id: string, updatedMemberType: any): Promise<import("playwright-core").APIResponse | undefined>;
|
|
8
|
+
get(id: string): Promise<any>;
|
|
9
|
+
delete(id: string): Promise<number | undefined>;
|
|
10
|
+
getAllAtRoot(): Promise<import("playwright-core").APIResponse>;
|
|
11
|
+
getByName(name: string): Promise<any>;
|
|
12
|
+
doesExist(id: string): Promise<boolean>;
|
|
13
|
+
doesNameExist(name: string): Promise<any>;
|
|
14
|
+
createDefaultMemberType(memberTypeName: string): Promise<string | undefined>;
|
|
15
|
+
createMemberTypeWithPropertyEditor(memberTypeName: string, dataTypeName: string, dataTypeId: string, groupName?: string): Promise<string | undefined>;
|
|
16
|
+
createMemberTypeWithTwoPropertyEditors(memberTypeName: string, dataTypeNameOne: string, dataTypeIdOne: string, dataTypeNameTwo: string, dataTypeIdTwo: string, groupName?: string): Promise<string | undefined>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemberTypeApiHelper = void 0;
|
|
4
|
+
const AliasHelper_1 = require("./AliasHelper");
|
|
5
|
+
const json_models_builders_1 = require("@umbraco/json-models-builders");
|
|
6
|
+
class MemberTypeApiHelper {
|
|
7
|
+
api;
|
|
8
|
+
constructor(api) {
|
|
9
|
+
this.api = api;
|
|
10
|
+
}
|
|
11
|
+
async ensureNameNotExists(name) {
|
|
12
|
+
const rootMemberTypes = await this.getAllAtRoot();
|
|
13
|
+
const jsonMemberTypes = await rootMemberTypes.json();
|
|
14
|
+
for (const memberType of jsonMemberTypes.items) {
|
|
15
|
+
if (memberType.name === name) {
|
|
16
|
+
return await this.delete(memberType.id);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
async create(memberType) {
|
|
22
|
+
if (memberType == null) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/member-type', memberType);
|
|
26
|
+
return response.headers().location.split("v1/member-type/").pop();
|
|
27
|
+
}
|
|
28
|
+
async update(id, updatedMemberType) {
|
|
29
|
+
if (updatedMemberType == null) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
return await this.api.put(this.api.baseUrl + '/umbraco/management/api/v1/member-type/' + id, updatedMemberType);
|
|
33
|
+
}
|
|
34
|
+
async get(id) {
|
|
35
|
+
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member-type/' + id);
|
|
36
|
+
return await response.json();
|
|
37
|
+
}
|
|
38
|
+
async delete(id) {
|
|
39
|
+
if (id == null) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const response = await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/member-type/' + id);
|
|
43
|
+
return response.status();
|
|
44
|
+
}
|
|
45
|
+
async getAllAtRoot() {
|
|
46
|
+
return await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/member-type/root?skip=0&take=10000');
|
|
47
|
+
}
|
|
48
|
+
async getByName(name) {
|
|
49
|
+
const rootMemberTypes = await this.getAllAtRoot();
|
|
50
|
+
const jsonMemberTypes = await rootMemberTypes.json();
|
|
51
|
+
for (const memberType of jsonMemberTypes.items) {
|
|
52
|
+
if (memberType.name === name) {
|
|
53
|
+
return this.get(memberType.id);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
async doesExist(id) {
|
|
59
|
+
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member-type/' + id);
|
|
60
|
+
return response.status() === 200;
|
|
61
|
+
}
|
|
62
|
+
async doesNameExist(name) {
|
|
63
|
+
return await this.getByName(name);
|
|
64
|
+
}
|
|
65
|
+
async createDefaultMemberType(memberTypeName) {
|
|
66
|
+
const memberType = new json_models_builders_1.MemberTypeBuilder()
|
|
67
|
+
.withName(memberTypeName)
|
|
68
|
+
.withAlias(AliasHelper_1.AliasHelper.toAlias(memberTypeName))
|
|
69
|
+
.withAllowedAsRoot(true)
|
|
70
|
+
.build();
|
|
71
|
+
return await this.create(memberType);
|
|
72
|
+
}
|
|
73
|
+
async createMemberTypeWithPropertyEditor(memberTypeName, dataTypeName, dataTypeId, groupName = "GroupTest") {
|
|
74
|
+
const crypto = require('crypto');
|
|
75
|
+
const containerId = crypto.randomUUID();
|
|
76
|
+
const memberType = new json_models_builders_1.MemberTypeBuilder()
|
|
77
|
+
.withName(memberTypeName)
|
|
78
|
+
.withAlias(AliasHelper_1.AliasHelper.toAlias(memberTypeName))
|
|
79
|
+
.addContainer()
|
|
80
|
+
.withName(groupName)
|
|
81
|
+
.withId(containerId)
|
|
82
|
+
.withType("Group")
|
|
83
|
+
.done()
|
|
84
|
+
.addProperty()
|
|
85
|
+
.withContainerId(containerId)
|
|
86
|
+
.withAlias(AliasHelper_1.AliasHelper.toAlias(dataTypeName))
|
|
87
|
+
.withName(dataTypeName)
|
|
88
|
+
.withDataTypeId(dataTypeId)
|
|
89
|
+
.done()
|
|
90
|
+
.build();
|
|
91
|
+
return await this.create(memberType);
|
|
92
|
+
}
|
|
93
|
+
async createMemberTypeWithTwoPropertyEditors(memberTypeName, dataTypeNameOne, dataTypeIdOne, dataTypeNameTwo, dataTypeIdTwo, groupName = "GroupTest") {
|
|
94
|
+
const crypto = require('crypto');
|
|
95
|
+
const containerId = crypto.randomUUID();
|
|
96
|
+
const memberType = new json_models_builders_1.MemberTypeBuilder()
|
|
97
|
+
.withName(memberTypeName)
|
|
98
|
+
.withAlias(AliasHelper_1.AliasHelper.toAlias(memberTypeName))
|
|
99
|
+
.addContainer()
|
|
100
|
+
.withName(groupName)
|
|
101
|
+
.withId(containerId)
|
|
102
|
+
.withType("Group")
|
|
103
|
+
.done()
|
|
104
|
+
.addProperty()
|
|
105
|
+
.withContainerId(containerId)
|
|
106
|
+
.withAlias(AliasHelper_1.AliasHelper.toAlias(dataTypeNameOne))
|
|
107
|
+
.withName(dataTypeNameOne)
|
|
108
|
+
.withDataTypeId(dataTypeIdOne)
|
|
109
|
+
.done()
|
|
110
|
+
.addProperty()
|
|
111
|
+
.withContainerId(containerId)
|
|
112
|
+
.withAlias(AliasHelper_1.AliasHelper.toAlias(dataTypeNameTwo))
|
|
113
|
+
.withName(dataTypeNameTwo)
|
|
114
|
+
.withDataTypeId(dataTypeIdTwo)
|
|
115
|
+
.done()
|
|
116
|
+
.build();
|
|
117
|
+
return await this.create(memberType);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.MemberTypeApiHelper = MemberTypeApiHelper;
|
|
121
|
+
//# sourceMappingURL=MemberTypeApiHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberTypeApiHelper.js","sourceRoot":"","sources":["../../../lib/helpers/MemberTypeApiHelper.ts"],"names":[],"mappings":";;;AACA,+CAA0C;AAC1C,wEAAgE;AAEhE,MAAa,mBAAmB;IAC9B,G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EAAE,CAAC;QAExC,MAAM,UAAU,GAAG,IAAI,wCAAiB,EAAE;aACvC,QAAQ,CAAC,cAAc,CAAC;aACxB,SAAS,CAAC,yBAAW,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;aAC9C,YAAY,EAAE;aACZ,QAAQ,CAAC,SAAS,CAAC;aACnB,MAAM,CAAC,WAAW,CAAC;aACnB,QAAQ,CAAC,OAAO,CAAC;aACjB,IAAI,EAAE;aACR,WAAW,EAAE;aACX,eAAe,CAAC,WAAW,CAAC;aAC5B,SAAS,CAAC,yBAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;aAC/C,QAAQ,CAAC,eAAe,CAAC;aACzB,cAAc,CAAC,aAAa,CAAC;aAC7B,IAAI,EAAE;aACR,WAAW,EAAE;aACX,eAAe,CAAC,WAAW,CAAC;aAC5B,SAAS,CAAC,yBAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;aAC/C,QAAQ,CAAC,eAAe,CAAC;aACzB,cAAc,CAAC,aAAa,CAAC;aAC7B,IAAI,EAAE;aACR,KAAK,EAAE,CAAC;QACX,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;CACF;AApID,kDAoIC","sourcesContent":["import {ApiHelpers} from \"./ApiHelpers\";\nimport {AliasHelper} from \"./AliasHelper\";\nimport {MemberTypeBuilder} from \"@umbraco/json-models-builders\";\n\nexport class MemberTypeApiHelper {\n api: ApiHelpers;\n\n constructor(api: ApiHelpers) {\n this.api = api;\n }\n\n async ensureNameNotExists(name: string) {\n const rootMemberTypes = await this.getAllAtRoot();\n const jsonMemberTypes = await rootMemberTypes.json();\n\n for (const memberType of jsonMemberTypes.items) {\n if (memberType.name === name) {\n return await this.delete(memberType.id);\n }\n }\n return null;\n }\n\n async create(memberType) {\n if (memberType == null) {\n return;\n }\n const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/member-type', memberType);\n return response.headers().location.split(\"v1/member-type/\").pop();\n }\n\n async update(id: string, updatedMemberType) {\n if (updatedMemberType == null) {\n return;\n }\n return await this.api.put(this.api.baseUrl + '/umbraco/management/api/v1/member-type/' + id, updatedMemberType);\n }\n\n async get(id: string) {\n const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member-type/' + id);\n return await response.json();\n }\n\n async delete(id: string) {\n if (id == null) {\n return;\n }\n const response = await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/member-type/' + id);\n return response.status();\n }\n\n async getAllAtRoot() {\n return await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/member-type/root?skip=0&take=10000');\n }\n\n async getByName(name: string) {\n const rootMemberTypes = await this.getAllAtRoot();\n const jsonMemberTypes = await rootMemberTypes.json();\n\n for (const memberType of jsonMemberTypes.items) {\n if (memberType.name === name) {\n return this.get(memberType.id);\n }\n }\n return false;\n }\n\n async doesExist(id: string) {\n const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/member-type/' + id);\n return response.status() === 200;\n }\n\n async doesNameExist(name: string) {\n return await this.getByName(name);\n }\n\n async createDefaultMemberType(memberTypeName: string) {\n const memberType = new MemberTypeBuilder()\n .withName(memberTypeName)\n .withAlias(AliasHelper.toAlias(memberTypeName))\n .withAllowedAsRoot(true)\n .build();\n return await this.create(memberType);\n }\n\n async createMemberTypeWithPropertyEditor(memberTypeName: string, dataTypeName: string, dataTypeId: string, groupName: string = \"GroupTest\")\n {\n const crypto = require('crypto');\n const containerId = crypto.randomUUID();\n\n const memberType = new MemberTypeBuilder()\n .withName(memberTypeName)\n .withAlias(AliasHelper.toAlias(memberTypeName))\n .addContainer()\n .withName(groupName)\n .withId(containerId)\n .withType(\"Group\")\n .done()\n .addProperty()\n .withContainerId(containerId)\n .withAlias(AliasHelper.toAlias(dataTypeName))\n .withName(dataTypeName)\n .withDataTypeId(dataTypeId)\n .done()\n .build();\n return await this.create(memberType);\n }\n\n async createMemberTypeWithTwoPropertyEditors(memberTypeName: string, dataTypeNameOne: string, dataTypeIdOne: string, dataTypeNameTwo: string, dataTypeIdTwo: string, groupName: string = \"GroupTest\")\n {\n const crypto = require('crypto');\n const containerId = crypto.randomUUID();\n\n const memberType = new MemberTypeBuilder()\n .withName(memberTypeName)\n .withAlias(AliasHelper.toAlias(memberTypeName))\n .addContainer()\n .withName(groupName)\n .withId(containerId)\n .withType(\"Group\")\n .done()\n .addProperty()\n .withContainerId(containerId)\n .withAlias(AliasHelper.toAlias(dataTypeNameOne))\n .withName(dataTypeNameOne)\n .withDataTypeId(dataTypeIdOne)\n .done()\n .addProperty()\n .withContainerId(containerId)\n .withAlias(AliasHelper.toAlias(dataTypeNameTwo))\n .withName(dataTypeNameTwo)\n .withDataTypeId(dataTypeIdTwo)\n .done()\n .build();\n return await this.create(memberType);\n }\n}"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UiBaseLocators } from "./UiBaseLocators";
|
|
2
|
+
import { Page } from "@playwright/test";
|
|
3
|
+
export declare class MemberTypeUiHelper extends UiBaseLocators {
|
|
4
|
+
private readonly memberTypeNameTxt;
|
|
5
|
+
private readonly memberTypeEditPropertyWorkspace;
|
|
6
|
+
constructor(page: Page);
|
|
7
|
+
clickActionsMenuForMemberType(name: string): Promise<void>;
|
|
8
|
+
clickActionsMenuAtRoot(): Promise<void>;
|
|
9
|
+
clickRootFolderCaretButton(): Promise<void>;
|
|
10
|
+
goToMemberType(memberTypeName: string): Promise<void>;
|
|
11
|
+
enterMemberTypeName(name: string): Promise<void>;
|
|
12
|
+
enterDescriptionForPropertyEditorWithName(propertyEditorName: string, description: string): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MemberTypeUiHelper = void 0;
|
|
4
|
+
const UiBaseLocators_1 = require("./UiBaseLocators");
|
|
5
|
+
class MemberTypeUiHelper extends UiBaseLocators_1.UiBaseLocators {
|
|
6
|
+
memberTypeNameTxt;
|
|
7
|
+
memberTypeEditPropertyWorkspace;
|
|
8
|
+
constructor(page) {
|
|
9
|
+
super(page);
|
|
10
|
+
this.memberTypeNameTxt = page.getByLabel('name', { exact: true });
|
|
11
|
+
this.memberTypeEditPropertyWorkspace = page.locator('umb-member-type-workspace-view-edit-property');
|
|
12
|
+
}
|
|
13
|
+
async clickActionsMenuForMemberType(name) {
|
|
14
|
+
await this.clickActionsMenuForName(name);
|
|
15
|
+
}
|
|
16
|
+
async clickActionsMenuAtRoot() {
|
|
17
|
+
await this.clickActionsMenuForMemberType("Member Types");
|
|
18
|
+
}
|
|
19
|
+
async clickRootFolderCaretButton() {
|
|
20
|
+
await this.clickCaretButtonForName("Member Types");
|
|
21
|
+
}
|
|
22
|
+
async goToMemberType(memberTypeName) {
|
|
23
|
+
await this.clickRootFolderCaretButton();
|
|
24
|
+
await this.page.getByLabel(memberTypeName).click();
|
|
25
|
+
}
|
|
26
|
+
async enterMemberTypeName(name) {
|
|
27
|
+
await this.memberTypeNameTxt.clear();
|
|
28
|
+
await this.memberTypeNameTxt.fill(name);
|
|
29
|
+
}
|
|
30
|
+
async enterDescriptionForPropertyEditorWithName(propertyEditorName, description) {
|
|
31
|
+
await this.memberTypeEditPropertyWorkspace.filter({ hasText: propertyEditorName }).getByLabel('description').fill(description);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.MemberTypeUiHelper = MemberTypeUiHelper;
|
|
35
|
+
//# sourceMappingURL=MemberTypeUiHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberTypeUiHelper.js","sourceRoot":"","sources":["../../../lib/helpers/MemberTypeUiHelper.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAGhD,MAAa,kBAAmB,SAAQ,+BAAc;IACnC,iBAAiB,CAAU;IAC3B,+BAA+B,CAAU;IAE1D,YAAY,IAAU;QACpB,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;QAChE,IAAI,CAAC,+BAA+B,GAAG,IAAI,CAAC,OAAO,CAAC,8CAA8C,CAAC,CAAC;IACtG,CAAC;IAED,KAAK,CAAC,6BAA6B,CAAC,IAAY;QAC9C,MAAM,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,sBAAsB;QAC1B,MAAM,IAAI,CAAC,6BAA6B,CAAC,cAAc,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,0BAA0B;QAC9B,MAAM,IAAI,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,cAAsB;QACzC,MAAM,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACxC,MAAM,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,IAAY;QACpC,MAAM,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QACrC,MAAM,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,yCAAyC,CAAC,kBAA0B,EAAE,WAAmB;QAC7F,MAAM,IAAI,CAAC,+BAA+B,CAAC,MAAM,CAAC,EAAC,OAAO,EAAE,kBAAkB,EAAC,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC/H,CAAC;CACF;AAnCD,gDAmCC","sourcesContent":["import {UiBaseLocators} from \"./UiBaseLocators\";\nimport {Locator, Page} from \"@playwright/test\";\n\nexport class MemberTypeUiHelper extends UiBaseLocators {\n private readonly memberTypeNameTxt: Locator;\n private readonly memberTypeEditPropertyWorkspace: Locator;\n\n constructor(page: Page) {\n super(page);\n this.memberTypeNameTxt = page.getByLabel('name', {exact: true});\n this.memberTypeEditPropertyWorkspace = page.locator('umb-member-type-workspace-view-edit-property');\n }\n\n async clickActionsMenuForMemberType(name: string) {\n await this.clickActionsMenuForName(name);\n }\n\n async clickActionsMenuAtRoot() {\n await this.clickActionsMenuForMemberType(\"Member Types\");\n }\n\n async clickRootFolderCaretButton() {\n await this.clickCaretButtonForName(\"Member Types\");\n }\n\n async goToMemberType(memberTypeName: string) {\n await this.clickRootFolderCaretButton();\n await this.page.getByLabel(memberTypeName).click();\n }\n\n async enterMemberTypeName(name: string) {\n await this.memberTypeNameTxt.clear();\n await this.memberTypeNameTxt.fill(name);\n }\n\n async enterDescriptionForPropertyEditorWithName(propertyEditorName: string, description: string) {\n await this.memberTypeEditPropertyWorkspace.filter({hasText: propertyEditorName}).getByLabel('description').fill(description);\n }\n}"]}
|