@shopware-ag/acceptance-test-suite 10.2.3 → 11.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/dist/index.d.mts CHANGED
@@ -373,8 +373,10 @@ declare enum RuleType {
373
373
  promotionCart = "promotionCartRule"
374
374
  }
375
375
  interface RuleAssignmentEntity {
376
- id: string;
377
- name: string;
376
+ entity: {
377
+ id: string;
378
+ name: string;
379
+ };
378
380
  ruleType: RuleType;
379
381
  }
380
382
  interface CategoryData {
@@ -467,6 +469,7 @@ declare class TestDataService {
467
469
  * @private
468
470
  */
469
471
  private createdRecords;
472
+ private restoreSystemConfig;
470
473
  /**
471
474
  * A registry of all created sales channel records.
472
475
  *
@@ -655,13 +658,11 @@ declare class TestDataService {
655
658
  */
656
659
  createCustomerGroup(overrides?: Partial<CustomerGroup>): Promise<CustomerGroup>;
657
660
  /**
658
- * Creates a system config entry
661
+ * Set system config for default sales channel
659
662
  *
660
- * @param configurationKey - Config key for shop configurations.
661
- * @param configurationValue - Config value as object for shop configurations (see {@link https://shopware.stoplight.io/docs/admin-api/9174d032146f8-create-a-new-system-config-resources|AdminApi Stoplight}).
662
- * @param salesChannelId - Unique identity of sales channel.
663
+ * @param configs - Key value pairs to set
663
664
  */
664
- createSystemConfigEntry(configurationKey: string, configurationValue?: {}, salesChannelId?: string): Promise<SystemConfig>;
665
+ setSystemConfig(configs: Record<string, unknown>): Promise<void>;
665
666
  /**
666
667
  * Creates a random sales channel analytics entity
667
668
  *
@@ -1043,12 +1044,14 @@ interface TestDataFixtureTypes {
1043
1044
  TestDataService: TestDataService;
1044
1045
  }
1045
1046
 
1047
+ type FeaturesType = Record<string, boolean>;
1046
1048
  interface HelperFixtureTypes {
1047
1049
  IdProvider: IdProvider;
1048
1050
  SaaSInstanceSetup: () => Promise<void>;
1049
1051
  InstanceMeta: {
1050
1052
  version: string;
1051
1053
  isSaaS: boolean;
1054
+ features: FeaturesType;
1052
1055
  };
1053
1056
  }
1054
1057
 
@@ -1244,6 +1247,7 @@ declare class AccountLogin implements PageObject {
1244
1247
  readonly logoutLink: Locator;
1245
1248
  readonly successAlert: Locator;
1246
1249
  readonly invalidCredentialsAlert: Locator;
1250
+ readonly passwordUpdatedAlert: Locator;
1247
1251
  readonly personalFormArea: Locator;
1248
1252
  readonly billingAddressFormArea: Locator;
1249
1253
  readonly accountTypeSelect: Locator;
@@ -1273,8 +1277,12 @@ declare class AccountRecover implements PageObject {
1273
1277
  readonly requestEmailButton: Locator;
1274
1278
  readonly backButton: Locator;
1275
1279
  readonly passwordResetEmailSentMessage: Locator;
1280
+ readonly newPasswordInput: Locator;
1281
+ readonly newPasswordConfirmInput: Locator;
1282
+ readonly changePasswordButton: Locator;
1283
+ readonly invalidLinkMessage: Locator;
1276
1284
  constructor(page: Page);
1277
- url(): string;
1285
+ url(recoverLink?: string): string;
1278
1286
  }
1279
1287
 
1280
1288
  declare class AccountProfile implements PageObject {
@@ -2225,8 +2233,6 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
2225
2233
  ExpectNotification: Task;
2226
2234
  } & {
2227
2235
  CreateLinkTypeCategory: Task;
2228
- } & {
2229
- SetSystemConfigValues: Task;
2230
2236
  } & {
2231
2237
  BulkEditProducts: Task;
2232
2238
  } & {
package/dist/index.d.ts CHANGED
@@ -373,8 +373,10 @@ declare enum RuleType {
373
373
  promotionCart = "promotionCartRule"
374
374
  }
375
375
  interface RuleAssignmentEntity {
376
- id: string;
377
- name: string;
376
+ entity: {
377
+ id: string;
378
+ name: string;
379
+ };
378
380
  ruleType: RuleType;
379
381
  }
380
382
  interface CategoryData {
@@ -467,6 +469,7 @@ declare class TestDataService {
467
469
  * @private
468
470
  */
469
471
  private createdRecords;
472
+ private restoreSystemConfig;
470
473
  /**
471
474
  * A registry of all created sales channel records.
472
475
  *
@@ -655,13 +658,11 @@ declare class TestDataService {
655
658
  */
656
659
  createCustomerGroup(overrides?: Partial<CustomerGroup>): Promise<CustomerGroup>;
657
660
  /**
658
- * Creates a system config entry
661
+ * Set system config for default sales channel
659
662
  *
660
- * @param configurationKey - Config key for shop configurations.
661
- * @param configurationValue - Config value as object for shop configurations (see {@link https://shopware.stoplight.io/docs/admin-api/9174d032146f8-create-a-new-system-config-resources|AdminApi Stoplight}).
662
- * @param salesChannelId - Unique identity of sales channel.
663
+ * @param configs - Key value pairs to set
663
664
  */
664
- createSystemConfigEntry(configurationKey: string, configurationValue?: {}, salesChannelId?: string): Promise<SystemConfig>;
665
+ setSystemConfig(configs: Record<string, unknown>): Promise<void>;
665
666
  /**
666
667
  * Creates a random sales channel analytics entity
667
668
  *
@@ -1043,12 +1044,14 @@ interface TestDataFixtureTypes {
1043
1044
  TestDataService: TestDataService;
1044
1045
  }
1045
1046
 
1047
+ type FeaturesType = Record<string, boolean>;
1046
1048
  interface HelperFixtureTypes {
1047
1049
  IdProvider: IdProvider;
1048
1050
  SaaSInstanceSetup: () => Promise<void>;
1049
1051
  InstanceMeta: {
1050
1052
  version: string;
1051
1053
  isSaaS: boolean;
1054
+ features: FeaturesType;
1052
1055
  };
1053
1056
  }
1054
1057
 
@@ -1244,6 +1247,7 @@ declare class AccountLogin implements PageObject {
1244
1247
  readonly logoutLink: Locator;
1245
1248
  readonly successAlert: Locator;
1246
1249
  readonly invalidCredentialsAlert: Locator;
1250
+ readonly passwordUpdatedAlert: Locator;
1247
1251
  readonly personalFormArea: Locator;
1248
1252
  readonly billingAddressFormArea: Locator;
1249
1253
  readonly accountTypeSelect: Locator;
@@ -1273,8 +1277,12 @@ declare class AccountRecover implements PageObject {
1273
1277
  readonly requestEmailButton: Locator;
1274
1278
  readonly backButton: Locator;
1275
1279
  readonly passwordResetEmailSentMessage: Locator;
1280
+ readonly newPasswordInput: Locator;
1281
+ readonly newPasswordConfirmInput: Locator;
1282
+ readonly changePasswordButton: Locator;
1283
+ readonly invalidLinkMessage: Locator;
1276
1284
  constructor(page: Page);
1277
- url(): string;
1285
+ url(recoverLink?: string): string;
1278
1286
  }
1279
1287
 
1280
1288
  declare class AccountProfile implements PageObject {
@@ -2225,8 +2233,6 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
2225
2233
  ExpectNotification: Task;
2226
2234
  } & {
2227
2235
  CreateLinkTypeCategory: Task;
2228
- } & {
2229
- SetSystemConfigValues: Task;
2230
2236
  } & {
2231
2237
  BulkEditProducts: Task;
2232
2238
  } & {
package/dist/index.mjs CHANGED
@@ -3,6 +3,7 @@ export * from '@playwright/test';
3
3
  import { Image } from 'image-js';
4
4
  import crypto from 'crypto';
5
5
  import { stringify } from 'uuid';
6
+ import { satisfies } from 'compare-versions';
6
7
  import fs from 'fs';
7
8
  import { AxeBuilder } from '@axe-core/playwright';
8
9
  import { createHtmlReport } from 'axe-html-reporter';
@@ -973,6 +974,7 @@ class TestDataService {
973
974
  * @private
974
975
  */
975
976
  __publicField$Q(this, "createdRecords", []);
977
+ __publicField$Q(this, "restoreSystemConfig", {});
976
978
  /**
977
979
  * A registry of all created sales channel records.
978
980
  *
@@ -1526,27 +1528,19 @@ class TestDataService {
1526
1528
  return customerGroup;
1527
1529
  }
1528
1530
  /**
1529
- * Creates a system config entry
1531
+ * Set system config for default sales channel
1530
1532
  *
1531
- * @param configurationKey - Config key for shop configurations.
1532
- * @param configurationValue - Config value as object for shop configurations (see {@link https://shopware.stoplight.io/docs/admin-api/9174d032146f8-create-a-new-system-config-resources|AdminApi Stoplight}).
1533
- * @param salesChannelId - Unique identity of sales channel.
1533
+ * @param configs - Key value pairs to set
1534
1534
  */
1535
- async createSystemConfigEntry(configurationKey, configurationValue = {}, salesChannelId = "") {
1536
- const systemConfigStruct = {
1537
- id: this.IdProvider.getIdPair().uuid,
1538
- configurationKey,
1539
- configurationValue,
1540
- salesChannelId: salesChannelId || null
1541
- };
1542
- const response = await this.AdminApiClient.post("system-config?_response=detail", {
1543
- data: systemConfigStruct
1535
+ async setSystemConfig(configs) {
1536
+ const response = await this.AdminApiClient.post(`_action/system-config?_response=detail&salesChannelId=${this.defaultSalesChannel.id}`, {
1537
+ data: configs
1544
1538
  });
1545
1539
  expect(response.ok()).toBeTruthy();
1546
- const { data: systemConfigEntry } = await response.json();
1547
- this.addCreatedRecord("system_config", systemConfigEntry.id);
1540
+ for (const key of Object.keys(configs)) {
1541
+ this.restoreSystemConfig[key] = null;
1542
+ }
1548
1543
  await this.clearCaches();
1549
- return systemConfigEntry;
1550
1544
  }
1551
1545
  /**
1552
1546
  * Creates a random sales channel analytics entity
@@ -2219,7 +2213,11 @@ class TestDataService {
2219
2213
  await this.AdminApiClient.post("_action/sync", {
2220
2214
  data: priorityDeleteOperations
2221
2215
  });
2222
- return await this.AdminApiClient.post("_action/sync", {
2216
+ await this.AdminApiClient.post(`_action/system-config?_response=detail&salesChannelId=${this.defaultSalesChannel.id}`, {
2217
+ data: this.restoreSystemConfig
2218
+ });
2219
+ await this.clearCaches();
2220
+ return this.AdminApiClient.post("_action/sync", {
2223
2221
  data: deleteOperations
2224
2222
  });
2225
2223
  }
@@ -3000,9 +2998,19 @@ const test$7 = test$e.extend({
3000
2998
  const response = await context.get("./_info/config");
3001
2999
  expect(response.ok(), "/_info/config request failed").toBeTruthy();
3002
3000
  const config = await response.json();
3001
+ const features = {};
3002
+ if (satisfies(config.version, ">=6.6.0.0")) {
3003
+ const featuresResponse = await context.get("./_action/feature-flag");
3004
+ expect(featuresResponse.ok(), "/_action/feature-flag request failed").toBeTruthy();
3005
+ const data = await featuresResponse.json();
3006
+ for (const k in data) {
3007
+ features[k] = data[k].active;
3008
+ }
3009
+ }
3003
3010
  use({
3004
3011
  version: config.version,
3005
- isSaaS: await isSaaSInstance(context)
3012
+ isSaaS: await isSaaSInstance(context),
3013
+ features
3006
3014
  });
3007
3015
  },
3008
3016
  { scope: "worker" }
@@ -3423,6 +3431,7 @@ class AccountLogin {
3423
3431
  __publicField$F(this, "logoutLink");
3424
3432
  __publicField$F(this, "successAlert");
3425
3433
  __publicField$F(this, "invalidCredentialsAlert");
3434
+ __publicField$F(this, "passwordUpdatedAlert");
3426
3435
  // Inputs for registration
3427
3436
  __publicField$F(this, "personalFormArea");
3428
3437
  __publicField$F(this, "billingAddressFormArea");
@@ -3464,6 +3473,7 @@ class AccountLogin {
3464
3473
  this.registerButton = page.getByRole("button", { name: "Continue" });
3465
3474
  this.logoutLink = page.getByRole("link", { name: "Log out" });
3466
3475
  this.successAlert = page.getByText("Successfully logged out.");
3476
+ this.passwordUpdatedAlert = page.getByText("Your password has been updated.");
3467
3477
  }
3468
3478
  url() {
3469
3479
  return "account/login";
@@ -3486,6 +3496,10 @@ class AccountRecover {
3486
3496
  __publicField$E(this, "requestEmailButton");
3487
3497
  __publicField$E(this, "backButton");
3488
3498
  __publicField$E(this, "passwordResetEmailSentMessage");
3499
+ __publicField$E(this, "newPasswordInput");
3500
+ __publicField$E(this, "newPasswordConfirmInput");
3501
+ __publicField$E(this, "changePasswordButton");
3502
+ __publicField$E(this, "invalidLinkMessage");
3489
3503
  this.passwordRecoveryForm = page.locator(".account-recover-password-form");
3490
3504
  const cardTitle = this.passwordRecoveryForm.locator(".card-title");
3491
3505
  this.title = cardTitle.getByText("Password recovery");
@@ -3494,8 +3508,15 @@ class AccountRecover {
3494
3508
  this.requestEmailButton = this.passwordRecoveryForm.getByRole("button", { name: "Request email" });
3495
3509
  this.backButton = this.passwordRecoveryForm.getByRole("link", { name: "Back" });
3496
3510
  this.passwordResetEmailSentMessage = page.getByText("If the provided email address is registered, a confirmation email including a password reset link has been sent.");
3511
+ this.newPasswordInput = page.getByLabel("New password");
3512
+ this.newPasswordConfirmInput = page.getByLabel("Password confirmation");
3513
+ this.changePasswordButton = page.getByRole("button", { name: "Change password" });
3514
+ this.invalidLinkMessage = page.getByText("The password reset link seems to be invalid.");
3497
3515
  }
3498
- url() {
3516
+ url(recoverLink) {
3517
+ if (recoverLink) {
3518
+ return recoverLink;
3519
+ }
3499
3520
  return "account/recover";
3500
3521
  }
3501
3522
  }
@@ -6119,33 +6140,6 @@ const CreateLinkTypeCategory = test$e.extend({
6119
6140
  }
6120
6141
  });
6121
6142
 
6122
- const SetSystemConfigValues = test$e.extend({
6123
- SetSystemConfigValues: async ({ AdminApiContext, DefaultSalesChannel, TestDataService }, use) => {
6124
- let defaultSettings;
6125
- const task = (newValues, defaultValues) => {
6126
- return async function LoginRegistration() {
6127
- defaultSettings = defaultValues;
6128
- const newSettings = await AdminApiContext.post("./_action/system-config/batch", {
6129
- data: {
6130
- null: newValues,
6131
- [DefaultSalesChannel.salesChannel.id]: {}
6132
- }
6133
- });
6134
- expect(newSettings.ok()).toBeTruthy();
6135
- await TestDataService.clearCaches();
6136
- };
6137
- };
6138
- await use(task);
6139
- const revertSettings = await AdminApiContext.post(`./_action/system-config/batch`, {
6140
- data: {
6141
- null: defaultSettings,
6142
- [DefaultSalesChannel.salesChannel.id]: {}
6143
- }
6144
- });
6145
- expect(revertSettings.ok()).toBeTruthy();
6146
- }
6147
- });
6148
-
6149
6143
  const BulkEditProducts = test$e.extend({
6150
6144
  BulkEditProducts: async ({ AdminProductBulkEdit, AdminProductListing }, use) => {
6151
6145
  const task = (products, changes) => {
@@ -6334,28 +6328,28 @@ const AssignEntitiesToRule = test$e.extend({
6334
6328
  await AdminRuleDetail.page.locator(".sw-data-grid__row").filter({ hasText: entityName }).getByRole("checkbox").click();
6335
6329
  await AdminRuleDetail.page.locator(".sw-button--primary").getByText("Add").click();
6336
6330
  }
6337
- for (const entity of assignableEntities) {
6338
- switch (entity.ruleType) {
6331
+ for (const assignableEntity of assignableEntities) {
6332
+ switch (assignableEntity.ruleType) {
6339
6333
  case RuleType.shippingAvailability:
6340
- await entityAssignment(entity.name, AdminRuleDetail.shippingMethodAvailabilityRulesCard);
6334
+ await entityAssignment(assignableEntity.entity.name, AdminRuleDetail.shippingMethodAvailabilityRulesCard);
6341
6335
  break;
6342
6336
  case RuleType.taxAvailability:
6343
- await entityAssignment(entity.name, AdminRuleDetail.taxProviderRulesCard);
6337
+ await entityAssignment(assignableEntity.entity.name, AdminRuleDetail.taxProviderRulesCard);
6344
6338
  break;
6345
6339
  case RuleType.paymentAvailability:
6346
- await entityAssignment(entity.name, AdminRuleDetail.paymentMethodsAvailabilityRulesCard);
6340
+ await entityAssignment(assignableEntity.entity.name, AdminRuleDetail.paymentMethodsAvailabilityRulesCard);
6347
6341
  break;
6348
6342
  case RuleType.promotionOrder:
6349
- await entityAssignment(entity.name, AdminRuleDetail.promotionOrderRulesCard);
6343
+ await entityAssignment(assignableEntity.entity.name, AdminRuleDetail.promotionOrderRulesCard);
6350
6344
  break;
6351
6345
  case RuleType.promotionCustomer:
6352
- await entityAssignment(entity.name, AdminRuleDetail.promotionCustomerRulesCard);
6346
+ await entityAssignment(assignableEntity.entity.name, AdminRuleDetail.promotionCustomerRulesCard);
6353
6347
  break;
6354
6348
  case RuleType.promotionCart:
6355
- await entityAssignment(entity.name, AdminRuleDetail.promotionCartRulesCard);
6349
+ await entityAssignment(assignableEntity.entity.name, AdminRuleDetail.promotionCartRulesCard);
6356
6350
  break;
6357
6351
  default:
6358
- throw new Error(`Unknown rule type "${entity.ruleType}". Valid rule types: "${Object.values(RuleType).join('", "')}".`);
6352
+ throw new Error(`Unknown rule type "${assignableEntity.ruleType}". Valid rule types: "${Object.values(RuleType).join('", "')}".`);
6359
6353
  }
6360
6354
  }
6361
6355
  };
@@ -6368,7 +6362,6 @@ const test$3 = mergeTests(
6368
6362
  SaveProduct,
6369
6363
  ExpectNotification,
6370
6364
  CreateLinkTypeCategory,
6371
- SetSystemConfigValues,
6372
6365
  BulkEditProducts,
6373
6366
  BulkEditCustomers,
6374
6367
  AssignEntitiesToRule
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "10.2.3",
3
+ "version": "11.1.0",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",
@@ -40,6 +40,7 @@
40
40
  "@playwright/test": "^1.49.1",
41
41
  "@shopware/api-client": "0.5.0",
42
42
  "axe-html-reporter": "2.2.3",
43
+ "compare-versions": "^6.1.1",
43
44
  "image-js": "0.35.5",
44
45
  "uuid": "9.0.1"
45
46
  },