@shopware-ag/acceptance-test-suite 2.3.0 → 2.3.2
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 +50 -30
- package/dist/index.d.ts +50 -30
- package/dist/index.mjs +317 -291
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ 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';
|
|
6
5
|
import { components } from '@shopware/api-client/admin-api-types';
|
|
7
6
|
import { Image } from 'image-js';
|
|
8
7
|
|
|
@@ -71,6 +70,31 @@ declare class StoreApiContext {
|
|
|
71
70
|
head<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
|
|
72
71
|
}
|
|
73
72
|
|
|
73
|
+
interface ApiContextTypes {
|
|
74
|
+
AdminApiContext: AdminApiContext;
|
|
75
|
+
StoreApiContext: StoreApiContext;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface PageContextTypes {
|
|
79
|
+
AdminPage: Page;
|
|
80
|
+
StorefrontPage: Page;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class Actor {
|
|
84
|
+
page: Page;
|
|
85
|
+
readonly name: string;
|
|
86
|
+
constructor(name: string, page: Page);
|
|
87
|
+
expects: _playwright_test.Expect<{}>;
|
|
88
|
+
attemptsTo(task: () => Promise<void>): Promise<void>;
|
|
89
|
+
goesTo(url: string): Promise<void>;
|
|
90
|
+
private camelCaseToLowerCase;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface ActorFixtureTypes {
|
|
94
|
+
ShopCustomer: Actor;
|
|
95
|
+
ShopAdmin: Actor;
|
|
96
|
+
}
|
|
97
|
+
|
|
74
98
|
interface IdPair {
|
|
75
99
|
id: string;
|
|
76
100
|
uuid: string;
|
|
@@ -169,7 +193,7 @@ type Promotion = components['schemas']['Promotion'] & {
|
|
|
169
193
|
|
|
170
194
|
interface CreatedRecord {
|
|
171
195
|
resource: string;
|
|
172
|
-
|
|
196
|
+
payload: Record<string, string>;
|
|
173
197
|
}
|
|
174
198
|
interface SimpleLineItem {
|
|
175
199
|
product: Product;
|
|
@@ -204,7 +228,25 @@ declare class TestDataService {
|
|
|
204
228
|
readonly defaultLanguageId: string;
|
|
205
229
|
readonly defaultCountryId: string;
|
|
206
230
|
readonly defaultCustomerGroupId: string;
|
|
231
|
+
/**
|
|
232
|
+
* Configures if an automated cleanup of the data should be executed.
|
|
233
|
+
*
|
|
234
|
+
* @private
|
|
235
|
+
*/
|
|
207
236
|
private shouldCleanUp;
|
|
237
|
+
/**
|
|
238
|
+
* Configuration of higher priority entities for the cleanup operation.
|
|
239
|
+
* These entities will be deleted before others.
|
|
240
|
+
* This will prevent restricted delete operations of associated entities.
|
|
241
|
+
*
|
|
242
|
+
* @private
|
|
243
|
+
*/
|
|
244
|
+
private highPriorityEntities;
|
|
245
|
+
/**
|
|
246
|
+
* A registry of all created records.
|
|
247
|
+
*
|
|
248
|
+
* @private
|
|
249
|
+
*/
|
|
208
250
|
private createdRecords;
|
|
209
251
|
constructor(AdminApiClient: AdminApiContext, IdProvider: IdProvider, options: DataServiceOptions);
|
|
210
252
|
/**
|
|
@@ -405,9 +447,9 @@ declare class TestDataService {
|
|
|
405
447
|
* All entities added to the registry will be deleted by the cleanup call.
|
|
406
448
|
*
|
|
407
449
|
* @param resource - The resource name of the entity.
|
|
408
|
-
* @param
|
|
450
|
+
* @param payload - You can pass a payload object for the delete operation or simply pass the uuid of the entity.
|
|
409
451
|
*/
|
|
410
|
-
addCreatedRecord(resource: string,
|
|
452
|
+
addCreatedRecord(resource: string, payload: string | Record<string, string>): void;
|
|
411
453
|
/**
|
|
412
454
|
* Set the configuration of automated data clean up.
|
|
413
455
|
* If set to "true" the data service will delete all entities created by it.
|
|
@@ -480,35 +522,13 @@ declare class TestDataService {
|
|
|
480
522
|
getBasicPromotionStruct(salesChannelId?: string, overrides?: Partial<Promotion>): Partial<Promotion>;
|
|
481
523
|
}
|
|
482
524
|
|
|
483
|
-
interface
|
|
484
|
-
AdminApiContext: AdminApiContext;
|
|
485
|
-
StoreApiContext: StoreApiContext;
|
|
525
|
+
interface TestDataFixtureTypes {
|
|
486
526
|
TestDataService: TestDataService;
|
|
487
527
|
}
|
|
488
528
|
|
|
489
|
-
interface PageContextTypes {
|
|
490
|
-
AdminPage: Page;
|
|
491
|
-
StorefrontPage: Page;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
declare class Actor {
|
|
495
|
-
page: Page;
|
|
496
|
-
readonly name: string;
|
|
497
|
-
constructor(name: string, page: Page);
|
|
498
|
-
expects: _playwright_test.Expect<{}>;
|
|
499
|
-
attemptsTo(task: () => Promise<void>): Promise<void>;
|
|
500
|
-
goesTo(url: string): Promise<void>;
|
|
501
|
-
private camelCaseToLowerCase;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
interface ActorFixtureTypes {
|
|
505
|
-
ShopCustomer: Actor;
|
|
506
|
-
ShopAdmin: Actor;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
529
|
interface HelperFixtureTypes {
|
|
510
530
|
IdProvider: IdProvider;
|
|
511
|
-
SaaSInstanceSetup: () => Promise<void>;
|
|
531
|
+
SaaSInstanceSetup: (page: Page) => Promise<void>;
|
|
512
532
|
}
|
|
513
533
|
|
|
514
534
|
interface StoreBaseConfig {
|
|
@@ -972,7 +992,7 @@ interface DataFixtureTypes {
|
|
|
972
992
|
TagData: components['schemas']['Tag'];
|
|
973
993
|
}
|
|
974
994
|
|
|
975
|
-
interface FixtureTypes extends ApiContextTypes, PageContextTypes, ActorFixtureTypes, HelperFixtureTypes, DefaultSalesChannelTypes, StorefrontPageTypes, AdministrationPageTypes, DataFixtureTypes {
|
|
995
|
+
interface FixtureTypes extends ApiContextTypes, PageContextTypes, ActorFixtureTypes, TestDataFixtureTypes, HelperFixtureTypes, DefaultSalesChannelTypes, StorefrontPageTypes, AdministrationPageTypes, DataFixtureTypes {
|
|
976
996
|
}
|
|
977
997
|
|
|
978
998
|
declare const getLanguageData: (languageCode: string, adminApiContext: AdminApiContext) => Promise<{
|
|
@@ -999,7 +1019,7 @@ type OrderStatus = 'cancel' | 'complete' | 'reopen' | 'process';
|
|
|
999
1019
|
declare const setOrderStatus: (orderId: string, orderStatus: OrderStatus, adminApiContext: AdminApiContext) => Promise<APIResponse>;
|
|
1000
1020
|
|
|
1001
1021
|
declare const isSaaSInstance: (adminApiContext: AdminApiContext) => Promise<boolean>;
|
|
1002
|
-
declare const isThemeCompiled: (
|
|
1022
|
+
declare const isThemeCompiled: (context: AdminApiContext, storefrontUrl: string) => Promise<boolean>;
|
|
1003
1023
|
|
|
1004
1024
|
declare function createRandomImage(width?: number, height?: number): Image;
|
|
1005
1025
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ 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';
|
|
6
5
|
import { components } from '@shopware/api-client/admin-api-types';
|
|
7
6
|
import { Image } from 'image-js';
|
|
8
7
|
|
|
@@ -71,6 +70,31 @@ declare class StoreApiContext {
|
|
|
71
70
|
head<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
|
|
72
71
|
}
|
|
73
72
|
|
|
73
|
+
interface ApiContextTypes {
|
|
74
|
+
AdminApiContext: AdminApiContext;
|
|
75
|
+
StoreApiContext: StoreApiContext;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface PageContextTypes {
|
|
79
|
+
AdminPage: Page;
|
|
80
|
+
StorefrontPage: Page;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare class Actor {
|
|
84
|
+
page: Page;
|
|
85
|
+
readonly name: string;
|
|
86
|
+
constructor(name: string, page: Page);
|
|
87
|
+
expects: _playwright_test.Expect<{}>;
|
|
88
|
+
attemptsTo(task: () => Promise<void>): Promise<void>;
|
|
89
|
+
goesTo(url: string): Promise<void>;
|
|
90
|
+
private camelCaseToLowerCase;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface ActorFixtureTypes {
|
|
94
|
+
ShopCustomer: Actor;
|
|
95
|
+
ShopAdmin: Actor;
|
|
96
|
+
}
|
|
97
|
+
|
|
74
98
|
interface IdPair {
|
|
75
99
|
id: string;
|
|
76
100
|
uuid: string;
|
|
@@ -169,7 +193,7 @@ type Promotion = components['schemas']['Promotion'] & {
|
|
|
169
193
|
|
|
170
194
|
interface CreatedRecord {
|
|
171
195
|
resource: string;
|
|
172
|
-
|
|
196
|
+
payload: Record<string, string>;
|
|
173
197
|
}
|
|
174
198
|
interface SimpleLineItem {
|
|
175
199
|
product: Product;
|
|
@@ -204,7 +228,25 @@ declare class TestDataService {
|
|
|
204
228
|
readonly defaultLanguageId: string;
|
|
205
229
|
readonly defaultCountryId: string;
|
|
206
230
|
readonly defaultCustomerGroupId: string;
|
|
231
|
+
/**
|
|
232
|
+
* Configures if an automated cleanup of the data should be executed.
|
|
233
|
+
*
|
|
234
|
+
* @private
|
|
235
|
+
*/
|
|
207
236
|
private shouldCleanUp;
|
|
237
|
+
/**
|
|
238
|
+
* Configuration of higher priority entities for the cleanup operation.
|
|
239
|
+
* These entities will be deleted before others.
|
|
240
|
+
* This will prevent restricted delete operations of associated entities.
|
|
241
|
+
*
|
|
242
|
+
* @private
|
|
243
|
+
*/
|
|
244
|
+
private highPriorityEntities;
|
|
245
|
+
/**
|
|
246
|
+
* A registry of all created records.
|
|
247
|
+
*
|
|
248
|
+
* @private
|
|
249
|
+
*/
|
|
208
250
|
private createdRecords;
|
|
209
251
|
constructor(AdminApiClient: AdminApiContext, IdProvider: IdProvider, options: DataServiceOptions);
|
|
210
252
|
/**
|
|
@@ -405,9 +447,9 @@ declare class TestDataService {
|
|
|
405
447
|
* All entities added to the registry will be deleted by the cleanup call.
|
|
406
448
|
*
|
|
407
449
|
* @param resource - The resource name of the entity.
|
|
408
|
-
* @param
|
|
450
|
+
* @param payload - You can pass a payload object for the delete operation or simply pass the uuid of the entity.
|
|
409
451
|
*/
|
|
410
|
-
addCreatedRecord(resource: string,
|
|
452
|
+
addCreatedRecord(resource: string, payload: string | Record<string, string>): void;
|
|
411
453
|
/**
|
|
412
454
|
* Set the configuration of automated data clean up.
|
|
413
455
|
* If set to "true" the data service will delete all entities created by it.
|
|
@@ -480,35 +522,13 @@ declare class TestDataService {
|
|
|
480
522
|
getBasicPromotionStruct(salesChannelId?: string, overrides?: Partial<Promotion>): Partial<Promotion>;
|
|
481
523
|
}
|
|
482
524
|
|
|
483
|
-
interface
|
|
484
|
-
AdminApiContext: AdminApiContext;
|
|
485
|
-
StoreApiContext: StoreApiContext;
|
|
525
|
+
interface TestDataFixtureTypes {
|
|
486
526
|
TestDataService: TestDataService;
|
|
487
527
|
}
|
|
488
528
|
|
|
489
|
-
interface PageContextTypes {
|
|
490
|
-
AdminPage: Page;
|
|
491
|
-
StorefrontPage: Page;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
declare class Actor {
|
|
495
|
-
page: Page;
|
|
496
|
-
readonly name: string;
|
|
497
|
-
constructor(name: string, page: Page);
|
|
498
|
-
expects: _playwright_test.Expect<{}>;
|
|
499
|
-
attemptsTo(task: () => Promise<void>): Promise<void>;
|
|
500
|
-
goesTo(url: string): Promise<void>;
|
|
501
|
-
private camelCaseToLowerCase;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
interface ActorFixtureTypes {
|
|
505
|
-
ShopCustomer: Actor;
|
|
506
|
-
ShopAdmin: Actor;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
529
|
interface HelperFixtureTypes {
|
|
510
530
|
IdProvider: IdProvider;
|
|
511
|
-
SaaSInstanceSetup: () => Promise<void>;
|
|
531
|
+
SaaSInstanceSetup: (page: Page) => Promise<void>;
|
|
512
532
|
}
|
|
513
533
|
|
|
514
534
|
interface StoreBaseConfig {
|
|
@@ -972,7 +992,7 @@ interface DataFixtureTypes {
|
|
|
972
992
|
TagData: components['schemas']['Tag'];
|
|
973
993
|
}
|
|
974
994
|
|
|
975
|
-
interface FixtureTypes extends ApiContextTypes, PageContextTypes, ActorFixtureTypes, HelperFixtureTypes, DefaultSalesChannelTypes, StorefrontPageTypes, AdministrationPageTypes, DataFixtureTypes {
|
|
995
|
+
interface FixtureTypes extends ApiContextTypes, PageContextTypes, ActorFixtureTypes, TestDataFixtureTypes, HelperFixtureTypes, DefaultSalesChannelTypes, StorefrontPageTypes, AdministrationPageTypes, DataFixtureTypes {
|
|
976
996
|
}
|
|
977
997
|
|
|
978
998
|
declare const getLanguageData: (languageCode: string, adminApiContext: AdminApiContext) => Promise<{
|
|
@@ -999,7 +1019,7 @@ type OrderStatus = 'cancel' | 'complete' | 'reopen' | 'process';
|
|
|
999
1019
|
declare const setOrderStatus: (orderId: string, orderStatus: OrderStatus, adminApiContext: AdminApiContext) => Promise<APIResponse>;
|
|
1000
1020
|
|
|
1001
1021
|
declare const isSaaSInstance: (adminApiContext: AdminApiContext) => Promise<boolean>;
|
|
1002
|
-
declare const isThemeCompiled: (
|
|
1022
|
+
declare const isThemeCompiled: (context: AdminApiContext, storefrontUrl: string) => Promise<boolean>;
|
|
1003
1023
|
|
|
1004
1024
|
declare function createRandomImage(width?: number, height?: number): Image;
|
|
1005
1025
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { test as test$
|
|
1
|
+
import { test as test$d, expect, request, mergeTests } from '@playwright/test';
|
|
2
2
|
export * from '@playwright/test';
|
|
3
3
|
import { Image } from 'image-js';
|
|
4
4
|
import crypto from 'crypto';
|
|
@@ -200,24 +200,7 @@ const setOrderStatus = async (orderId, orderStatus, adminApiContext) => {
|
|
|
200
200
|
return await adminApiContext.post(`./_action/order/${orderId}/state/${orderStatus}`);
|
|
201
201
|
};
|
|
202
202
|
|
|
203
|
-
const
|
|
204
|
-
const instanceFeatures = await adminApiContext.get("./instance/features");
|
|
205
|
-
return instanceFeatures.ok();
|
|
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
|
-
};
|
|
219
|
-
|
|
220
|
-
const test$a = test$c.extend({
|
|
203
|
+
const test$b = test$d.extend({
|
|
221
204
|
SalesChannelBaseConfig: [
|
|
222
205
|
async ({ AdminApiContext }, use) => {
|
|
223
206
|
const requests = {
|
|
@@ -403,31 +386,6 @@ const test$a = test$c.extend({
|
|
|
403
386
|
});
|
|
404
387
|
},
|
|
405
388
|
{ scope: "worker" }
|
|
406
|
-
],
|
|
407
|
-
DefaultStorefront: [
|
|
408
|
-
async ({ browser, AdminApiContext, DefaultSalesChannel, SalesChannelBaseConfig }, use) => {
|
|
409
|
-
const { id: uuid } = DefaultSalesChannel.salesChannel;
|
|
410
|
-
const isSaasInstance = await isSaaSInstance(AdminApiContext);
|
|
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);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
await use({
|
|
427
|
-
...DefaultSalesChannel
|
|
428
|
-
});
|
|
429
|
-
},
|
|
430
|
-
{ scope: "worker" }
|
|
431
389
|
]
|
|
432
390
|
});
|
|
433
391
|
|
|
@@ -616,6 +574,204 @@ __publicField$r(_StoreApiContext, "defaultOptions", {
|
|
|
616
574
|
});
|
|
617
575
|
let StoreApiContext = _StoreApiContext;
|
|
618
576
|
|
|
577
|
+
const test$a = test$d.extend({
|
|
578
|
+
AdminApiContext: [
|
|
579
|
+
async ({}, use) => {
|
|
580
|
+
const adminApiContext = await AdminApiContext.create();
|
|
581
|
+
await use(adminApiContext);
|
|
582
|
+
},
|
|
583
|
+
{ scope: "worker" }
|
|
584
|
+
],
|
|
585
|
+
StoreApiContext: [
|
|
586
|
+
async ({ DefaultSalesChannel }, use) => {
|
|
587
|
+
const options = {
|
|
588
|
+
app_url: process.env["APP_URL"],
|
|
589
|
+
"sw-access-key": DefaultSalesChannel.salesChannel.accessKey,
|
|
590
|
+
ignoreHTTPSErrors: true
|
|
591
|
+
};
|
|
592
|
+
const storeApiContext = await StoreApiContext.create(options);
|
|
593
|
+
await use(storeApiContext);
|
|
594
|
+
},
|
|
595
|
+
{ scope: "worker" }
|
|
596
|
+
]
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
async function mockApiCalls(page) {
|
|
600
|
+
await page.route("**/api/notification/message*", (route) => route.fulfill({
|
|
601
|
+
status: 200,
|
|
602
|
+
contentType: "application/json",
|
|
603
|
+
body: JSON.stringify({ notifications: [], timestamp: "2024-06-19 06:23:25.040" })
|
|
604
|
+
}));
|
|
605
|
+
await page.route("**/api/_action/store/plugin/search*", (route) => route.fulfill({
|
|
606
|
+
status: 200,
|
|
607
|
+
contentType: "application/json",
|
|
608
|
+
body: JSON.stringify({ items: [], total: 0 })
|
|
609
|
+
}));
|
|
610
|
+
await page.route("**/api/_action/store/updates*", (route) => route.fulfill({
|
|
611
|
+
status: 200,
|
|
612
|
+
contentType: "application/json",
|
|
613
|
+
body: JSON.stringify({ items: [], total: 0 })
|
|
614
|
+
}));
|
|
615
|
+
await page.route("**/api/sbp/shop-info*", (route) => route.fulfill({
|
|
616
|
+
status: 200,
|
|
617
|
+
contentType: "application/json",
|
|
618
|
+
body: JSON.stringify({ items: [], total: 0 })
|
|
619
|
+
}));
|
|
620
|
+
await page.route("**/api/sbp/shop-info*", (route) => route.fulfill({
|
|
621
|
+
status: 200,
|
|
622
|
+
contentType: "application/json",
|
|
623
|
+
body: process.env.SBP_SHOP_INFO_JSON ?? "{}"
|
|
624
|
+
}));
|
|
625
|
+
await page.route("**/api/sbp/bookableplans*", (route) => route.fulfill({
|
|
626
|
+
status: 200,
|
|
627
|
+
contentType: "application/json",
|
|
628
|
+
body: process.env.SBP_BOOKABLE_PLANS_JSON ?? "{}"
|
|
629
|
+
}));
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
const isSaaSInstance = async (adminApiContext) => {
|
|
633
|
+
const instanceFeatures = await adminApiContext.get("./instance/features");
|
|
634
|
+
return instanceFeatures.ok();
|
|
635
|
+
};
|
|
636
|
+
const isThemeCompiled = async (context, storefrontUrl) => {
|
|
637
|
+
const response = await context.get(storefrontUrl);
|
|
638
|
+
const body = (await response.body()).toString();
|
|
639
|
+
const matches = body.match(/.*"(https:\/\/.*all\.css[^"]*)".*/);
|
|
640
|
+
if (matches && matches?.length > 1) {
|
|
641
|
+
const allCssUrl = matches[1];
|
|
642
|
+
const allCssResponse = await context.get(allCssUrl);
|
|
643
|
+
return allCssResponse.status() < 400;
|
|
644
|
+
}
|
|
645
|
+
return false;
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
const test$9 = test$d.extend({
|
|
649
|
+
AdminPage: async ({ IdProvider, AdminApiContext, SalesChannelBaseConfig, browser }, use) => {
|
|
650
|
+
const context = await browser.newContext({
|
|
651
|
+
baseURL: SalesChannelBaseConfig.adminUrl,
|
|
652
|
+
serviceWorkers: "block"
|
|
653
|
+
});
|
|
654
|
+
const page = await context.newPage();
|
|
655
|
+
await mockApiCalls(page);
|
|
656
|
+
const { id, uuid } = IdProvider.getIdPair();
|
|
657
|
+
const adminUser = {
|
|
658
|
+
id: uuid,
|
|
659
|
+
username: `admin_${id}`,
|
|
660
|
+
firstName: `${id} admin`,
|
|
661
|
+
lastName: `${id} admin`,
|
|
662
|
+
localeId: SalesChannelBaseConfig.enGBLocaleId,
|
|
663
|
+
email: `admin_${id}@example.com`,
|
|
664
|
+
timezone: "Europe/Berlin",
|
|
665
|
+
password: "shopware",
|
|
666
|
+
admin: true
|
|
667
|
+
};
|
|
668
|
+
const response = await AdminApiContext.post("user", {
|
|
669
|
+
data: adminUser
|
|
670
|
+
});
|
|
671
|
+
expect(response.ok()).toBeTruthy();
|
|
672
|
+
await page.goto("#/login");
|
|
673
|
+
await page.addStyleTag({
|
|
674
|
+
content: `
|
|
675
|
+
.sf-toolbar {
|
|
676
|
+
width: 0 !important;
|
|
677
|
+
height: 0 !important;
|
|
678
|
+
display: none !important;
|
|
679
|
+
pointer-events: none !important;
|
|
680
|
+
}
|
|
681
|
+
`.trim()
|
|
682
|
+
});
|
|
683
|
+
await page.getByLabel(/Username|Email address/).fill(adminUser.username);
|
|
684
|
+
await page.getByLabel("Password").fill(adminUser.password);
|
|
685
|
+
await page.getByRole("button", { name: "Log in" }).click();
|
|
686
|
+
await expect(page.locator("css=.sw-admin-menu__header-logo").first()).toBeVisible({
|
|
687
|
+
timeout: 2e4
|
|
688
|
+
});
|
|
689
|
+
await expect(page.locator(".sw-skeleton")).toHaveCount(0, {
|
|
690
|
+
timeout: 1e4
|
|
691
|
+
});
|
|
692
|
+
await expect(page.locator(".sw-loader")).toHaveCount(0, {
|
|
693
|
+
timeout: 1e4
|
|
694
|
+
});
|
|
695
|
+
await use(page);
|
|
696
|
+
await page.close();
|
|
697
|
+
await context.close();
|
|
698
|
+
await AdminApiContext.delete(`user/${uuid}`);
|
|
699
|
+
},
|
|
700
|
+
StorefrontPage: async ({ DefaultSalesChannel, SalesChannelBaseConfig, browser, AdminApiContext }, use) => {
|
|
701
|
+
const { url, salesChannel } = DefaultSalesChannel;
|
|
702
|
+
const context = await browser.newContext({
|
|
703
|
+
baseURL: url
|
|
704
|
+
});
|
|
705
|
+
const page = await context.newPage();
|
|
706
|
+
const isSaasInstance = await isSaaSInstance(AdminApiContext);
|
|
707
|
+
if (!await isThemeCompiled(AdminApiContext, DefaultSalesChannel.url)) {
|
|
708
|
+
test$d.slow();
|
|
709
|
+
await AdminApiContext.post(
|
|
710
|
+
`./_action/theme/${SalesChannelBaseConfig.defaultThemeId}/assign/${salesChannel.id}`
|
|
711
|
+
);
|
|
712
|
+
if (isSaasInstance) {
|
|
713
|
+
while (!await isThemeCompiled(AdminApiContext, DefaultSalesChannel.url)) {
|
|
714
|
+
await page.waitForTimeout(4e3);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
await page.goto("./", { waitUntil: "load" });
|
|
719
|
+
await use(page);
|
|
720
|
+
await page.close();
|
|
721
|
+
await context.close();
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
var __defProp$q = Object.defineProperty;
|
|
726
|
+
var __defNormalProp$q = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
727
|
+
var __publicField$q = (obj, key, value) => {
|
|
728
|
+
__defNormalProp$q(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
729
|
+
return value;
|
|
730
|
+
};
|
|
731
|
+
class Actor {
|
|
732
|
+
constructor(name, page) {
|
|
733
|
+
__publicField$q(this, "page");
|
|
734
|
+
__publicField$q(this, "name");
|
|
735
|
+
__publicField$q(this, "expects", expect);
|
|
736
|
+
this.name = name;
|
|
737
|
+
this.page = page;
|
|
738
|
+
}
|
|
739
|
+
async attemptsTo(task) {
|
|
740
|
+
const stepTitle = `${this.name} attempts to ${this.camelCaseToLowerCase(task.name)}`;
|
|
741
|
+
await test$d.step(stepTitle, async () => await task());
|
|
742
|
+
}
|
|
743
|
+
async goesTo(url) {
|
|
744
|
+
const stepTitle = `${this.name} navigates to "${url}"`;
|
|
745
|
+
await test$d.step(stepTitle, async () => {
|
|
746
|
+
await this.page.goto(url);
|
|
747
|
+
await this.page.addStyleTag({
|
|
748
|
+
content: `
|
|
749
|
+
.sf-toolbar {
|
|
750
|
+
width: 0 !important;
|
|
751
|
+
height: 0 !important;
|
|
752
|
+
display: none !important;
|
|
753
|
+
pointer-events: none !important;
|
|
754
|
+
}
|
|
755
|
+
`.trim()
|
|
756
|
+
});
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
camelCaseToLowerCase(str) {
|
|
760
|
+
return str.replace(/[A-Z]/g, (letter) => ` ${letter.toLowerCase()}`);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
const test$8 = test$d.extend({
|
|
765
|
+
ShopCustomer: async ({ StorefrontPage }, use) => {
|
|
766
|
+
const shopCustomer = new Actor("Shop customer", StorefrontPage);
|
|
767
|
+
await use(shopCustomer);
|
|
768
|
+
},
|
|
769
|
+
ShopAdmin: async ({ AdminPage }, use) => {
|
|
770
|
+
const shopAdmin = new Actor("Shop administrator", AdminPage);
|
|
771
|
+
await use(shopAdmin);
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
|
|
619
775
|
function createRandomImage(width = 800, height = 600) {
|
|
620
776
|
const buffer = Buffer.alloc(width * height * 4);
|
|
621
777
|
let i = 0;
|
|
@@ -625,27 +781,45 @@ function createRandomImage(width = 800, height = 600) {
|
|
|
625
781
|
return new Image(width, height, buffer);
|
|
626
782
|
}
|
|
627
783
|
|
|
628
|
-
var __defProp$
|
|
629
|
-
var __defNormalProp$
|
|
630
|
-
var __publicField$
|
|
631
|
-
__defNormalProp$
|
|
784
|
+
var __defProp$p = Object.defineProperty;
|
|
785
|
+
var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
786
|
+
var __publicField$p = (obj, key, value) => {
|
|
787
|
+
__defNormalProp$p(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
632
788
|
return value;
|
|
633
789
|
};
|
|
634
790
|
class TestDataService {
|
|
635
791
|
constructor(AdminApiClient, IdProvider, options) {
|
|
636
|
-
__publicField$
|
|
637
|
-
__publicField$
|
|
638
|
-
__publicField$
|
|
639
|
-
__publicField$
|
|
640
|
-
__publicField$
|
|
641
|
-
__publicField$
|
|
642
|
-
__publicField$
|
|
643
|
-
__publicField$
|
|
644
|
-
__publicField$
|
|
645
|
-
__publicField$
|
|
646
|
-
__publicField$
|
|
647
|
-
|
|
648
|
-
|
|
792
|
+
__publicField$p(this, "AdminApiClient");
|
|
793
|
+
__publicField$p(this, "IdProvider");
|
|
794
|
+
__publicField$p(this, "namePrefix", "Test-");
|
|
795
|
+
__publicField$p(this, "nameSuffix", "");
|
|
796
|
+
__publicField$p(this, "defaultSalesChannel");
|
|
797
|
+
__publicField$p(this, "defaultTaxId");
|
|
798
|
+
__publicField$p(this, "defaultCurrencyId");
|
|
799
|
+
__publicField$p(this, "defaultCategoryId");
|
|
800
|
+
__publicField$p(this, "defaultLanguageId");
|
|
801
|
+
__publicField$p(this, "defaultCountryId");
|
|
802
|
+
__publicField$p(this, "defaultCustomerGroupId");
|
|
803
|
+
/**
|
|
804
|
+
* Configures if an automated cleanup of the data should be executed.
|
|
805
|
+
*
|
|
806
|
+
* @private
|
|
807
|
+
*/
|
|
808
|
+
__publicField$p(this, "shouldCleanUp", true);
|
|
809
|
+
/**
|
|
810
|
+
* Configuration of higher priority entities for the cleanup operation.
|
|
811
|
+
* These entities will be deleted before others.
|
|
812
|
+
* This will prevent restricted delete operations of associated entities.
|
|
813
|
+
*
|
|
814
|
+
* @private
|
|
815
|
+
*/
|
|
816
|
+
__publicField$p(this, "highPriorityEntities", ["order", "product"]);
|
|
817
|
+
/**
|
|
818
|
+
* A registry of all created records.
|
|
819
|
+
*
|
|
820
|
+
* @private
|
|
821
|
+
*/
|
|
822
|
+
__publicField$p(this, "createdRecords", []);
|
|
649
823
|
this.AdminApiClient = AdminApiClient;
|
|
650
824
|
this.IdProvider = IdProvider;
|
|
651
825
|
this.defaultSalesChannel = options.defaultSalesChannel;
|
|
@@ -711,8 +885,7 @@ class TestDataService {
|
|
|
711
885
|
async createDigitalProduct(content = "Lorem ipsum dolor", overrides = {}, taxId = this.defaultTaxId, currencyId = this.defaultCurrencyId) {
|
|
712
886
|
const product = await this.createBasicProduct(overrides, taxId, currencyId);
|
|
713
887
|
const media = await this.createMediaTXT(content);
|
|
714
|
-
|
|
715
|
-
this.addCreatedRecord("product-download", productDownload.id);
|
|
888
|
+
await this.assignProductDownload(product.id, media.id);
|
|
716
889
|
return product;
|
|
717
890
|
}
|
|
718
891
|
/**
|
|
@@ -822,7 +995,7 @@ class TestDataService {
|
|
|
822
995
|
data: Object.assign({}, colorPropertyGroup, overrides)
|
|
823
996
|
});
|
|
824
997
|
const { data: propertyGroup } = await propertyGroupResponse.json();
|
|
825
|
-
this.addCreatedRecord("
|
|
998
|
+
this.addCreatedRecord("property_group", propertyGroup.id);
|
|
826
999
|
return propertyGroup;
|
|
827
1000
|
}
|
|
828
1001
|
/**
|
|
@@ -849,7 +1022,7 @@ class TestDataService {
|
|
|
849
1022
|
data: Object.assign({}, textPropertyGroup, overrides)
|
|
850
1023
|
});
|
|
851
1024
|
const { data: propertyGroup } = await propertyGroupResponse.json();
|
|
852
|
-
this.addCreatedRecord("
|
|
1025
|
+
this.addCreatedRecord("property_group", propertyGroup.id);
|
|
853
1026
|
return propertyGroup;
|
|
854
1027
|
}
|
|
855
1028
|
/**
|
|
@@ -1190,10 +1363,18 @@ class TestDataService {
|
|
|
1190
1363
|
* All entities added to the registry will be deleted by the cleanup call.
|
|
1191
1364
|
*
|
|
1192
1365
|
* @param resource - The resource name of the entity.
|
|
1193
|
-
* @param
|
|
1366
|
+
* @param payload - You can pass a payload object for the delete operation or simply pass the uuid of the entity.
|
|
1194
1367
|
*/
|
|
1195
|
-
addCreatedRecord(resource,
|
|
1196
|
-
|
|
1368
|
+
addCreatedRecord(resource, payload) {
|
|
1369
|
+
const res = resource.replace("-", "_");
|
|
1370
|
+
if (typeof payload === "string") {
|
|
1371
|
+
this.createdRecords.push({
|
|
1372
|
+
resource: res,
|
|
1373
|
+
payload: { id: payload }
|
|
1374
|
+
});
|
|
1375
|
+
} else {
|
|
1376
|
+
this.createdRecords.push({ resource: res, payload });
|
|
1377
|
+
}
|
|
1197
1378
|
}
|
|
1198
1379
|
/**
|
|
1199
1380
|
* Set the configuration of automated data clean up.
|
|
@@ -1211,16 +1392,31 @@ class TestDataService {
|
|
|
1211
1392
|
if (!this.shouldCleanUp) {
|
|
1212
1393
|
return Promise.reject();
|
|
1213
1394
|
}
|
|
1395
|
+
const priorityDeleteOperations = {};
|
|
1214
1396
|
const deleteOperations = {};
|
|
1215
1397
|
this.createdRecords.forEach((record) => {
|
|
1216
|
-
if (
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1398
|
+
if (this.highPriorityEntities.includes(record.resource)) {
|
|
1399
|
+
if (!priorityDeleteOperations[`delete-${record.resource}`]) {
|
|
1400
|
+
priorityDeleteOperations[`delete-${record.resource}`] = {
|
|
1401
|
+
entity: record.resource,
|
|
1402
|
+
action: "delete",
|
|
1403
|
+
payload: []
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
priorityDeleteOperations[`delete-${record.resource}`].payload.push(record.payload);
|
|
1407
|
+
} else {
|
|
1408
|
+
if (!deleteOperations[`delete-${record.resource}`]) {
|
|
1409
|
+
deleteOperations[`delete-${record.resource}`] = {
|
|
1410
|
+
entity: record.resource,
|
|
1411
|
+
action: "delete",
|
|
1412
|
+
payload: []
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
deleteOperations[`delete-${record.resource}`].payload.push(record.payload);
|
|
1222
1416
|
}
|
|
1223
|
-
|
|
1417
|
+
});
|
|
1418
|
+
await this.AdminApiClient.post("_action/sync", {
|
|
1419
|
+
data: priorityDeleteOperations
|
|
1224
1420
|
});
|
|
1225
1421
|
return await this.AdminApiClient.post("_action/sync", {
|
|
1226
1422
|
data: deleteOperations
|
|
@@ -1581,190 +1777,19 @@ class TestDataService {
|
|
|
1581
1777
|
}
|
|
1582
1778
|
}
|
|
1583
1779
|
|
|
1584
|
-
const test$
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
const options = {
|
|
1595
|
-
app_url: process.env["APP_URL"],
|
|
1596
|
-
"sw-access-key": DefaultSalesChannel.salesChannel.accessKey,
|
|
1597
|
-
ignoreHTTPSErrors: true
|
|
1598
|
-
};
|
|
1599
|
-
const storeApiContext = await StoreApiContext.create(options);
|
|
1600
|
-
await use(storeApiContext);
|
|
1601
|
-
},
|
|
1602
|
-
{ scope: "worker" }
|
|
1603
|
-
],
|
|
1604
|
-
TestDataService: [
|
|
1605
|
-
async ({ AdminApiContext: AdminApiContext2, IdProvider, DefaultSalesChannel, SalesChannelBaseConfig }, use) => {
|
|
1606
|
-
const DataService = new TestDataService(AdminApiContext2, IdProvider, {
|
|
1607
|
-
defaultSalesChannel: DefaultSalesChannel.salesChannel,
|
|
1608
|
-
defaultTaxId: SalesChannelBaseConfig.taxId,
|
|
1609
|
-
defaultCurrencyId: SalesChannelBaseConfig.defaultCurrencyId,
|
|
1610
|
-
defaultCategoryId: DefaultSalesChannel.salesChannel.navigationCategoryId,
|
|
1611
|
-
defaultLanguageId: DefaultSalesChannel.salesChannel.languageId,
|
|
1612
|
-
defaultCountryId: DefaultSalesChannel.salesChannel.countryId,
|
|
1613
|
-
defaultCustomerGroupId: DefaultSalesChannel.salesChannel.customerGroupId
|
|
1614
|
-
});
|
|
1615
|
-
await use(DataService);
|
|
1616
|
-
await DataService.cleanUp();
|
|
1617
|
-
},
|
|
1618
|
-
{ scope: "worker" }
|
|
1619
|
-
]
|
|
1620
|
-
});
|
|
1621
|
-
|
|
1622
|
-
async function mockApiCalls(page) {
|
|
1623
|
-
await page.route("**/api/notification/message*", (route) => route.fulfill({
|
|
1624
|
-
status: 200,
|
|
1625
|
-
contentType: "application/json",
|
|
1626
|
-
body: JSON.stringify({ notifications: [], timestamp: "2024-06-19 06:23:25.040" })
|
|
1627
|
-
}));
|
|
1628
|
-
await page.route("**/api/_action/store/plugin/search*", (route) => route.fulfill({
|
|
1629
|
-
status: 200,
|
|
1630
|
-
contentType: "application/json",
|
|
1631
|
-
body: JSON.stringify({ items: [], total: 0 })
|
|
1632
|
-
}));
|
|
1633
|
-
await page.route("**/api/_action/store/updates*", (route) => route.fulfill({
|
|
1634
|
-
status: 200,
|
|
1635
|
-
contentType: "application/json",
|
|
1636
|
-
body: JSON.stringify({ items: [], total: 0 })
|
|
1637
|
-
}));
|
|
1638
|
-
await page.route("**/api/sbp/shop-info*", (route) => route.fulfill({
|
|
1639
|
-
status: 200,
|
|
1640
|
-
contentType: "application/json",
|
|
1641
|
-
body: JSON.stringify({ items: [], total: 0 })
|
|
1642
|
-
}));
|
|
1643
|
-
await page.route("**/api/sbp/shop-info*", (route) => route.fulfill({
|
|
1644
|
-
status: 200,
|
|
1645
|
-
contentType: "application/json",
|
|
1646
|
-
body: process.env.SBP_SHOP_INFO_JSON ?? "{}"
|
|
1647
|
-
}));
|
|
1648
|
-
await page.route("**/api/sbp/bookableplans*", (route) => route.fulfill({
|
|
1649
|
-
status: 200,
|
|
1650
|
-
contentType: "application/json",
|
|
1651
|
-
body: process.env.SBP_BOOKABLE_PLANS_JSON ?? "{}"
|
|
1652
|
-
}));
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
const test$8 = test$c.extend({
|
|
1656
|
-
AdminPage: async ({ IdProvider, AdminApiContext, SalesChannelBaseConfig, browser }, use) => {
|
|
1657
|
-
const context = await browser.newContext({
|
|
1658
|
-
baseURL: SalesChannelBaseConfig.adminUrl,
|
|
1659
|
-
serviceWorkers: "block"
|
|
1660
|
-
});
|
|
1661
|
-
const page = await context.newPage();
|
|
1662
|
-
await mockApiCalls(page);
|
|
1663
|
-
const { id, uuid } = IdProvider.getIdPair();
|
|
1664
|
-
const adminUser = {
|
|
1665
|
-
id: uuid,
|
|
1666
|
-
username: `admin_${id}`,
|
|
1667
|
-
firstName: `${id} admin`,
|
|
1668
|
-
lastName: `${id} admin`,
|
|
1669
|
-
localeId: SalesChannelBaseConfig.enGBLocaleId,
|
|
1670
|
-
email: `admin_${id}@example.com`,
|
|
1671
|
-
timezone: "Europe/Berlin",
|
|
1672
|
-
password: "shopware",
|
|
1673
|
-
admin: true
|
|
1674
|
-
};
|
|
1675
|
-
const response = await AdminApiContext.post("user", {
|
|
1676
|
-
data: adminUser
|
|
1677
|
-
});
|
|
1678
|
-
expect(response.ok()).toBeTruthy();
|
|
1679
|
-
await page.goto("#/login");
|
|
1680
|
-
await page.addStyleTag({
|
|
1681
|
-
content: `
|
|
1682
|
-
.sf-toolbar {
|
|
1683
|
-
width: 0 !important;
|
|
1684
|
-
height: 0 !important;
|
|
1685
|
-
display: none !important;
|
|
1686
|
-
pointer-events: none !important;
|
|
1687
|
-
}
|
|
1688
|
-
`.trim()
|
|
1689
|
-
});
|
|
1690
|
-
await page.getByLabel(/Username|Email address/).fill(adminUser.username);
|
|
1691
|
-
await page.getByLabel("Password").fill(adminUser.password);
|
|
1692
|
-
await page.getByRole("button", { name: "Log in" }).click();
|
|
1693
|
-
await expect(page.locator("css=.sw-admin-menu__header-logo").first()).toBeVisible({
|
|
1694
|
-
timeout: 2e4
|
|
1695
|
-
});
|
|
1696
|
-
await expect(page.locator(".sw-skeleton")).toHaveCount(0, {
|
|
1697
|
-
timeout: 1e4
|
|
1698
|
-
});
|
|
1699
|
-
await expect(page.locator(".sw-loader")).toHaveCount(0, {
|
|
1700
|
-
timeout: 1e4
|
|
1701
|
-
});
|
|
1702
|
-
await use(page);
|
|
1703
|
-
await page.close();
|
|
1704
|
-
await context.close();
|
|
1705
|
-
const cleanupResponse = await AdminApiContext.delete(`user/${uuid}`);
|
|
1706
|
-
expect(cleanupResponse.ok()).toBeTruthy();
|
|
1707
|
-
},
|
|
1708
|
-
StorefrontPage: async ({ DefaultStorefront, browser }, use) => {
|
|
1709
|
-
const { url } = DefaultStorefront;
|
|
1710
|
-
const context = await browser.newContext({
|
|
1711
|
-
baseURL: url
|
|
1712
|
-
});
|
|
1713
|
-
const page = await context.newPage();
|
|
1714
|
-
await page.goto("./", { waitUntil: "load" });
|
|
1715
|
-
await use(page);
|
|
1716
|
-
await page.close();
|
|
1717
|
-
await context.close();
|
|
1718
|
-
}
|
|
1719
|
-
});
|
|
1720
|
-
|
|
1721
|
-
var __defProp$p = Object.defineProperty;
|
|
1722
|
-
var __defNormalProp$p = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1723
|
-
var __publicField$p = (obj, key, value) => {
|
|
1724
|
-
__defNormalProp$p(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1725
|
-
return value;
|
|
1726
|
-
};
|
|
1727
|
-
class Actor {
|
|
1728
|
-
constructor(name, page) {
|
|
1729
|
-
__publicField$p(this, "page");
|
|
1730
|
-
__publicField$p(this, "name");
|
|
1731
|
-
__publicField$p(this, "expects", expect);
|
|
1732
|
-
this.name = name;
|
|
1733
|
-
this.page = page;
|
|
1734
|
-
}
|
|
1735
|
-
async attemptsTo(task) {
|
|
1736
|
-
const stepTitle = `${this.name} attempts to ${this.camelCaseToLowerCase(task.name)}`;
|
|
1737
|
-
await test$c.step(stepTitle, async () => await task());
|
|
1738
|
-
}
|
|
1739
|
-
async goesTo(url) {
|
|
1740
|
-
const stepTitle = `${this.name} navigates to "${url}"`;
|
|
1741
|
-
await test$c.step(stepTitle, async () => {
|
|
1742
|
-
await this.page.goto(url);
|
|
1743
|
-
await this.page.addStyleTag({
|
|
1744
|
-
content: `
|
|
1745
|
-
.sf-toolbar {
|
|
1746
|
-
width: 0 !important;
|
|
1747
|
-
height: 0 !important;
|
|
1748
|
-
display: none !important;
|
|
1749
|
-
pointer-events: none !important;
|
|
1750
|
-
}
|
|
1751
|
-
`.trim()
|
|
1752
|
-
});
|
|
1780
|
+
const test$7 = test$d.extend({
|
|
1781
|
+
TestDataService: async ({ AdminApiContext, IdProvider, DefaultSalesChannel, SalesChannelBaseConfig }, use) => {
|
|
1782
|
+
const DataService = new TestDataService(AdminApiContext, IdProvider, {
|
|
1783
|
+
defaultSalesChannel: DefaultSalesChannel.salesChannel,
|
|
1784
|
+
defaultTaxId: SalesChannelBaseConfig.taxId,
|
|
1785
|
+
defaultCurrencyId: SalesChannelBaseConfig.defaultCurrencyId,
|
|
1786
|
+
defaultCategoryId: DefaultSalesChannel.salesChannel.navigationCategoryId,
|
|
1787
|
+
defaultLanguageId: DefaultSalesChannel.salesChannel.languageId,
|
|
1788
|
+
defaultCountryId: DefaultSalesChannel.salesChannel.countryId,
|
|
1789
|
+
defaultCustomerGroupId: DefaultSalesChannel.salesChannel.customerGroupId
|
|
1753
1790
|
});
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
return str.replace(/[A-Z]/g, (letter) => ` ${letter.toLowerCase()}`);
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
|
|
1760
|
-
const test$7 = test$c.extend({
|
|
1761
|
-
ShopCustomer: async ({ StorefrontPage }, use) => {
|
|
1762
|
-
const shopCustomer = new Actor("Shop customer", StorefrontPage);
|
|
1763
|
-
await use(shopCustomer);
|
|
1764
|
-
},
|
|
1765
|
-
ShopAdmin: async ({ AdminPage }, use) => {
|
|
1766
|
-
const shopAdmin = new Actor("Shop administrator", AdminPage);
|
|
1767
|
-
await use(shopAdmin);
|
|
1791
|
+
await use(DataService);
|
|
1792
|
+
await DataService.cleanUp();
|
|
1768
1793
|
}
|
|
1769
1794
|
});
|
|
1770
1795
|
|
|
@@ -1806,7 +1831,7 @@ class IdProvider {
|
|
|
1806
1831
|
}
|
|
1807
1832
|
}
|
|
1808
1833
|
|
|
1809
|
-
const test$6 = test$
|
|
1834
|
+
const test$6 = test$d.extend({
|
|
1810
1835
|
IdProvider: [
|
|
1811
1836
|
async ({}, use, workerInfo) => {
|
|
1812
1837
|
const seed = process.env.SHOPWARE_ACCESS_KEY_ID || process.env.SHOPWARE_ADMIN_PASSWORD || "test-suite";
|
|
@@ -1816,15 +1841,14 @@ const test$6 = test$c.extend({
|
|
|
1816
1841
|
{ scope: "worker" }
|
|
1817
1842
|
],
|
|
1818
1843
|
SaaSInstanceSetup: [
|
|
1819
|
-
async ({ AdminApiContext
|
|
1820
|
-
const SetupInstance = async function SetupInstance2() {
|
|
1844
|
+
async ({ AdminApiContext }, use) => {
|
|
1845
|
+
const SetupInstance = async function SetupInstance2(page) {
|
|
1821
1846
|
await test$6.skip(!await isSaaSInstance(AdminApiContext), "Skipping SaaS setup, could not detect SaaS instance");
|
|
1822
1847
|
const instanceStatusResponse = await AdminApiContext.get("./instance/status");
|
|
1823
1848
|
const instanceStatus = await instanceStatusResponse.json();
|
|
1824
1849
|
await expect(instanceStatus.tags, 'expect instance to have "ci" tag').toContain("ci");
|
|
1825
1850
|
await test$6.skip((await AdminApiContext.get(`${process.env.APP_URL}constructionmode`, { maxRedirects: 0 })).status() > 204, "Instance already setup");
|
|
1826
|
-
|
|
1827
|
-
await page.goto("./set-up-shop");
|
|
1851
|
+
await page.goto(`${process.env.ADMIN_URL}set-up-shop`);
|
|
1828
1852
|
await page.getByRole("button", { name: "Next" }).click();
|
|
1829
1853
|
await expect(page.getByRole("heading", { name: "Everything finished!" })).toBeVisible();
|
|
1830
1854
|
await page.getByRole("button", { name: "Open your shop" }).click();
|
|
@@ -1833,6 +1857,7 @@ const test$6 = test$c.extend({
|
|
|
1833
1857
|
await page.getByLabel("Password").fill(AdminApiContext.options.admin_password ?? "shopware");
|
|
1834
1858
|
await page.getByRole("button", { name: "Log in" }).click();
|
|
1835
1859
|
await page.getByRole("button", { name: "Launch your business" }).click();
|
|
1860
|
+
await expect(page.getByRole("button", { name: "Launch your business" })).toBeHidden();
|
|
1836
1861
|
};
|
|
1837
1862
|
await use(SetupInstance);
|
|
1838
1863
|
},
|
|
@@ -2291,7 +2316,7 @@ const StorefrontPageObjects = {
|
|
|
2291
2316
|
Search,
|
|
2292
2317
|
SearchSuggest
|
|
2293
2318
|
};
|
|
2294
|
-
const test$5 = test$
|
|
2319
|
+
const test$5 = test$d.extend({
|
|
2295
2320
|
StorefrontHome: async ({ StorefrontPage }, use) => {
|
|
2296
2321
|
await use(new Home(StorefrontPage));
|
|
2297
2322
|
},
|
|
@@ -2684,7 +2709,7 @@ const AdminPageObjects = {
|
|
|
2684
2709
|
Dashboard,
|
|
2685
2710
|
DataSharing
|
|
2686
2711
|
};
|
|
2687
|
-
const test$4 = test$
|
|
2712
|
+
const test$4 = test$d.extend({
|
|
2688
2713
|
AdminProductDetail: async ({ AdminPage }, use) => {
|
|
2689
2714
|
await use(new ProductDetail(AdminPage));
|
|
2690
2715
|
},
|
|
@@ -2714,7 +2739,7 @@ const test$4 = test$c.extend({
|
|
|
2714
2739
|
}
|
|
2715
2740
|
});
|
|
2716
2741
|
|
|
2717
|
-
const ProductData = test$
|
|
2742
|
+
const ProductData = test$d.extend({
|
|
2718
2743
|
ProductData: async ({ IdProvider, SalesChannelBaseConfig, AdminApiContext, DefaultSalesChannel }, use) => {
|
|
2719
2744
|
const { id: productId, uuid: productUuid } = IdProvider.getIdPair();
|
|
2720
2745
|
const productName = `Product_test_${productId}`;
|
|
@@ -2775,7 +2800,7 @@ const ProductData = test$c.extend({
|
|
|
2775
2800
|
}
|
|
2776
2801
|
});
|
|
2777
2802
|
|
|
2778
|
-
const CategoryData = test$
|
|
2803
|
+
const CategoryData = test$d.extend({
|
|
2779
2804
|
CategoryData: async ({ IdProvider, AdminApiContext, DefaultSalesChannel, ProductData }, use) => {
|
|
2780
2805
|
const { id: categoryId, uuid: categoryUuid } = IdProvider.getIdPair();
|
|
2781
2806
|
const categoryName = `Category-${categoryId}`;
|
|
@@ -2802,7 +2827,7 @@ const CategoryData = test$c.extend({
|
|
|
2802
2827
|
}
|
|
2803
2828
|
});
|
|
2804
2829
|
|
|
2805
|
-
const DigitalProductData = test$
|
|
2830
|
+
const DigitalProductData = test$d.extend({
|
|
2806
2831
|
DigitalProductData: async ({ ProductData, IdProvider, AdminApiContext }, use) => {
|
|
2807
2832
|
const newMediaResource = await AdminApiContext.post("./media?_response", {
|
|
2808
2833
|
data: {
|
|
@@ -2857,7 +2882,7 @@ const DigitalProductData = test$c.extend({
|
|
|
2857
2882
|
}
|
|
2858
2883
|
});
|
|
2859
2884
|
|
|
2860
|
-
const PropertiesData = test$
|
|
2885
|
+
const PropertiesData = test$d.extend({
|
|
2861
2886
|
PropertiesData: async ({ AdminApiContext }, use) => {
|
|
2862
2887
|
const propertyGroupColorResponse = await AdminApiContext.post("property-group?_response=1", {
|
|
2863
2888
|
data: {
|
|
@@ -2907,7 +2932,7 @@ const PropertiesData = test$c.extend({
|
|
|
2907
2932
|
}
|
|
2908
2933
|
});
|
|
2909
2934
|
|
|
2910
|
-
const CartWithProductData = test$
|
|
2935
|
+
const CartWithProductData = test$d.extend({
|
|
2911
2936
|
CartWithProductData: async ({ StoreApiContext, DefaultSalesChannel, ProductData }, use) => {
|
|
2912
2937
|
await StoreApiContext.login(DefaultSalesChannel.customer);
|
|
2913
2938
|
const cartResponse = await StoreApiContext.post("checkout/cart", {
|
|
@@ -2933,7 +2958,7 @@ const CartWithProductData = test$c.extend({
|
|
|
2933
2958
|
}
|
|
2934
2959
|
});
|
|
2935
2960
|
|
|
2936
|
-
const PromotionWithCodeData = test$
|
|
2961
|
+
const PromotionWithCodeData = test$d.extend({
|
|
2937
2962
|
PromotionWithCodeData: async ({ AdminApiContext, DefaultSalesChannel, IdProvider }, use) => {
|
|
2938
2963
|
const promotionCode = `${IdProvider.getIdPair().id}`;
|
|
2939
2964
|
const promotionName = `Test Promotion ${promotionCode}`;
|
|
@@ -2975,7 +3000,7 @@ const PromotionWithCodeData = test$c.extend({
|
|
|
2975
3000
|
}
|
|
2976
3001
|
});
|
|
2977
3002
|
|
|
2978
|
-
const MediaData = test$
|
|
3003
|
+
const MediaData = test$d.extend({
|
|
2979
3004
|
MediaData: async ({ AdminApiContext, IdProvider }, use) => {
|
|
2980
3005
|
const imageId = IdProvider.getIdPair().id;
|
|
2981
3006
|
const imageFilePath = `./tmp/image-${imageId}.png`;
|
|
@@ -3022,7 +3047,7 @@ const MediaData = test$c.extend({
|
|
|
3022
3047
|
}
|
|
3023
3048
|
});
|
|
3024
3049
|
|
|
3025
|
-
const OrderData = test$
|
|
3050
|
+
const OrderData = test$d.extend({
|
|
3026
3051
|
OrderData: async ({ IdProvider, AdminApiContext, SalesChannelBaseConfig, DefaultSalesChannel, ProductData }, use) => {
|
|
3027
3052
|
const requests = {
|
|
3028
3053
|
currencyEUR: getCurrency("EUR", AdminApiContext),
|
|
@@ -3239,7 +3264,7 @@ const OrderData = test$c.extend({
|
|
|
3239
3264
|
}
|
|
3240
3265
|
});
|
|
3241
3266
|
|
|
3242
|
-
const TagData = test$
|
|
3267
|
+
const TagData = test$d.extend({
|
|
3243
3268
|
TagData: async ({ IdProvider, AdminApiContext }, use) => {
|
|
3244
3269
|
const tagUUID = IdProvider.getIdPair().uuid;
|
|
3245
3270
|
const tagId = IdProvider.getIdPair().id;
|
|
@@ -3270,7 +3295,7 @@ const test$3 = mergeTests(
|
|
|
3270
3295
|
TagData
|
|
3271
3296
|
);
|
|
3272
3297
|
|
|
3273
|
-
const SaveProduct = test$
|
|
3298
|
+
const SaveProduct = test$d.extend({
|
|
3274
3299
|
SaveProduct: async ({ ShopAdmin, AdminProductDetail }, use) => {
|
|
3275
3300
|
const task = () => {
|
|
3276
3301
|
return async function SaveProduct2() {
|
|
@@ -3292,7 +3317,7 @@ const test$2 = mergeTests(
|
|
|
3292
3317
|
SaveProduct
|
|
3293
3318
|
);
|
|
3294
3319
|
|
|
3295
|
-
const Login = test$
|
|
3320
|
+
const Login = test$d.extend({
|
|
3296
3321
|
Login: async ({ ShopCustomer, DefaultSalesChannel, StorefrontAccountLogin, StorefrontAccount }, use) => {
|
|
3297
3322
|
const task = () => {
|
|
3298
3323
|
return async function Login2() {
|
|
@@ -3308,7 +3333,7 @@ const Login = test$c.extend({
|
|
|
3308
3333
|
}
|
|
3309
3334
|
});
|
|
3310
3335
|
|
|
3311
|
-
const Logout = test$
|
|
3336
|
+
const Logout = test$d.extend({
|
|
3312
3337
|
Logout: async ({ ShopCustomer, StorefrontAccountLogin }, use) => {
|
|
3313
3338
|
const task = () => {
|
|
3314
3339
|
return async function Logout2() {
|
|
@@ -3322,7 +3347,7 @@ const Logout = test$c.extend({
|
|
|
3322
3347
|
}
|
|
3323
3348
|
});
|
|
3324
3349
|
|
|
3325
|
-
const Register = test$
|
|
3350
|
+
const Register = test$d.extend({
|
|
3326
3351
|
Register: async ({ StorefrontAccountLogin, AdminApiContext }, use) => {
|
|
3327
3352
|
const registrationData = {
|
|
3328
3353
|
firstName: "Jeff",
|
|
@@ -3365,7 +3390,7 @@ const Register = test$c.extend({
|
|
|
3365
3390
|
}
|
|
3366
3391
|
});
|
|
3367
3392
|
|
|
3368
|
-
const AddProductToCart = test$
|
|
3393
|
+
const AddProductToCart = test$d.extend({
|
|
3369
3394
|
AddProductToCart: async ({ ShopCustomer, StorefrontProductDetail }, use) => {
|
|
3370
3395
|
const task = (ProductData, quantity = "1") => {
|
|
3371
3396
|
return async function AddProductToCart2() {
|
|
@@ -3379,7 +3404,7 @@ const AddProductToCart = test$c.extend({
|
|
|
3379
3404
|
}
|
|
3380
3405
|
});
|
|
3381
3406
|
|
|
3382
|
-
const ProceedFromProductToCheckout = test$
|
|
3407
|
+
const ProceedFromProductToCheckout = test$d.extend({
|
|
3383
3408
|
ProceedFromProductToCheckout: async ({ ShopCustomer, StorefrontProductDetail, StorefrontCheckoutConfirm }, use) => {
|
|
3384
3409
|
const task = () => {
|
|
3385
3410
|
return async function ProceedFromProductToCheckout2() {
|
|
@@ -3391,7 +3416,7 @@ const ProceedFromProductToCheckout = test$c.extend({
|
|
|
3391
3416
|
}
|
|
3392
3417
|
});
|
|
3393
3418
|
|
|
3394
|
-
const ProceedFromCartToCheckout = test$
|
|
3419
|
+
const ProceedFromCartToCheckout = test$d.extend({
|
|
3395
3420
|
ProceedFromCartToCheckout: async ({
|
|
3396
3421
|
ShopCustomer,
|
|
3397
3422
|
StorefrontCheckoutCart,
|
|
@@ -3407,7 +3432,7 @@ const ProceedFromCartToCheckout = test$c.extend({
|
|
|
3407
3432
|
}
|
|
3408
3433
|
});
|
|
3409
3434
|
|
|
3410
|
-
const ConfirmTermsAndConditions = test$
|
|
3435
|
+
const ConfirmTermsAndConditions = test$d.extend({
|
|
3411
3436
|
ConfirmTermsAndConditions: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
3412
3437
|
const task = () => {
|
|
3413
3438
|
return async function ConfirmTermsAndConditions2() {
|
|
@@ -3419,7 +3444,7 @@ const ConfirmTermsAndConditions = test$c.extend({
|
|
|
3419
3444
|
}
|
|
3420
3445
|
});
|
|
3421
3446
|
|
|
3422
|
-
const SelectCashOnDeliveryPaymentOption = test$
|
|
3447
|
+
const SelectCashOnDeliveryPaymentOption = test$d.extend({
|
|
3423
3448
|
SelectCashOnDeliveryPaymentOption: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
3424
3449
|
const task = () => {
|
|
3425
3450
|
return async function SelectCashOnDeliveryPaymentOption2() {
|
|
@@ -3431,7 +3456,7 @@ const SelectCashOnDeliveryPaymentOption = test$c.extend({
|
|
|
3431
3456
|
}
|
|
3432
3457
|
});
|
|
3433
3458
|
|
|
3434
|
-
const SelectInvoicePaymentOption = test$
|
|
3459
|
+
const SelectInvoicePaymentOption = test$d.extend({
|
|
3435
3460
|
SelectInvoicePaymentOption: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
3436
3461
|
const task = () => {
|
|
3437
3462
|
return async function SelectInvoicePaymentOption2() {
|
|
@@ -3443,7 +3468,7 @@ const SelectInvoicePaymentOption = test$c.extend({
|
|
|
3443
3468
|
}
|
|
3444
3469
|
});
|
|
3445
3470
|
|
|
3446
|
-
const SelectPaidInAdvancePaymentOption = test$
|
|
3471
|
+
const SelectPaidInAdvancePaymentOption = test$d.extend({
|
|
3447
3472
|
SelectPaidInAdvancePaymentOption: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
3448
3473
|
const task = () => {
|
|
3449
3474
|
return async function SelectPaidInAdvancePaymentOption2() {
|
|
@@ -3455,7 +3480,7 @@ const SelectPaidInAdvancePaymentOption = test$c.extend({
|
|
|
3455
3480
|
}
|
|
3456
3481
|
});
|
|
3457
3482
|
|
|
3458
|
-
const SelectStandardShippingOption = test$
|
|
3483
|
+
const SelectStandardShippingOption = test$d.extend({
|
|
3459
3484
|
SelectStandardShippingOption: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
3460
3485
|
const task = () => {
|
|
3461
3486
|
return async function SelectStandardShippingOption2() {
|
|
@@ -3467,7 +3492,7 @@ const SelectStandardShippingOption = test$c.extend({
|
|
|
3467
3492
|
}
|
|
3468
3493
|
});
|
|
3469
3494
|
|
|
3470
|
-
const SelectExpressShippingOption = test$
|
|
3495
|
+
const SelectExpressShippingOption = test$d.extend({
|
|
3471
3496
|
SelectExpressShippingOption: async ({ ShopCustomer, StorefrontCheckoutConfirm }, use) => {
|
|
3472
3497
|
const task = () => {
|
|
3473
3498
|
return async function SelectExpressShippingOption2() {
|
|
@@ -3479,7 +3504,7 @@ const SelectExpressShippingOption = test$c.extend({
|
|
|
3479
3504
|
}
|
|
3480
3505
|
});
|
|
3481
3506
|
|
|
3482
|
-
const SubmitOrder = test$
|
|
3507
|
+
const SubmitOrder = test$d.extend({
|
|
3483
3508
|
SubmitOrder: async ({ ShopCustomer, StorefrontCheckoutConfirm, StorefrontCheckoutFinish }, use) => {
|
|
3484
3509
|
const task = () => {
|
|
3485
3510
|
return async function SubmitOrder2() {
|
|
@@ -3491,7 +3516,7 @@ const SubmitOrder = test$c.extend({
|
|
|
3491
3516
|
}
|
|
3492
3517
|
});
|
|
3493
3518
|
|
|
3494
|
-
const OpenSearchResultPage = test$
|
|
3519
|
+
const OpenSearchResultPage = test$d.extend({
|
|
3495
3520
|
OpenSearchResultPage: async ({ StorefrontSearch }, use) => {
|
|
3496
3521
|
const task = (searchTerm) => {
|
|
3497
3522
|
return async function OpenSearchResultPage2() {
|
|
@@ -3503,7 +3528,7 @@ const OpenSearchResultPage = test$c.extend({
|
|
|
3503
3528
|
}
|
|
3504
3529
|
});
|
|
3505
3530
|
|
|
3506
|
-
const OpenSearchSuggestPage = test$
|
|
3531
|
+
const OpenSearchSuggestPage = test$d.extend({
|
|
3507
3532
|
OpenSearchSuggestPage: async ({ StorefrontSearchSuggest }, use) => {
|
|
3508
3533
|
const task = (searchTerm) => {
|
|
3509
3534
|
return async function OpenSearchSuggestPage2() {
|
|
@@ -3515,7 +3540,7 @@ const OpenSearchSuggestPage = test$c.extend({
|
|
|
3515
3540
|
}
|
|
3516
3541
|
});
|
|
3517
3542
|
|
|
3518
|
-
const ValidateAccessibility = test$
|
|
3543
|
+
const ValidateAccessibility = test$d.extend({
|
|
3519
3544
|
ValidateAccessibility: async ({ ShopCustomer }, use) => {
|
|
3520
3545
|
const task = (pageName, assertViolations = true, createReport = true, ruleTags = ["wcag2a", "wcag2aa", "wcag2aaa", "wcag21a", "wcag21aa", "best-practice"], outputDir = "test-results/AccessibilityReports") => {
|
|
3521
3546
|
return async function ValidateAccessibility2() {
|
|
@@ -3561,6 +3586,7 @@ const test$1 = mergeTests(
|
|
|
3561
3586
|
|
|
3562
3587
|
const test = mergeTests(
|
|
3563
3588
|
test$6,
|
|
3589
|
+
test$b,
|
|
3564
3590
|
test$a,
|
|
3565
3591
|
test$9,
|
|
3566
3592
|
test$8,
|