@shopware-ag/acceptance-test-suite 5.0.1 → 5.1.0

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/README.md CHANGED
@@ -14,6 +14,7 @@ This test suite is an extension to [Playwright](https://playwright.dev/) to easi
14
14
  * [Page Objects](#page-objects)
15
15
  * [Actor Pattern](#actor-pattern)
16
16
  * [Data Fixtures](#data-fixtures)
17
+ * [Test Data Service](#test-data-service)
17
18
  * [Code Contribution](#code-contribution)
18
19
  * [Best practices](#best-practices)
19
20
 
@@ -321,6 +322,12 @@ test('Customer login test scenario', async ({ ShopCustomer, Login }) => {
321
322
  You can create your own tasks in the same way to make them available for the actor pattern. Every task is just a simple Playwright fixture containing a function call with the corresponding test logic. Make sure to merge your task fixtures with other fixtures you created in your base test file. You can use the `mergeTests` method of Playwright to combine several fixtures into one test extension.
322
323
 
323
324
  ## Data Fixtures
325
+
326
+ ---
327
+ **Deprecated:** Use the [Test Data Service](#test-data-service) instead.
328
+
329
+ ---
330
+
324
331
  We already covered a lot of interesting fixtures you can use to create your test scenario. One topic which is missing is test data. Most test scenarios will need some predefined state within the system under test to validate a certain behaviour. Within this test suite we use Playwright fixtures also to create necessary test data via API. The goal is to have no direct system dependencies like a database connection to the system under test.
325
332
 
326
333
  **Example**
@@ -374,6 +381,58 @@ test('Property group test scenario', async ({ PropertiesData }) => {
374
381
 
375
382
  If you create your own data fixtures make sure to import and merge them in your base test file with other fixtures you created.
376
383
 
384
+ ## Test Data Service
385
+ This service is a simple way to create test data within your tests. It simplifies the usage of the Shopware API and provides sample structs for various entities, which you also can adjust to your needs. For detailed documentation of the methods you can have a look at the service class or simply use the auto-completion of your IDE. Here is a list of available methods:
386
+
387
+ ### Creating Data
388
+ * `createBasicProduct()`
389
+ * `createProductWithImage()`
390
+ * `createDigitalProduct()`
391
+ * `createProductWithPriceRange()`
392
+ * `createBasicManufacturer()`
393
+ * `createManufacturerWithImage()`
394
+ * `createCategory()`
395
+ * `createMediaPNG()`
396
+ * `createMediaTXT()`
397
+ * `createColorPropertyGroup()`
398
+ * `createTextPropertyGroup()`
399
+ * `createTag()`
400
+ * `createCustomer()`
401
+ * `createOrder()`
402
+ * `createPromotionWithCode()`
403
+ * `createBasicPaymentMethod()`
404
+ * `createPaymentMethodWithImage()`
405
+ * `createBasicShippingMethod()`
406
+ * `createShippingMethodWithImage()`
407
+ * `createBasicRule()`
408
+ * `createBasicPageLayout()`
409
+
410
+ ### Relations
411
+ * `assignProductDownload()`
412
+ * `assignProductMedia()`
413
+ * `assignProductManufacturer()`
414
+ * `assignProductCategory()`
415
+ * `assignProductTag()`
416
+ * `assignManufacturerMedia()`
417
+ * `assignPaymentMethodMedia()`
418
+ * `assignShippingMethodMedia()`
419
+
420
+ ### Retrieving Basic Data
421
+ * `getCurrency()`
422
+ * `getRule()`
423
+ * `getShippingMethod()`
424
+ * `getPaymentMethod()`
425
+ * `getAllDeliveryTimeResources()`
426
+ * `getCustomerAddress()`
427
+ * `getSalutation()`
428
+ * `getOrderStateMachine()`
429
+ * `getDeliveryStateMachine()`
430
+ * `getTransactionStateMachine()`
431
+ * `getTransactionStateMachine()`
432
+ * `getStateMachine()`
433
+ * `getStateMachineState()`
434
+ * `getPropertyGroupOptions()`
435
+
377
436
  ## Code Contribution
378
437
  You can contribute to this project via its [official repository](https://github.com/shopware/acceptance-test-suite/) on GitHub.
379
438
 
@@ -406,3 +465,22 @@ The most important part is [test isolation](https://playwright.dev/docs/best-pra
406
465
  - do not expect the shop to have the defaults en_GB and EUR
407
466
  - do not change global settings (sales channel is ok, because it's created by us)
408
467
  - basically everything in Settings that is not specific to a sales channel (tax, search, etc.)
468
+
469
+ ## Running Tests in the Test Suite
470
+ If you want to work on the test suite and try to execute tests from within this repository, you have to run a corresponding docker image for a specific Shopware version.
471
+
472
+ Shopware 6.6
473
+ ```
474
+ docker compose up -d shopware
475
+ ```
476
+
477
+ Shopware 6.5
478
+ ```
479
+ docker compose up -d shopware-65
480
+ ```
481
+
482
+ When the docker container is running you can execute the normal playwright commands.
483
+
484
+ ```
485
+ npx playwright test
486
+ ```
package/dist/index.d.mts CHANGED
@@ -398,6 +398,14 @@ declare class TestDataService {
398
398
  * @param currencyId - The uuid of the currency to use for the product pricing.
399
399
  */
400
400
  createProductWithPriceRange(overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
401
+ /**
402
+ * Creates basic variant products based on property group.
403
+ *
404
+ * @param parentProduct Parent product of the variants
405
+ * @param propertyGroups Property group collection which contain options
406
+ * @param overrides - Specific data overrides that will be applied to the variant data struct.
407
+ */
408
+ createVariantProducts(parentProduct: Product, propertyGroups: PropertyGroup[], overrides?: Partial<Product>): Promise<Product[]>;
401
409
  /**
402
410
  * Creates a basic manufacturer without images or other special configuration.
403
411
  *
@@ -483,19 +491,6 @@ declare class TestDataService {
483
491
  * @param overrides - Specific data overrides that will be applied to the payment method data struct.
484
492
  */
485
493
  createBasicPaymentMethod(overrides?: Partial<PaymentMethod>): Promise<PaymentMethod>;
486
- /**
487
- * Creates a new basic rule with the condition cart amount >= 1.
488
- *
489
- * @param overrides - Specific data overrides that will be applied to the payment method data struct.
490
- */
491
- createBasicRule(overrides?: Partial<Rule>, conditionType?: string, operator?: string, amount?: number): Promise<Rule>;
492
- /**
493
- * Creates a new basic page layout.
494
- *
495
- * @param cmsPageType - The type of the cms page layout (page/landingpage/product_detail/product_list).
496
- * @param overrides - Specific data overrides that will be applied to the cms page layout data struct.
497
- */
498
- createBasicPageLayout(cmsPageType: string, overrides?: Partial<CmsPage>): Promise<CmsPage>;
499
494
  /**
500
495
  * Creates a payment method with one randomly generated image.
501
496
  *
@@ -503,13 +498,11 @@ declare class TestDataService {
503
498
  */
504
499
  createPaymentMethodWithImage(overrides?: Partial<PaymentMethod>): Promise<PaymentMethod>;
505
500
  /**
506
- * Creates basic variant products based on property group.
501
+ * Creates a new basic shipping method with random delivery time.
507
502
  *
508
- * @param parentProduct Parent product of the variants
509
- * @param propertyGroups Property group collection which contain options
510
- * @param overrides - Specific data overrides that will be applied to the variant data struct.
503
+ * @param overrides - Specific data overrides that will be applied to the shipping method data struct.
511
504
  */
512
- createVariantProducts(parentProduct: Product, propertyGroups: PropertyGroup[], overrides?: Partial<Product>): Promise<Product[]>;
505
+ createBasicShippingMethod(overrides?: Partial<ShippingMethod>): Promise<ShippingMethod>;
513
506
  /**
514
507
  * Creates a shipping method with one randomly generated image.
515
508
  *
@@ -517,24 +510,18 @@ declare class TestDataService {
517
510
  */
518
511
  createShippingMethodWithImage(overrides?: Partial<ShippingMethod>): Promise<ShippingMethod>;
519
512
  /**
520
- * Creates a new basic shipping method with random delivery time.
513
+ * Creates a new basic rule with the condition cart amount >= 1.
521
514
  *
522
- * @param overrides - Specific data overrides that will be applied to the shipping method data struct.
523
- */
524
- createBasicShippingMethod(overrides?: Partial<ShippingMethod>): Promise<ShippingMethod>;
525
- /**
526
- * Function that generates combinations from n number of arrays
527
- * with m number of elements in them.
528
- * @param array
515
+ * @param overrides - Specific data overrides that will be applied to the payment method data struct.
529
516
  */
530
- combineAll: (array: Record<string, string>[][]) => Record<string, string>[][];
517
+ createBasicRule(overrides?: Partial<Rule>, conditionType?: string, operator?: string, amount?: number): Promise<Rule>;
531
518
  /**
532
- * Assigns a media resource to a payment method as a logo.
519
+ * Creates a new basic page layout.
533
520
  *
534
- * @param paymentMethodId - The uuid of the payment method.
535
- * @param mediaId - The uuid of the media resource.
521
+ * @param cmsPageType - The type of the cms page layout (page/landingpage/product_detail/product_list).
522
+ * @param overrides - Specific data overrides that will be applied to the cms page layout data struct.
536
523
  */
537
- assignPaymentMethodMedia(paymentMethodId: string, mediaId: string): Promise<any>;
524
+ createBasicPageLayout(cmsPageType: string, overrides?: Partial<CmsPage>): Promise<CmsPage>;
538
525
  /**
539
526
  * Assigns a media resource as the download of a digital product.
540
527
  *
@@ -549,6 +536,27 @@ declare class TestDataService {
549
536
  * @param mediaId - The uuid of the media resource.
550
537
  */
551
538
  assignProductMedia(productId: string, mediaId: string): Promise<any>;
539
+ /**
540
+ * Assigns a manufacturer to a product.
541
+ *
542
+ * @param productId - The uuid of the product.
543
+ * @param manufacturerId - The uuid of the manufacturer.
544
+ */
545
+ assignProductManufacturer(productId: string, manufacturerId: string): Promise<void>;
546
+ /**
547
+ * Assigns a product to a category.
548
+ *
549
+ * @param productId - The uuid of the product.
550
+ * @param categoryId - The uuid of the category.
551
+ */
552
+ assignProductCategory(productId: string, categoryId: string): Promise<playwright_core.APIResponse>;
553
+ /**
554
+ * Assigns a tag to a product.
555
+ *
556
+ * @param productId - The uuid of the product.
557
+ * @param tagId - The uuid of the tag.
558
+ */
559
+ assignProductTag(productId: string, tagId: string): Promise<playwright_core.APIResponse>;
552
560
  /**
553
561
  * Assigns a media resource to a manufacturer as a logo.
554
562
  *
@@ -559,24 +567,26 @@ declare class TestDataService {
559
567
  /**
560
568
  * Assigns a manufacturer to a product.
561
569
  *
570
+ * @deprecated - Use `assignProductManufacturer` instead.
571
+ *
562
572
  * @param manufacturerId - The uuid of the manufacturer.
563
573
  * @param productId - The uuid of the product.
564
574
  */
565
575
  assignManufacturerProduct(manufacturerId: string, productId: string): Promise<void>;
566
576
  /**
567
- * Assigns a product to a category.
577
+ * Assigns a media resource to a payment method as a logo.
568
578
  *
569
- * @param productId - The uuid of the product.
570
- * @param categoryId - The uuid of the category.
579
+ * @param paymentMethodId - The uuid of the payment method.
580
+ * @param mediaId - The uuid of the media resource.
571
581
  */
572
- assignProductCategory(productId: string, categoryId: string): Promise<playwright_core.APIResponse>;
582
+ assignPaymentMethodMedia(paymentMethodId: string, mediaId: string): Promise<any>;
573
583
  /**
574
- * Assigns a tag to a product.
584
+ * Assigns a media resource to a shipping method as a logo.
575
585
  *
576
- * @param productId - The uuid of the product.
577
- * @param tagId - The uuid of the tag.
586
+ * @param shippingMethodId - The uuid of the shipping method.
587
+ * @param mediaId - The uuid of the media resource.
578
588
  */
579
- assignProductTag(productId: string, tagId: string): Promise<playwright_core.APIResponse>;
589
+ assignShippingMethodMedia(shippingMethodId: string, mediaId: string): Promise<any>;
580
590
  /**
581
591
  * Retrieves a currency based on its ISO code.
582
592
  *
@@ -595,13 +605,6 @@ declare class TestDataService {
595
605
  * @param name - The name of the shipping method. Default is "Standard".
596
606
  */
597
607
  getShippingMethod(name?: string): Promise<ShippingMethod>;
598
- /**
599
- * Assigns a media resource to a shipping method as a logo.
600
- *
601
- * @param shippingMethodId - The uuid of the shipping method.
602
- * @param mediaId - The uuid of the media resource.
603
- */
604
- assignShippingMethodMedia(shippingMethodId: string, mediaId: string): Promise<any>;
605
608
  /**
606
609
  * Retrieves all delivery time resources.
607
610
  */
@@ -674,12 +677,20 @@ declare class TestDataService {
674
677
  * Will delete all entities created by the data service via sync API.
675
678
  */
676
679
  cleanUp(): Promise<playwright_core.APIResponse | null>;
680
+ isProduct(item: Product | Promotion): item is Product;
681
+ isPromotion(item: Product | Promotion): item is Promotion;
677
682
  /**
678
683
  * Convert a JS date object into a date-time compatible string.
679
684
  *
680
685
  * @param date - The JS date object from which the date-time should be retrieved.
681
686
  */
682
687
  convertDateTime(date: Date): string;
688
+ /**
689
+ * Function that generates combinations from n number of arrays
690
+ * with m number of elements in them.
691
+ * @param array
692
+ */
693
+ combineAll: (array: Record<string, string>[][]) => Record<string, string>[][];
683
694
  getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
684
695
  getBasicRuleStruct(overrides: Partial<Rule> | undefined, conditionType: string, operator: string, amount: number): Partial<Rule>;
685
696
  getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
@@ -709,8 +720,6 @@ declare class TestDataService {
709
720
  deliveryTimeId: string;
710
721
  active: boolean;
711
722
  } & Partial<ShippingMethod>;
712
- isProduct(item: Product | Promotion): item is Product;
713
- isPromotion(item: Product | Promotion): item is Promotion;
714
723
  getBasicOrderStruct(lineItems: SimpleLineItem[], languageId: string, currency: Currency$1, paymentMethod: PaymentMethod, shippingMethod: ShippingMethod, orderState: StateMachineState, deliveryState: StateMachineState, transactionState: StateMachineState, customer: Customer, customerAddress: CustomerAddress, salesChannelId?: string, overrides?: Partial<Order>): Partial<Order>;
715
724
  getBasicProductLineItemStruct(lineItem: SimpleLineItem): {
716
725
  productId: string;
@@ -1102,6 +1111,7 @@ declare class ProductDetail implements PageObject {
1102
1111
  * Tabs
1103
1112
  */
1104
1113
  readonly variantsTabLink: Locator;
1114
+ readonly specificationsTabLink: Locator;
1105
1115
  /**
1106
1116
  * Variants Generation
1107
1117
  */
@@ -1122,7 +1132,12 @@ declare class ProductDetail implements PageObject {
1122
1132
  readonly propertyOptionSizeSmall: Locator;
1123
1133
  readonly propertyOptionSizeMedium: Locator;
1124
1134
  readonly propertyOptionSizeLarge: Locator;
1135
+ /**
1136
+ * Cards
1137
+ */
1138
+ readonly customFieldCard: Locator;
1125
1139
  constructor(page: Page);
1140
+ getCustomFieldSetCardContentByName(customFieldSetName: string): Promise<Record<string, Locator>>;
1126
1141
  url(productId: string): string;
1127
1142
  }
1128
1143
 
@@ -1140,7 +1155,11 @@ declare class CustomerDetail implements PageObject {
1140
1155
  readonly editButton: Locator;
1141
1156
  readonly generalTab: Locator;
1142
1157
  readonly accountCard: Locator;
1158
+ readonly customFieldCard: Locator;
1159
+ readonly customFieldSetTabs: Locator;
1160
+ readonly customFieldSetTabCustomContent: Locator;
1143
1161
  constructor(page: Page);
1162
+ getCustomFieldSetCardContentByName(customFieldSetName: string): Promise<Record<string, Locator>>;
1144
1163
  url(customerId: string): string;
1145
1164
  }
1146
1165
 
@@ -1357,6 +1376,7 @@ declare class Categories implements PageObject {
1357
1376
  readonly filterResultPopoverTreeCheckboxItemList: Locator;
1358
1377
  readonly openInNewTabCheckbox: Locator;
1359
1378
  constructor(page: Page);
1379
+ getLandingPageByName(landingPageName: string): Promise<Locator>;
1360
1380
  url(): string;
1361
1381
  }
1362
1382
 
@@ -1364,10 +1384,84 @@ declare class RuleDetail implements PageObject {
1364
1384
  readonly page: Page;
1365
1385
  readonly nameInput: Locator;
1366
1386
  readonly priorityInput: Locator;
1387
+ readonly conditionTypeSelectionInput: Locator;
1388
+ readonly conditionValueSelectionInput: Locator;
1389
+ readonly filtersResultPopoverSelectionList: Locator;
1367
1390
  constructor(page: Page);
1368
1391
  url(ruleId: string, tabName?: string): string;
1369
1392
  }
1370
1393
 
1394
+ declare class CustomFieldListing implements PageObject {
1395
+ readonly page: Page;
1396
+ readonly addNewSetButton: Locator;
1397
+ readonly customFieldRows: Locator;
1398
+ constructor(page: Page);
1399
+ getLineItemByCustomFieldSetName(customFieldSetName: string): Promise<Record<string, Locator>>;
1400
+ url(): string;
1401
+ }
1402
+
1403
+ declare class CustomFieldCreate implements PageObject {
1404
+ readonly page: Page;
1405
+ readonly saveButton: Locator;
1406
+ readonly cancelButton: Locator;
1407
+ readonly technicalNameInput: Locator;
1408
+ readonly positionInput: Locator;
1409
+ readonly labelEnglishGBInput: Locator;
1410
+ readonly assignToSelectionList: Locator;
1411
+ readonly resultAssignToPopoverItemList: Locator;
1412
+ constructor(page: Page);
1413
+ url(): string;
1414
+ }
1415
+
1416
+ declare class CustomFieldDetail extends CustomFieldCreate {
1417
+ readonly page: Page;
1418
+ readonly newCustomFieldButton: Locator;
1419
+ readonly customFieldEditDialog: Locator;
1420
+ readonly newCustomFieldDialog: Locator;
1421
+ readonly customFieldTechnicalNameInput: Locator;
1422
+ readonly customFieldPositionInput: Locator;
1423
+ readonly customFieldTypeSelectionList: Locator;
1424
+ readonly customFieldModifyByStoreApiCheckbox: Locator;
1425
+ readonly customFieldCancelButton: Locator;
1426
+ readonly customFieldAddButton: Locator;
1427
+ readonly customFieldEditApplyButton: Locator;
1428
+ readonly customFieldLabelEnglishGBInput: Locator;
1429
+ readonly customFieldPlaceholderEnglishGBInput: Locator;
1430
+ readonly customFieldHelpTextEnglishGBInput: Locator;
1431
+ readonly customFieldDeleteListButton: Locator;
1432
+ readonly customFieldDeleteDialog: Locator;
1433
+ readonly customFieldDeleteCancelButton: Locator;
1434
+ readonly customFieldDeleteButton: Locator;
1435
+ constructor(page: Page);
1436
+ getLineItemByCustomFieldName(customFieldName: string): Promise<Record<string, Locator>>;
1437
+ url(customFieldUuid?: string): string;
1438
+ }
1439
+
1440
+ declare class CategoryDetail implements PageObject {
1441
+ readonly page: Page;
1442
+ readonly saveButton: Locator;
1443
+ readonly cancelButton: Locator;
1444
+ readonly customFieldCard: Locator;
1445
+ readonly customFieldSetTabs: Locator;
1446
+ readonly customFieldSetTabCustomContent: Locator;
1447
+ constructor(page: Page);
1448
+ getCustomFieldSetCardContentByName(customFieldSetName: string): Promise<Record<string, Locator>>;
1449
+ url(categoryUuid: string): string;
1450
+ }
1451
+
1452
+ declare class RuleCreate implements PageObject {
1453
+ readonly page: Page;
1454
+ readonly nameInput: Locator;
1455
+ readonly priorityInput: Locator;
1456
+ readonly conditionTypeSelectionInput: Locator;
1457
+ readonly conditionValueSelectionInput: Locator;
1458
+ readonly filtersResultPopoverSelectionList: Locator;
1459
+ readonly saveButton: Locator;
1460
+ readonly cancelButton: Locator;
1461
+ constructor(page: Page);
1462
+ url(): string;
1463
+ }
1464
+
1371
1465
  interface AdministrationPageTypes {
1372
1466
  AdminProductDetail: ProductDetail;
1373
1467
  AdminOrderDetail: OrderDetail;
@@ -1380,9 +1474,14 @@ interface AdministrationPageTypes {
1380
1474
  AdminDashboard: Dashboard;
1381
1475
  AdminShippingListing: ShippingListing;
1382
1476
  AdminCategories: Categories;
1477
+ AdminCategoryDetail: CategoryDetail;
1383
1478
  AdminLandingPageCreate: LandingPageCreate;
1384
1479
  AdminLandingPageDetail: LandingPageDetail;
1385
1480
  AdminRuleDetail: RuleDetail;
1481
+ AdminRuleCreate: RuleCreate;
1482
+ AdminCustomFieldListing: CustomFieldListing;
1483
+ AdminCustomFieldCreate: CustomFieldCreate;
1484
+ AdminCustomFieldDetail: CustomFieldDetail;
1386
1485
  }
1387
1486
  declare const AdminPageObjects: {
1388
1487
  ProductDetail: typeof ProductDetail;
@@ -1396,9 +1495,14 @@ declare const AdminPageObjects: {
1396
1495
  DataSharing: typeof DataSharing;
1397
1496
  ShippingListing: typeof ShippingListing;
1398
1497
  Categories: typeof Categories;
1498
+ CategoryDetail: typeof CategoryDetail;
1399
1499
  LandingPageCreate: typeof LandingPageCreate;
1400
1500
  LandingPageDetail: typeof LandingPageDetail;
1401
1501
  RuleDetail: typeof RuleDetail;
1502
+ RuleCreate: typeof RuleCreate;
1503
+ CustomFieldListing: typeof CustomFieldListing;
1504
+ CustomFieldCreate: typeof CustomFieldCreate;
1505
+ CustomFieldDetail: typeof CustomFieldDetail;
1402
1506
  };
1403
1507
 
1404
1508
  interface DataFixtureTypes {