@shopware-ag/acceptance-test-suite 2.2.0 → 2.3.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
@@ -2,6 +2,7 @@ import * as _playwright_test from '@playwright/test';
2
2
  import { APIRequestContext, APIResponse, Page, Locator } from '@playwright/test';
3
3
  export * from '@playwright/test';
4
4
  import * as playwright_core from 'playwright-core';
5
+ import { Page as Page$1 } from 'playwright-core';
5
6
  import { components } from '@shopware/api-client/admin-api-types';
6
7
  import { Image } from 'image-js';
7
8
 
@@ -531,7 +532,6 @@ interface DefaultSalesChannelTypes {
531
532
  salesChannel: SalesChannel;
532
533
  customer: Customer;
533
534
  url: string;
534
- themeSeed: string | null;
535
535
  };
536
536
  DefaultStorefront: {
537
537
  salesChannel: SalesChannel;
@@ -999,6 +999,7 @@ type OrderStatus = 'cancel' | 'complete' | 'reopen' | 'process';
999
999
  declare const setOrderStatus: (orderId: string, orderStatus: OrderStatus, adminApiContext: AdminApiContext) => Promise<APIResponse>;
1000
1000
 
1001
1001
  declare const isSaaSInstance: (adminApiContext: AdminApiContext) => Promise<boolean>;
1002
+ declare const isThemeCompiled: (page: Page$1) => Promise<boolean>;
1002
1003
 
1003
1004
  declare function createRandomImage(width?: number, height?: number): Image;
1004
1005
 
@@ -1038,4 +1039,4 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
1038
1039
  ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<void>;
1039
1040
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
1040
1041
 
1041
- export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Media, type Order, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PropertyGroup, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, setOrderStatus, test };
1042
+ export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Media, type Order, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PropertyGroup, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as _playwright_test from '@playwright/test';
2
2
  import { APIRequestContext, APIResponse, Page, Locator } from '@playwright/test';
3
3
  export * from '@playwright/test';
4
4
  import * as playwright_core from 'playwright-core';
5
+ import { Page as Page$1 } from 'playwright-core';
5
6
  import { components } from '@shopware/api-client/admin-api-types';
6
7
  import { Image } from 'image-js';
7
8
 
@@ -531,7 +532,6 @@ interface DefaultSalesChannelTypes {
531
532
  salesChannel: SalesChannel;
532
533
  customer: Customer;
533
534
  url: string;
534
- themeSeed: string | null;
535
535
  };
536
536
  DefaultStorefront: {
537
537
  salesChannel: SalesChannel;
@@ -999,6 +999,7 @@ type OrderStatus = 'cancel' | 'complete' | 'reopen' | 'process';
999
999
  declare const setOrderStatus: (orderId: string, orderStatus: OrderStatus, adminApiContext: AdminApiContext) => Promise<APIResponse>;
1000
1000
 
1001
1001
  declare const isSaaSInstance: (adminApiContext: AdminApiContext) => Promise<boolean>;
1002
+ declare const isThemeCompiled: (page: Page$1) => Promise<boolean>;
1002
1003
 
1003
1004
  declare function createRandomImage(width?: number, height?: number): Image;
1004
1005
 
@@ -1038,4 +1039,4 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
1038
1039
  ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<void>;
1039
1040
  }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
1040
1041
 
1041
- export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Media, type Order, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PropertyGroup, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, setOrderStatus, test };
1042
+ export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Media, type Order, type PageObject, type PaymentMethod, type Price, type Product, type ProductPrice, type Promotion, type PropertyGroup, type Rule, type SalesChannel, type Salutation, type ShippingMethod, type SimpleLineItem, type StateMachine, type StateMachineState, StorefrontPageObjects, type SyncApiOperation, type Tag, type Task, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
package/dist/index.mjs CHANGED
@@ -204,6 +204,18 @@ const isSaaSInstance = async (adminApiContext) => {
204
204
  const instanceFeatures = await adminApiContext.get("./instance/features");
205
205
  return instanceFeatures.ok();
206
206
  };
207
+ const isThemeCompiled = async (page) => {
208
+ let allCSSFound = false;
209
+ const listener = (request) => {
210
+ if (request.url().includes("all.css")) {
211
+ allCSSFound = true;
212
+ }
213
+ };
214
+ page.on("request", listener);
215
+ await page.goto("./", { waitUntil: "load" });
216
+ page.off("request", listener);
217
+ return allCSSFound;
218
+ };
207
219
 
