@umbraco/playwright-testhelpers 16.0.50 → 16.0.52

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.
@@ -90,7 +90,16 @@ export declare class DocumentApiHelper {
90
90
  emptyRecycleBin(): Promise<import("playwright-core").APIResponse>;
91
91
  getRecycleBinItems(): Promise<import("playwright-core").APIResponse>;
92
92
  doesItemExistInRecycleBin(documentItemName: string): Promise<boolean>;
93
- createDocumentWithTwoCulturesAndTextContent(documentName: string, documentTypeId: string, textContent: string, dataTypeName: string, firstCulture: string, secondCulture: string): Promise<string>;
93
+ createDocumentWithTwoCulturesAndTextContent(documentName: string, documentTypeId: string, textContent: string, dataTypeName: string, firstCulture: string, secondCulture: string, firstDomainName?: string, secondDomainName?: string): Promise<string>;
94
94
  createDefaultDocumentWithOneDocumentLink(documentName: string, linkedDocumentName: string, linkedDocumentId: string, documentTypeName?: string): Promise<string | undefined>;
95
95
  createDefaultDocumentWithOneMediaLink(documentName: string, linkedMediaName: string, documentTypeName?: string): Promise<string | undefined>;
96
+ createVariantDocumentWithVariantProperty(documentName: string, documentTypeId: string, dataTypeName: string, propertyVariants: {
97
+ culture: string;
98
+ value: any;
99
+ }[]): Promise<string | undefined>;
100
+ updateDomainsForVariantDocument(documentId: string, domains: {
101
+ domainName: string;
102
+ isoCode: string;
103
+ }[]): Promise<import("playwright-core").APIResponse>;
104
+ addTextstringValueToInvariantDocument(documentId: string, dataTypeName: string, textValue: string): Promise<import("playwright-core").APIResponse | undefined>;
96
105
  }
@@ -1325,7 +1325,7 @@ class DocumentApiHelper {
1325
1325
  }
1326
1326
  return false;
1327
1327
  }
1328
- async createDocumentWithTwoCulturesAndTextContent(documentName, documentTypeId, textContent, dataTypeName, firstCulture, secondCulture) {
1328
+ async createDocumentWithTwoCulturesAndTextContent(documentName, documentTypeId, textContent, dataTypeName, firstCulture, secondCulture, firstDomainName = '/testfirstdomain', secondDomainName = '/testseconddomain') {
1329
1329
  await this.ensureNameNotExists(documentName);
1330
1330
  const document = new json_models_builders_1.DocumentBuilder()
1331
1331
  .withDocumentTypeId(documentTypeId)
@@ -1345,11 +1345,11 @@ class DocumentApiHelper {
1345
1345
  const contentId = await this.create(document) || '';
1346
1346
  const domainData = new json_models_builders_1.DocumentDomainBuilder()
1347
1347
  .addDomain()
1348
- .withDomainName('/testfirstdomain')
1348
+ .withDomainName(firstDomainName)
1349
1349
  .withIsoCode(firstCulture)
1350
1350
  .done()
1351
1351
  .addDomain()
1352
- .withDomainName('/testseconddomain')
1352
+ .withDomainName(secondDomainName)
1353
1353
  .withIsoCode(secondCulture)
1354
1354
  .done()
1355
1355
  .build();
@@ -1415,6 +1415,49 @@ class DocumentApiHelper {
1415
1415
  // Create document
1416
1416
  return await this.create(document);
1417
1417
  }
1418
+ async createVariantDocumentWithVariantProperty(documentName, documentTypeId, dataTypeName, propertyVariants) {
1419
+ await this.ensureNameNotExists(documentName);
1420
+ const documentDataBuilder = new json_models_builders_1.DocumentBuilder()
1421
+ .withDocumentTypeId(documentTypeId);
1422
+ for (const property of propertyVariants) {
1423
+ documentDataBuilder
1424
+ .addVariant()
1425
+ .withName(property.culture === 'en-US' ? documentName : documentName + ' - ' + property.culture)
1426
+ .withCulture(property.culture)
1427
+ .done()
1428
+ .addValue()
1429
+ .withAlias(AliasHelper_1.AliasHelper.toAlias(dataTypeName))
1430
+ .withValue(property.value)
1431
+ .withCulture(property.culture)
1432
+ .done();
1433
+ }
1434
+ const document = documentDataBuilder.build();
1435
+ return await this.create(document);
1436
+ }
1437
+ async updateDomainsForVariantDocument(documentId, domains) {
1438
+ const domainDataBuilder = new json_models_builders_1.DocumentDomainBuilder();
1439
+ for (const domain of domains) {
1440
+ domainDataBuilder.addDomain()
1441
+ .withDomainName(domain.domainName)
1442
+ .withIsoCode(domain.isoCode)
1443
+ .done();
1444
+ }
1445
+ const domainData = domainDataBuilder.build();
1446
+ return await this.updateDomains(documentId, domainData);
1447
+ }
1448
+ async addTextstringValueToInvariantDocument(documentId, dataTypeName, textValue) {
1449
+ const documentData = await this.get(documentId);
1450
+ const textValueAlias = AliasHelper_1.AliasHelper.toAlias(dataTypeName);
1451
+ documentData.values.push({
1452
+ alias: textValueAlias,
1453
+ value: textValue,
1454
+ culture: null,
1455
+ segment: null,
1456
+ editorAlias: 'Umbraco.Textbox',
1457
+ entityType: 'document-property-value'
1458
+ });
1459
+ return await this.update(documentId, documentData);
1460
+ }
1418
1461
  }
1419
1462
  exports.DocumentApiHelper = DocumentApiHelper;
1420
1463
  //# sourceMappingURL=DocumentApiHelper.js.map