@shopware-ag/acceptance-test-suite 12.4.0 → 12.4.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.d.mts CHANGED
@@ -459,8 +459,40 @@ declare const setOrderStatus: (orderId: string, orderStatus: OrderStatus, adminA
459
459
  declare const getPromotionWithDiscount: (promotionId: string, adminApiContext: AdminApiContext) => Promise<Promotion>;
460
460
  declare const updateAdminUser: (adminUserId: string, adminApiContext: AdminApiContext, data: Record<string, string | boolean>) => Promise<void>;
461
461
 
462
+ interface RequestOptions<PAYLOAD> {
463
+ [key: string]: unknown;
464
+ data?: PAYLOAD;
465
+ }
466
+ interface StoreUser {
467
+ email: string;
468
+ password: string;
469
+ }
470
+ interface StoreApiContextOptions {
471
+ 'app_url'?: string;
472
+ 'sw-access-key'?: string;
473
+ 'sw-context-token'?: string;
474
+ ignoreHTTPSErrors?: boolean;
475
+ }
476
+ declare class StoreApiContext {
477
+ private context;
478
+ private readonly options;
479
+ private static readonly defaultOptions;
480
+ constructor(context: APIRequestContext, options: StoreApiContextOptions);
481
+ static create(options?: StoreApiContextOptions): Promise<StoreApiContext>;
482
+ private static createContext;
483
+ login(user: StoreUser): Promise<{
484
+ [key: string]: string;
485
+ }>;
486
+ get<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
487
+ post<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
488
+ patch<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
489
+ delete<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
490
+ fetch<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
491
+ head<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
492
+ }
493
+
462
494
  declare const isSaaSInstance: (adminApiContext: AdminApiContext) => Promise<boolean>;
463
- declare const isThemeCompiled: (context: AdminApiContext, storefrontUrl: string) => Promise<boolean>;
495
+ declare const isThemeCompiled: (context: StoreApiContext, storefrontUrl: string) => Promise<boolean>;
464
496
 
465
497
  declare function createRandomImage(width?: number, height?: number): Image;
466
498
  declare function encodeImage(image: Image): Buffer<ArrayBuffer>;
@@ -4156,38 +4188,6 @@ declare function setCurrentContext(context: Record<string, unknown> | null): voi
4156
4188
  declare function getCurrentContext(): Record<string, unknown> | null;
4157
4189
  declare function translate(key: TranslationKey, options?: Record<string, unknown>): string;
4158
4190
 
4159
- interface RequestOptions<PAYLOAD> {
4160
- [key: string]: unknown;
4161
- data?: PAYLOAD;
4162
- }
4163
- interface StoreUser {
4164
- email: string;
4165
- password: string;
4166
- }
4167
- interface StoreApiContextOptions {
4168
- 'app_url'?: string;
4169
- 'sw-access-key'?: string;
4170
- 'sw-context-token'?: string;
4171
- ignoreHTTPSErrors?: boolean;
4172
- }
4173
- declare class StoreApiContext {
4174
- private context;
4175
- private readonly options;
4176
- private static readonly defaultOptions;
4177
- constructor(context: APIRequestContext, options: StoreApiContextOptions);
4178
- static create(options?: StoreApiContextOptions): Promise<StoreApiContext>;
4179
- private static createContext;
4180
- login(user: StoreUser): Promise<{
4181
- [key: string]: string;
4182
- }>;
4183
- get<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4184
- post<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4185
- patch<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4186
- delete<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4187
- fetch<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4188
- head<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4189
- }
4190
-
4191
4191
  interface Email {
4192
4192
  fromName: string;
4193
4193
  fromAddress: string;
package/dist/index.d.ts CHANGED
@@ -459,8 +459,40 @@ declare const setOrderStatus: (orderId: string, orderStatus: OrderStatus, adminA
459
459
  declare const getPromotionWithDiscount: (promotionId: string, adminApiContext: AdminApiContext) => Promise<Promotion>;
460
460
  declare const updateAdminUser: (adminUserId: string, adminApiContext: AdminApiContext, data: Record<string, string | boolean>) => Promise<void>;
461
461
 
462
+ interface RequestOptions<PAYLOAD> {
463
+ [key: string]: unknown;
464
+ data?: PAYLOAD;
465
+ }
466
+ interface StoreUser {
467
+ email: string;
468
+ password: string;
469
+ }
470
+ interface StoreApiContextOptions {
471
+ 'app_url'?: string;
472
+ 'sw-access-key'?: string;
473
+ 'sw-context-token'?: string;
474
+ ignoreHTTPSErrors?: boolean;
475
+ }
476
+ declare class StoreApiContext {
477
+ private context;
478
+ private readonly options;
479
+ private static readonly defaultOptions;
480
+ constructor(context: APIRequestContext, options: StoreApiContextOptions);
481
+ static create(options?: StoreApiContextOptions): Promise<StoreApiContext>;
482
+ private static createContext;
483
+ login(user: StoreUser): Promise<{
484
+ [key: string]: string;
485
+ }>;
486
+ get<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
487
+ post<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
488
+ patch<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
489
+ delete<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
490
+ fetch<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
491
+ head<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
492
+ }
493
+
462
494
  declare const isSaaSInstance: (adminApiContext: AdminApiContext) => Promise<boolean>;
463
- declare const isThemeCompiled: (context: AdminApiContext, storefrontUrl: string) => Promise<boolean>;
495
+ declare const isThemeCompiled: (context: StoreApiContext, storefrontUrl: string) => Promise<boolean>;
464
496
 
465
497
  declare function createRandomImage(width?: number, height?: number): Image;
466
498
  declare function encodeImage(image: Image): Buffer<ArrayBuffer>;
@@ -4156,38 +4188,6 @@ declare function setCurrentContext(context: Record<string, unknown> | null): voi
4156
4188
  declare function getCurrentContext(): Record<string, unknown> | null;
4157
4189
  declare function translate(key: TranslationKey, options?: Record<string, unknown>): string;
4158
4190
 
4159
- interface RequestOptions<PAYLOAD> {
4160
- [key: string]: unknown;
4161
- data?: PAYLOAD;
4162
- }
4163
- interface StoreUser {
4164
- email: string;
4165
- password: string;
4166
- }
4167
- interface StoreApiContextOptions {
4168
- 'app_url'?: string;
4169
- 'sw-access-key'?: string;
4170
- 'sw-context-token'?: string;
4171
- ignoreHTTPSErrors?: boolean;
4172
- }
4173
- declare class StoreApiContext {
4174
- private context;
4175
- private readonly options;
4176
- private static readonly defaultOptions;
4177
- constructor(context: APIRequestContext, options: StoreApiContextOptions);
4178
- static create(options?: StoreApiContextOptions): Promise<StoreApiContext>;
4179
- private static createContext;
4180
- login(user: StoreUser): Promise<{
4181
- [key: string]: string;
4182
- }>;
4183
- get<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4184
- post<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4185
- patch<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4186
- delete<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4187
- fetch<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4188
- head<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
4189
- }
4190
-
4191
4191
  interface Email {
4192
4192
  fromName: string;
4193
4193
  fromAddress: string;
package/dist/index.mjs CHANGED
@@ -3748,7 +3748,7 @@ const test$b = test$e.extend({
3748
3748
  setCurrentContext(null);
3749
3749
  await AdminApiContext.delete(`user/${uuid}`);
3750
3750
  },
3751
- StorefrontPage: async ({ DefaultSalesChannel, SalesChannelBaseConfig, browser, AdminApiContext, InstanceMeta, CustomTranslationResources }, use) => {
3751
+ StorefrontPage: async ({ DefaultSalesChannel, SalesChannelBaseConfig, browser, AdminApiContext, StoreApiContext, InstanceMeta, CustomTranslationResources }, use) => {
3752
3752
  const { url, salesChannel } = DefaultSalesChannel;
3753
3753
  const locale = getLocale();
3754
3754
  const languageHelper = await LanguageHelper.createInstance(locale, CustomTranslationResources);
@@ -3760,13 +3760,13 @@ const test$b = test$e.extend({
3760
3760
  LanguageHelper.setForContext(context, languageHelper);
3761
3761
  setCurrentContext(context);
3762
3762
  let page;
3763
- if (!await isThemeCompiled(AdminApiContext, DefaultSalesChannel.url)) {
3763
+ if (!await isThemeCompiled(StoreApiContext, DefaultSalesChannel.url)) {
3764
3764
  test$e.slow();
3765
3765
  await AdminApiContext.post(`./_action/theme/${SalesChannelBaseConfig.defaultThemeId}/assign/${salesChannel.id}`);
3766
3766
  await clearDelayedCache(AdminApiContext);
3767
3767
  page = await context.newPage();
3768
3768
  if (InstanceMeta.isSaaS) {
3769
- while (!await isThemeCompiled(AdminApiContext, DefaultSalesChannel.url)) {
3769
+ while (!await isThemeCompiled(StoreApiContext, DefaultSalesChannel.url)) {
3770
3770
  await clearDelayedCache(AdminApiContext);
3771
3771
  await page.waitForTimeout(4e3);
3772
3772
  }
@@ -3844,25 +3844,24 @@ class Actor {
3844
3844
  const stepTitle = `${this.name} selects radio button ${inputLabel}`;
3845
3845
  await test$e.step(stepTitle, async () => {
3846
3846
  const desiredOption = radioGroup.getByRole("radio", { name: inputLabel });
3847
- if (!await desiredOption.isChecked()) {
3848
- const options = [];
3849
- for (const labelEl of await radioGroup.locator("label").all()) {
3850
- const label = await labelEl.innerText();
3851
- const radioButton = radioGroup.getByRole("radio", { name: label });
3852
- const isChecked = await radioButton.isChecked();
3853
- options.push({ label, locator: radioButton, isChecked });
3854
- }
3855
- const defaultOptionIndex = options.findIndex((opt) => opt.isChecked);
3856
- const desiredOptionIndex = options.findIndex((opt) => opt.label === inputLabel);
3857
- if (defaultOptionIndex === -1) {
3858
- throw new Error(`No option is selected by default.`);
3859
- }
3860
- const step = defaultOptionIndex < desiredOptionIndex ? 1 : -1;
3861
- const inputKey = step === 1 ? "ArrowDown" : "ArrowUp";
3862
- for (let i = defaultOptionIndex; i !== desiredOptionIndex; i += step) {
3863
- await this.presses(options[i].locator, inputKey);
3864
- await this.page.waitForLoadState("domcontentloaded");
3847
+ if (await desiredOption.isChecked()) {
3848
+ await this.a11y_checks(desiredOption);
3849
+ return;
3850
+ }
3851
+ let checkedRadio = radioGroup.getByRole("radio", { checked: true });
3852
+ if (!await checkedRadio.count()) {
3853
+ throw new Error("No radio button is selected by default.");
3854
+ }
3855
+ const maxIterations = await radioGroup.getByRole("radio").count();
3856
+ let iterations = 0;
3857
+ while (!await desiredOption.isChecked()) {
3858
+ if (iterations >= maxIterations) {
3859
+ throw new Error(`Could not reach radio button "${inputLabel}" via keyboard navigation.`);
3865
3860
  }
3861
+ await this.presses(checkedRadio, "ArrowDown");
3862
+ await this.page.waitForLoadState("domcontentloaded");
3863
+ checkedRadio = radioGroup.getByRole("radio", { checked: true });
3864
+ iterations++;
3866
3865
  }
3867
3866
  await this.a11y_checks(desiredOption);
3868
3867
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "12.4.0",
3
+ "version": "12.4.1",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",