208
220
  const test$a = test$c.extend({
209
221
  SalesChannelBaseConfig: [
@@ -247,26 +259,6 @@ const test$a = test$c.extend({
247
259
  const { uuid: domainUuid } = IdProvider.getWorkerDerivedStableId("domain");
248
260
  const { uuid: customerUuid } = IdProvider.getWorkerDerivedStableId("customer");
249
261
  const baseUrl = `${SalesChannelBaseConfig.appUrl}test-${uuid}/`;
250
- const response = await AdminApiContext.post(`./search/system-config`, {
251
- data: {
252
- page: 1,
253
- limit: 1,
254
- filter: [
255
- {
256
- type: "equals",
257
- field: "salesChannelId",
258
- value: uuid
259
- },
260
- {
261
- type: "equals",
262
- field: "configurationKey",
263
- value: "storefront.themeSeed"
264
- }
265
- ]
266
- }
267
- });
268
- const currentConfig = await response.json();
269
- const themeSeed = currentConfig.total > 0 ? currentConfig.data[0].configurationValue : null;
270
262
  await AdminApiContext.delete(`./customer/${customerUuid}`);
271
263
  const ordersResp = await AdminApiContext.post(`./search/order`, {
272
264
  data: {
@@ -313,7 +305,6 @@ const test$a = test$c.extend({
313
305
  }
314
306
  }
315
307
  }
316
- await AdminApiContext.delete(`./sales-channel/${uuid}`);
317
308
  const syncResp = await AdminApiContext.post("./_action/sync", {
318
309
  data: {
319
310
  "write-sales-channel": {
@@ -360,16 +351,6 @@ const test$a = test$c.extend({
360
351
  }
361
352
  });
362
353
  expect(syncResp.ok()).toBeTruthy();
363
- if (themeSeed) {
364
- await AdminApiContext.post("./system-config", {
365
- data: {
366
- id: uuid,
367
- salesChannelId: uuid,
368
- configurationKey: "storefront.themeSeed",
369
- configurationValue: themeSeed
370
- }
371
- });
372
- }
373
354
  const salesChannelPromise = AdminApiContext.get(`./sales-channel/${uuid}`);
374
355
  const salutationResponse = await AdminApiContext.get(`./salutation`);
375
356
  const salutations = await salutationResponse.json();
@@ -418,8 +399,7 @@ const test$a = test$c.extend({
418
399
  await use({
419
400
  salesChannel: salesChannel.data,
420
401
  customer: { ...customer.data, password: customerData.password },
421
- url: baseUrl,
422
- themeSeed
402
+ url: baseUrl
423
403
  });
424
404
  },
425
405
  { scope: "worker" }
@@ -428,26 +408,19 @@ const test$a = test$c.extend({
428
408
  async ({ browser, AdminApiContext, DefaultSalesChannel, SalesChannelBaseConfig }, use) => {
429
409
  const { id: uuid } = DefaultSalesChannel.salesChannel;
430
410
  const isSaasInstance = await isSaaSInstance(AdminApiContext);
431
- await AdminApiContext.post(
432
- `./_action/theme/${SalesChannelBaseConfig.defaultThemeId}/assign/${uuid}`
433
- );
434
- test$c.slow();
435
- if (isSaasInstance) {
436
- const tmpContext = await browser.newContext();
437
- const tmpPage = await tmpContext.newPage();
438
- for (let i = 0; i < 100; ++i) {
439
- let latestTimestamp = (/* @__PURE__ */ new Date()).toISOString();
440
- const response = await AdminApiContext.get(`./notification/message?limit=10&latestTimestamp=${latestTimestamp}`);
441
- const json = await response.json();
442
- if (json.timestamp) {
443
- latestTimestamp = json.timestamp;
444
- }
445
- if (json.notifications.find((n) => n.message.includes(`Compilation for sales channel ${DefaultSalesChannel.salesChannel.name} completed`))) {
446
- tmpPage.close();
447
- tmpContext.close();
448
- break;
411
+ const tmpContext = await browser.newContext({
412
+ baseURL: DefaultSalesChannel.url
413
+ });
414
+ const tmpPage = await tmpContext.newPage();
415
+ if (!await isThemeCompiled(tmpPage)) {
416
+ test$c.slow();
417
+ await AdminApiContext.post(
418
+ `./_action/theme/${SalesChannelBaseConfig.defaultThemeId}/assign/${uuid}`
419
+ );
420
+ if (isSaasInstance) {
421
+ while (!await isThemeCompiled(tmpPage)) {
422
+ await tmpPage.waitForTimeout(2e3);
449
423
  }
450
- await tmpPage.waitForTimeout(1e3);
451
424
  }
452
425
  }
453
426
  await use({
@@ -3599,4 +3572,4 @@ const test = mergeTests(
3599
3572
  test$1
3600
3573
  );
3601
3574
 
3602
- export { AdminPageObjects, StorefrontPageObjects, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, setOrderStatus, test };
3575
+ export { AdminPageObjects, StorefrontPageObjects, TestDataService, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, isThemeCompiled, setOrderStatus, test };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware-ag/acceptance-test-suite",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Shopware Acceptance Test Suite",
5
5
  "author": "shopware AG",
6
6
  "license": "MIT",