@shopware-ag/acceptance-test-suite 12.14.1 → 12.15.1

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.mjs CHANGED
@@ -3893,11 +3893,28 @@ async function createNewAdminPageContext(browser, SalesChannelBaseConfig) {
3893
3893
  baseURL: SalesChannelBaseConfig.adminUrl,
3894
3894
  serviceWorkers: "block"
3895
3895
  });
3896
+ await mockApiCalls(context);
3896
3897
  const adminPage = await context.newPage();
3897
3898
  await adminPage.goto("#/login");
3898
- await mockApiCalls(adminPage);
3899
3899
  return adminPage;
3900
3900
  }
3901
+ function hideSymfonyToolbarOnReload(page) {
3902
+ const originalReload = page.reload.bind(page);
3903
+ page.reload = async () => {
3904
+ const res = await originalReload();
3905
+ await page.addStyleTag({
3906
+ content: `
3907
+ .sf-toolbar {
3908
+ width: 0 !important;
3909
+ height: 0 !important;
3910
+ display: none !important;
3911
+ pointer-events: none !important;
3912
+ }
3913
+ `.trim()
3914
+ });
3915
+ return res;
3916
+ };
3917
+ }
3901
3918
  async function loginToAdministration(adminLoginPage, merchant, AdminApiContext) {
3902
3919
  const usernamePattern = new RegExp(`${translate("administration:login:username")}|${translate("administration:login:emailAddress")}`);
3903
3920
  const passwordLabel = translate("administration:login:password");
@@ -3914,21 +3931,7 @@ async function loginToAdministration(adminLoginPage, merchant, AdminApiContext)
3914
3931
  const loginButtonLabel = translate("administration:login:loginButton");
3915
3932
  await adminLoginPage.getByRole("button", { name: loginButtonLabel, exact: true }).click();
3916
3933
  await Promise.all(jsLoadingPromises);
3917
- const originalReload = adminLoginPage.reload.bind(adminLoginPage);
3918
- adminLoginPage.reload = async () => {
3919
- const res = await originalReload();
3920
- await adminLoginPage.addStyleTag({
3921
- content: `
3922
- .sf-toolbar {
3923
- width: 0 !important;
3924
- height: 0 !important;
3925
- display: none !important;
3926
- pointer-events: none !important;
3927
- }
3928
- `.trim()
3929
- });
3930
- return res;
3931
- };
3934
+ hideSymfonyToolbarOnReload(adminLoginPage);
3932
3935
  await clearDelayedCache(AdminApiContext);
3933
3936
  await expect(adminLoginPage.locator(".sw-skeleton")).toHaveCount(0);
3934
3937
  await adminLoginPage.waitForURL((url) => {
@@ -3939,32 +3942,47 @@ async function loginToAdministration(adminLoginPage, merchant, AdminApiContext)
3939
3942
  }
3940
3943
 
3941
3944
  const test$b = test$e.extend({
3942
- AdminPage: async ({ IdProvider, AdminApiContext, SalesChannelBaseConfig, browser, CustomTranslationResources }, use) => {
3945
+ AdminSession: [
3946
+ async ({ IdProvider, AdminApiContext, SalesChannelBaseConfig, browser }, use) => {
3947
+ const { id, uuid } = IdProvider.getIdPair();
3948
+ const adminUser = {
3949
+ id: uuid,
3950
+ username: `admin_${id}`,
3951
+ firstName: `${id} admin`,
3952
+ lastName: `${id} admin`,
3953
+ localeId: SalesChannelBaseConfig.currentLocaleId,
3954
+ email: `admin_${id}@example.com`,
3955
+ timeZone: "Europe/Berlin",
3956
+ password: "shopware",
3957
+ admin: true
3958
+ };
3959
+ const response = await AdminApiContext.post("user", {
3960
+ data: adminUser
3961
+ });
3962
+ expect(response.ok()).toBeTruthy();
3963
+ const loginPage = await loginToAdministration(await createNewAdminPageContext(browser, SalesChannelBaseConfig), adminUser, AdminApiContext);
3964
+ const context = loginPage.context();
3965
+ await loginPage.close();
3966
+ await use({ context, user: adminUser });
3967
+ await context.close();
3968
+ await AdminApiContext.delete(`user/${uuid}`);
3969
+ },
3970
+ { scope: "worker" }
3971
+ ],
3972
+ AdminPage: async ({ AdminSession, CustomTranslationResources }, use) => {
3943
3973
  const locale = getLocale();
3944
3974
  const languageHelper = await LanguageHelper.createInstance(locale, CustomTranslationResources);
3945
- const { id, uuid } = IdProvider.getIdPair();
3946
- const adminUser = {
3947
- id: uuid,
3948
- username: `admin_${id}`,
3949
- firstName: `${id} admin`,
3950
- lastName: `${id} admin`,
3951
- localeId: SalesChannelBaseConfig.currentLocaleId,
3952
- email: `admin_${id}@example.com`,
3953
- timezone: "Europe/Berlin",
3954
- password: "shopware",
3955
- admin: true
3956
- };
3957
- const response = await AdminApiContext.post("user", {
3958
- data: adminUser
3959
- });
3960
- expect(response.ok()).toBeTruthy();
3961
- const page = await loginToAdministration(await createNewAdminPageContext(browser, SalesChannelBaseConfig), adminUser, AdminApiContext);
3975
+ const page = await AdminSession.context.newPage();
3976
+ hideSymfonyToolbarOnReload(page);
3977
+ await page.goto("./");
3978
+ await page.waitForURL((url) => url.hash.startsWith("#/") && !url.hash.startsWith("#/login"));
3979
+ await expect(page.getByText(AdminSession.user.firstName + " " + AdminSession.user.lastName).first()).toBeVisible({ timeout: 6e4 });
3980
+ await expect(page.locator(".sw-skeleton")).toHaveCount(0);
3962
3981
  LanguageHelper.setForContext(page.context(), languageHelper);
3963
3982
  setCurrentContext(page.context());
3964
3983
  await use(page);
3965
3984
  await page.close();
3966
3985
  setCurrentContext(null);
3967
- await AdminApiContext.delete(`user/${uuid}`);
3968
3986
  },
3969
3987
  StorefrontPage: async ({ DefaultSalesChannel, SalesChannelBaseConfig, browser, AdminApiContext, StoreApiContext, InstanceMeta, CustomTranslationResources }, use) => {
3970
3988
  const { url, salesChannel } = DefaultSalesChannel;
@@ -4306,7 +4324,7 @@ class TestDataService {
4306
4324
  const product = await this.createBasicProduct({ type: "digital", maxPurchase: 1, ...overrides }, taxId, currencyId);
4307
4325
  const media = await this.createMediaTXT(content);
4308
4326
  await this.assignProductDownload(product.id, media.id);
4309
- return product;
4327
+ return { ...product, states: [...product.states ?? [], "is-download"] };
4310
4328
  }
4311
4329
  /**
4312
4330
  * Creates a basic product with a price range matrix.
@@ -6687,7 +6705,10 @@ class IdProvider {
6687
6705
  bytes[6] = 1 << 5;
6688
6706
  bytes[8] = 128;
6689
6707
  return {
6690
- id: `${this.workerIndex}`,
6708
+ // Derived from the hash like the uuid, so ids (and names/emails built from
6709
+ // them, e.g. the worker customer email) stay distinct between runs with
6710
+ // different seeds. A plain worker index collides across concurrent suites.
6711
+ id: `${buffer.readUIntBE(16, 6)}`,
6691
6712
  uuid: stringify(bytes).replaceAll("-", "")
6692
6713
  };
6693
6714
  }
@@ -6696,7 +6717,8 @@ class IdProvider {
6696
6717
  const test$8 = test$e.extend({
6697
6718
  IdProvider: [
6698
6719
  async ({}, use, workerInfo) => {
6699
- const seed = process.env.SHOPWARE_ACCESS_KEY_ID || process.env.SHOPWARE_ADMIN_PASSWORD || "test-suite";
6720
+ const baseSeed = process.env.SHOPWARE_ACCESS_KEY_ID || process.env.SHOPWARE_ADMIN_PASSWORD || "test-suite";
6721
+ const seed = process.env.ATS_ID_SEED ? `${process.env.ATS_ID_SEED}:${baseSeed}` : baseSeed;
6700
6722
  const idProvider = new IdProvider(workerInfo.parallelIndex, seed);
6701
6723
  await use(idProvider);
6702
6724
  },
@@ -10828,7 +10850,7 @@ class ListingPageLayoutDetail {
10828
10850
  navigatorButton;
10829
10851
  layoutAssignmentButton;
10830
10852
  page;
10831
- constructor(page) {
10853
+ constructor(page, instanceMeta) {
10832
10854
  this.page = page;
10833
10855
  this.addSectionButton = page.locator(".sw-cms-stage-add-section__button");
10834
10856
  this.sectionSelectionField = page.locator(".sw-cms-stage-section-selection");
@@ -10840,10 +10862,19 @@ class ListingPageLayoutDetail {
10840
10862
  this.loaderButton = page.locator(".mt-button__loader");
10841
10863
  this.productListingBlock = page.locator(".sw-cms-block-product-listing");
10842
10864
  this.sidebarTitle = page.locator(".sw-sidebar-item__title");
10843
- this.settingsButton = page.locator(`button[title="${translate("administration:layout:detail.settings")}"]`);
10844
- this.blocksButton = page.locator(`button[title="${translate("administration:layout:detail.blocks")}"]`);
10845
- this.navigatorButton = page.locator(`button[title="${translate("administration:layout:detail.navigator")}"]`);
10846
- this.layoutAssignmentButton = page.locator(`button[title="${translate("administration:layout:detail.layoutAssignment")}"]`);
10865
+ if (satisfies(instanceMeta.version, "<6.7.13.0")) {
10866
+ this.settingsButton = page.locator(`button[title="${translate("administration:layout:detail.settings")}"]`);
10867
+ this.blocksButton = page.locator(`button[title="${translate("administration:layout:detail.blocks")}"]`);
10868
+ this.navigatorButton = page.locator(`button[title="${translate("administration:layout:detail.navigator")}"]`);
10869
+ this.layoutAssignmentButton = page.locator(`button[title="${translate("administration:layout:detail.layoutAssignment")}"]`);
10870
+ } else {
10871
+ this.settingsButton = page.getByLabel(translate("administration:layout:detail.settings"), { exact: true });
10872
+ this.blocksButton = page.getByLabel(translate("administration:layout:detail.blocks"), { exact: true });
10873
+ this.navigatorButton = page.getByLabel(translate("administration:layout:detail.navigator"), { exact: true });
10874
+ this.layoutAssignmentButton = page.getByLabel(translate("administration:layout:detail.layoutAssignment"), {
10875
+ exact: true
10876
+ });
10877
+ }
10847
10878
  }
10848
10879
  url(layoutId) {
10849
10880
  return `#/sw/cms/detail/${layoutId}`;
@@ -11185,8 +11216,8 @@ const test$6 = test$e.extend({
11185
11216
  AdminLayoutListing: async ({ AdminPage }, use) => {
11186
11217
  await use(new LayoutListing(AdminPage));
11187
11218
  },
11188
- AdminListingPageLayoutDetail: async ({ AdminPage }, use) => {
11189
- await use(new ListingPageLayoutDetail(AdminPage));
11219
+ AdminListingPageLayoutDetail: async ({ AdminPage, InstanceMeta }, use) => {
11220
+ await use(new ListingPageLayoutDetail(AdminPage, InstanceMeta));
11190
11221
  },
11191
11222
  AdminLayoutCreate: async ({ AdminPage }, use) => {
11192
11223
  await use(new LayoutCreate(AdminPage));
@@ -12652,12 +12683,12 @@ const AddProductToCartFromWishlist = test$e.extend({
12652
12683
  const task = (ProductData) => {
12653
12684
  return async function AddProductToCartFromWishlist2() {
12654
12685
  const listedItem = await StorefrontWishlist.getListingItemByProductName(ProductData.name);
12686
+ const expectedPrice = await listedItem.productPrice.innerText();
12655
12687
  await ShopCustomer.presses(listedItem.productAddToShoppingCart);
12656
12688
  await StorefrontWishlist.page.waitForResponse((response) => response.url().includes(`checkout/offcanvas`) && response.ok());
12657
12689
  await ShopCustomer.expects(StorefrontOffCanvasCart.itemCount).toBeVisible();
12658
12690
  const offcanvasItem = await StorefrontOffCanvasCart.getLineItemByProductNumber(ProductData.productNumber);
12659
12691
  const itemsPrice = await offcanvasItem.productTotalPriceValue.innerText();
12660
- const expectedPrice = await listedItem.productPrice.innerText();
12661
12692
  ShopCustomer.expects(itemsPrice).toBe(expectedPrice);
12662
12693
  };
12663
12694
  };
@@ -13215,4 +13246,4 @@ const test = mergeTests(
13215
13246
  test$3
13216
13247
  );
13217
13248
 
13218
- export { Actor, AdminPageObjects, BUNDLED_RESOURCES, COUNTRY_ADDRESS_DATA, FeatureService, IdProvider, LanguageHelper, RuleType, StorefrontPageObjects, TestDataService, assertScreenshot, baseNamespaces, clearDelayedCache, compareFlowTemplateWithFlow, createNewAdminPageContext, createRandomImage, createSolidColorImage, encodeImage, extractIdFromUrl, formatPrice, getCountryAddressData, getCountryCodeFromLocale, getCountryId, getCurrency, getCurrencyCodeFromLocale, getCurrencySymbolFromLocale, getCurrentContext, getDefaultShippingMethodId, getFlow, getFlowId, getFlowTemplate, getLanguageCode, getLanguageData, getLocale, getMediaId, getOrderTransactionId, getPaymentMethodId, getPromotionWithDiscount, getSalutationId, getShippingMethodId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, hideElements, isPaaSInstance, isSaaSInstance, isThemeCompiled, loginToAdministration, mockApiCalls, replaceElements, replaceElementsIndividually, setCurrentContext, setOrderStatus, setViewport, test, translate, updateAdminUser, uploadRandomPngMedia };
13249
+ export { Actor, AdminPageObjects, BUNDLED_RESOURCES, COUNTRY_ADDRESS_DATA, FeatureService, IdProvider, LanguageHelper, RuleType, StorefrontPageObjects, TestDataService, assertScreenshot, baseNamespaces, clearDelayedCache, compareFlowTemplateWithFlow, createNewAdminPageContext, createRandomImage, createSolidColorImage, encodeImage, extractIdFromUrl, formatPrice, getCountryAddressData, getCountryCodeFromLocale, getCountryId, getCurrency, getCurrencyCodeFromLocale, getCurrencySymbolFromLocale, getCurrentContext, getDefaultShippingMethodId, getFlow, getFlowId, getFlowTemplate, getLanguageCode, getLanguageData, getLocale, getMediaId, getOrderTransactionId, getPaymentMethodId, getPromotionWithDiscount, getSalutationId, getShippingMethodId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, hideElements, hideSymfonyToolbarOnReload, isPaaSInstance, isSaaSInstance, isThemeCompiled, loginToAdministration, mockApiCalls, replaceElements, replaceElementsIndividually, setCurrentContext, setOrderStatus, setViewport, test, translate, updateAdminUser, uploadRandomPngMedia };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "12.14.1",
3
+ "version": "12.15.1",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "keywords": [
6
6
  "fixtures",
@@ -35,7 +35,7 @@
35
35
  "format": "oxfmt --write .",
36
36
  "typecheck": "tsgo --noEmit",
37
37
  "build": "unbuild",
38
- "prepare": "lefthook install",
38
+ "prepare": "(lefthook install || true) && npm run build",
39
39
  "prepublishOnly": "npm run build"
40
40
  },
41
41
  "dependencies": {