@shopware-ag/acceptance-test-suite 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,26 +1,10 @@
1
1
  import * as _playwright_test from '@playwright/test';
2
2
  import { APIRequestContext, APIResponse, Page, Locator } from '@playwright/test';
3
3
  export * from '@playwright/test';
4
+ import * as playwright_core from 'playwright-core';
4
5
  import { components } from '@shopware/api-client/admin-api-types';
5
6
  import { Image } from 'image-js';
6
7
 
7
- interface IdPair {
8
- id: string;
9
- uuid: string;
10
- }
11
- declare class IdProvider {
12
- private readonly workerIndex;
13
- private readonly seed;
14
- constructor(workerIndex: number, seed: string);
15
- getIdPair(): IdPair;
16
- getUniqueName(): string;
17
- getWorkerDerivedStableId(key: string): IdPair;
18
- }
19
-
20
- interface HelperFixtureTypes {
21
- IdProvider: IdProvider;
22
- }
23
-
24
8
  type Task = (...args: any[]) => () => Promise<void>;
25
9
 
26
10
  interface RequestOptions$1<PAYLOAD> {
@@ -37,8 +21,8 @@ interface AdminApiContextOptions {
37
21
  ignoreHTTPSErrors?: boolean;
38
22
  }
39
23
  declare class AdminApiContext {
40
- private context;
41
- private readonly options;
24
+ context: APIRequestContext;
25
+ readonly options: AdminApiContextOptions;
42
26
  private static readonly defaultOptions;
43
27
  constructor(context: APIRequestContext, options: AdminApiContextOptions);
44
28
  static create(options?: AdminApiContextOptions): Promise<AdminApiContext>;
@@ -86,9 +70,412 @@ declare class StoreApiContext {
86
70
  head<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
87
71
  }
88
72
 
73
+ interface IdPair {
74
+ id: string;
75
+ uuid: string;
76
+ }
77
+ declare class IdProvider {
78
+ private readonly workerIndex;
79
+ private readonly seed;
80
+ constructor(workerIndex: number, seed: string);
81
+ getIdPair(): IdPair;
82
+ getUniqueName(): string;
83
+ getWorkerDerivedStableId(key: string): IdPair;
84
+ }
85
+
86
+ type SalesChannel = components['schemas']['SalesChannel'] & {
87
+ id: string;
88
+ };
89
+ type Customer = components['schemas']['Customer'] & {
90
+ id: string;
91
+ password: string;
92
+ };
93
+ type CustomerAddress = components['schemas']['CustomerAddress'] & {
94
+ id: string;
95
+ };
96
+ type Salutation = components['schemas']['Salutation'] & {
97
+ id: string;
98
+ };
99
+ interface Price {
100
+ gross: number;
101
+ net: number;
102
+ linked: boolean;
103
+ currencyId: string;
104
+ }
105
+ interface ProductPrice {
106
+ productId?: string;
107
+ ruleId: string;
108
+ price: Price[];
109
+ quantityStart: number;
110
+ quantityEnd: number;
111
+ }
112
+ type Product = Omit<components['schemas']['Product'], 'price' | 'prices'> & {
113
+ id: string;
114
+ price: Price[];
115
+ prices?: ProductPrice[];
116
+ translated: {
117
+ name: string;
118
+ };
119
+ };
120
+ type PropertyGroup = components['schemas']['PropertyGroup'] & {
121
+ id: string;
122
+ };
123
+ type Category$1 = components['schemas']['Category'] & {
124
+ id: string;
125
+ };
126
+ type Media = components['schemas']['Media'] & {
127
+ id: string;
128
+ };
129
+ type Tag = components['schemas']['Tag'] & {
130
+ id: string;
131
+ };
132
+ type Rule = components['schemas']['Rule'] & {
133
+ id: string;
134
+ };
135
+ type Currency = components['schemas']['Currency'] & {
136
+ id: string;
137
+ };
138
+ type Order = components['schemas']['Order'] & {
139
+ id: string;
140
+ orderCustomer: {
141
+ firstName: string;
142
+ lastName: string;
143
+ email: string;
144
+ };
145
+ };
146
+ type ShippingMethod = components['schemas']['ShippingMethod'] & {
147
+ id: string;
148
+ };
149
+ type PaymentMethod = components['schemas']['PaymentMethod'] & {
150
+ id: string;
151
+ };
152
+ type StateMachine = components['schemas']['StateMachine'] & {
153
+ id: string;
154
+ };
155
+ type StateMachineState = components['schemas']['StateMachineState'] & {
156
+ id: string;
157
+ };
158
+ type Promotion = components['schemas']['Promotion'] & {
159
+ id: string;
160
+ };
161
+
162
+ interface CreatedRecord {
163
+ resource: string;
164
+ id: string;
165
+ }
166
+ interface SimpleLineItem {
167
+ product: Product;
168
+ quantity?: number;
169
+ position?: number;
170
+ }
171
+ interface SyncApiOperation {
172
+ entity: string;
173
+ action: 'upsert' | 'delete';
174
+ payload: Record<string, unknown>[];
175
+ }
176
+ interface DataServiceOptions {
177
+ namePrefix?: string;
178
+ nameSuffix?: string;
179
+ defaultSalesChannel: SalesChannel;
180
+ defaultTaxId: string;
181
+ defaultCurrencyId: string;
182
+ defaultCategoryId: string;
183
+ defaultLanguageId: string;
184
+ defaultCountryId: string;
185
+ defaultCustomerGroupId: string;
186
+ }
187
+ declare class TestDataService {
188
+ readonly AdminApiClient: AdminApiContext;
189
+ readonly IdProvider: IdProvider;
190
+ readonly namePrefix: string;
191
+ readonly nameSuffix: string;
192
+ readonly defaultSalesChannel: SalesChannel;
193
+ readonly defaultTaxId: string;
194
+ readonly defaultCurrencyId: string;
195
+ readonly defaultCategoryId: string;
196
+ readonly defaultLanguageId: string;
197
+ readonly defaultCountryId: string;
198
+ readonly defaultCustomerGroupId: string;
199
+ private shouldCleanUp;
200
+ private createdRecords;
201
+ constructor(AdminApiClient: AdminApiContext, IdProvider: IdProvider, options: DataServiceOptions);
202
+ /**
203
+ * Creates a basic product without images or other special configuration.
204
+ * The product will be added to the default sales channel category if configured.
205
+ *
206
+ * @param overrides - Specific data overrides that will be applied to the product data struct.
207
+ * @param taxId - The uuid of the tax rule to use for the product pricing.
208
+ * @param currencyId - The uuid of the currency to use for the product pricing.
209
+ */
210
+ createBasicProduct(overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
211
+ /**
212
+ * Creates a basic product with one randomly generated image.
213
+ * The product will be added to the default sales channel category if configured.
214
+ *
215
+ * @param overrides - Specific data overrides that will be applied to the product data struct.
216
+ * @param taxId - The uuid of the tax rule to use for the product pricing.
217
+ * @param currencyId - The uuid of the currency to use for the product pricing.
218
+ */
219
+ createProductWithImage(overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
220
+ /**
221
+ * Creates a digital product with a text file as its download.
222
+ * The product will be added to the default sales channel category if configured.
223
+ *
224
+ * @param content - The content of the text file for the product download.
225
+ * @param overrides - Specific data overrides that will be applied to the product data struct.
226
+ * @param taxId - The uuid of the tax rule to use for the product pricing.
227
+ * @param currencyId - The uuid of the currency to use for the product pricing.
228
+ */
229
+ createDigitalProduct(content?: string, overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
230
+ /**
231
+ * Creates a basic product with a price range matrix.
232
+ * The product will be added to the default sales channel category if configured.
233
+ *
234
+ * @param overrides - Specific data overrides that will be applied to the product data struct.
235
+ * @param taxId - The uuid of the tax rule to use for the product pricing.
236
+ * @param currencyId - The uuid of the currency to use for the product pricing.
237
+ */
238
+ createProductWithPriceRange(overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
239
+ /**
240
+ * Creates a basic product category to assign products to.
241
+ *
242
+ * @param parentId - The uuid of the parent category.
243
+ * @param overrides - Specific data overrides that will be applied to the category data struct.
244
+ */
245
+ createCategory(overrides?: Partial<Category$1>, parentId?: string): Promise<Category$1>;
246
+ /**
247
+ * Creates a new media resource containing a random generated PNG image.
248
+ *
249
+ * @param width - The width of the image in pixel. Default is 800.
250
+ * @param height - The height of the image in pixel. Default is 600.
251
+ */
252
+ createMediaPNG(width?: number, height?: number): Promise<Media>;
253
+ /**
254
+ * Creates a new media resource containing a text file.
255
+ *
256
+ * @param content - The content of the text file.
257
+ */
258
+ createMediaTXT(content?: string): Promise<Media>;
259
+ /**
260
+ * Creates a new empty media resource.
261
+ * This method is mostly used to combine it with a certain file upload.
262
+ */
263
+ createMediaResource(): Promise<Media>;
264
+ /**
265
+ * Creates a new property group with color type options.
266
+ *
267
+ * @param overrides - Specific data overrides that will be applied to the property group data struct.
268
+ */
269
+ createColorPropertyGroup(overrides?: Partial<PropertyGroup>): Promise<PropertyGroup>;
270
+ /**
271
+ * Creates a new property group with text type options.
272
+ *
273
+ * @param overrides - Specific data overrides that will be applied to the property group data struct.
274
+ */
275
+ createTextPropertyGroup(overrides?: Partial<PropertyGroup>): Promise<PropertyGroup>;
276
+ /**
277
+ * Creates a new tag which can be assigned to other entities.
278
+ *
279
+ * @param tagName - The name of the tag.
280
+ */
281
+ createTag(tagName: string): Promise<Tag>;
282
+ /**
283
+ * Creates a new shop customer.
284
+ *
285
+ * @param overrides - Specific data overrides that will be applied to the customer data struct.
286
+ * @param salutationKey - The key of the salutation that should be used for the customer. Default is "mr".
287
+ * @param salesChannel - The sales channel for which the customer should be registered.
288
+ */
289
+ createCustomer(overrides?: Partial<Customer>, salutationKey?: string, salesChannel?: SalesChannel): Promise<Customer>;
290
+ /**
291
+ * Creates a new order. This order is created on pure data and prices are not guaranteed to be calculated correctly.
292
+ *
293
+ * @param lineItems - Products that should be added to the order.
294
+ * @param customer - The customer to which the order should be assigned.
295
+ * @param salesChannel - The sales channel in which the order should be created.
296
+ * @param overrides - Specific data overrides that will be applied to the order data struct.
297
+ */
298
+ createOrder(lineItems: SimpleLineItem[], customer: Customer, overrides?: Partial<Order>, salesChannel?: SalesChannel): Promise<Order>;
299
+ /**
300
+ * Creates a new promotion with a promotion code.
301
+ *
302
+ * @param overrides - Specific data overrides that will be applied to the promotion data struct.
303
+ * @param salesChannelId - The uuid of the sales channel in which the promotion should be active.
304
+ */
305
+ createPromotionWithCode(overrides?: Partial<Promotion>, salesChannelId?: string): Promise<Promotion>;
306
+ /**
307
+ * Assigns a media resource as the download of a digital product.
308
+ *
309
+ * @param productId - The uuid of the product.
310
+ * @param mediaId - The uuid of the media resource.
311
+ */
312
+ assignProductDownload(productId: string, mediaId: string): Promise<any>;
313
+ /**
314
+ * Assigns a media resource to a product as the product image.
315
+ *
316
+ * @param productId - The uuid of the product.
317
+ * @param mediaId - The uuid of the media resource.
318
+ */
319
+ assignProductMedia(productId: string, mediaId: string): Promise<any>;
320
+ /**
321
+ * Assigns a product to a category.
322
+ *
323
+ * @param productId - The uuid of the product.
324
+ * @param categoryId - The uuid of the category.
325
+ */
326
+ assignProductCategory(productId: string, categoryId: string): Promise<playwright_core.APIResponse>;
327
+ /**
328
+ * Assigns a tag to a product.
329
+ *
330
+ * @param productId - The uuid of the product.
331
+ * @param tagId - The uuid of the tag.
332
+ */
333
+ assignProductTag(productId: string, tagId: string): Promise<playwright_core.APIResponse>;
334
+ /**
335
+ * Retrieves a currency based on its ISO code.
336
+ *
337
+ * @param isoCode - The ISO code of the currency, for example "EUR".
338
+ */
339
+ getCurrency(isoCode: string): Promise<Currency>;
340
+ /**
341
+ * Retrieves a rule based on its name.
342
+ *
343
+ * @param name - The name of the rule.
344
+ */
345
+ getRule(name: string): Promise<Rule>;
346
+ /**
347
+ * Retrieves a shipping method by its name.
348
+ *
349
+ * @param name - The name of the shipping method. Default is "Standard".
350
+ */
351
+ getShippingMethod(name?: string): Promise<ShippingMethod>;
352
+ /**
353
+ * Retrieves a payment method by its name.
354
+ *
355
+ * @param name - The name of the payment method. Default is "Invoice".
356
+ */
357
+ getPaymentMethod(name?: string): Promise<PaymentMethod>;
358
+ /**
359
+ * Retrieves the address of a customer by its uuid.
360
+ *
361
+ * @param addressId - The uuid of the customer address.
362
+ */
363
+ getCustomerAddress(addressId: string): Promise<CustomerAddress>;
364
+ /**
365
+ * Retrieves a customer salutations by its key.
366
+ *
367
+ * @param key - The key of the salutation. Default is "mr".
368
+ */
369
+ getSalutation(key?: string): Promise<any>;
370
+ /**
371
+ * Retrieves the state machine for order states.
372
+ */
373
+ getOrderStateMachine(): Promise<StateMachine>;
374
+ /**
375
+ * Retrieves the state machine for delivery states.
376
+ */
377
+ getDeliveryStateMachine(): Promise<StateMachine>;
378
+ /**
379
+ * Retrieves the state machine for transaction states.
380
+ */
381
+ getTransactionStateMachine(): Promise<StateMachine>;
382
+ /**
383
+ * Retrieves a state machine by its name.
384
+ *
385
+ * @param name - The name of the state machine.
386
+ */
387
+ getStateMachine(name: string): Promise<StateMachine>;
388
+ /**
389
+ * Retrieves the state of a state machine.
390
+ *
391
+ * @param stateMachineId - The uuid of the state machine.
392
+ * @param stateName - The name of the state. Default is "open".
393
+ */
394
+ getStateMachineState(stateMachineId: string, stateName?: 'open' | 'completed' | 'in_progress' | 'cancelled'): Promise<StateMachineState>;
395
+ /**
396
+ * Adds an entity reference to the registry of created records.
397
+ * All entities added to the registry will be deleted by the cleanup call.
398
+ *
399
+ * @param resource - The resource name of the entity.
400
+ * @param id - The uuid of the entity.
401
+ */
402
+ addCreatedRecord(resource: string, id: string): void;
403
+ /**
404
+ * Set the configuration of automated data clean up.
405
+ * If set to "true" the data service will delete all entities created by it.
406
+ *
407
+ * @param shouldCleanUp - The config setting for the automated data clean up. Default is "true".
408
+ */
409
+ setCleanUp(shouldCleanUp?: boolean): void;
410
+ /**
411
+ * Will delete all entities created by the data service via sync API.
412
+ */
413
+ cleanUp(): Promise<playwright_core.APIResponse>;
414
+ /**
415
+ * Convert a JS date object into a date-time compatible string.
416
+ *
417
+ * @param date - The JS date object from which the date-time should be retrieved.
418
+ */
419
+ convertDateTime(date: Date): string;
420
+ getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
421
+ getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
422
+ getBasicCategoryStruct(overrides?: Partial<Category$1>, parentId?: string): {
423
+ id: string;
424
+ name: string;
425
+ parentId: string | null;
426
+ displayNestedProducts: boolean;
427
+ type: string;
428
+ productAssignmentType: string;
429
+ visible: boolean;
430
+ active: boolean;
431
+ } & Partial<Category$1>;
432
+ getBasicCustomerStruct(salesChannelId: string, customerGroupId: string, languageId: string, countryId: string, defaultPaymentMethodId: string, salutationId: string, overrides?: Partial<Customer>): Partial<Customer>;
433
+ getBasicOrderStruct(lineItems: SimpleLineItem[], languageId: string, currency: Currency, paymentMethod: PaymentMethod, shippingMethod: ShippingMethod, orderState: StateMachineState, deliveryState: StateMachineState, transactionState: StateMachineState, customer: Customer, customerAddress: CustomerAddress, salesChannelId?: string, overrides?: Partial<Order>): Partial<Order>;
434
+ getBasicProductLineItemStruct(lineItem: SimpleLineItem): {
435
+ productId: string;
436
+ referencedId: string;
437
+ payload: {
438
+ productNumber: string;
439
+ };
440
+ identifier: string;
441
+ type: string;
442
+ label: string;
443
+ quantity: number;
444
+ position: number;
445
+ price: {
446
+ unitPrice: number;
447
+ totalPrice: number;
448
+ quantity: number | undefined;
449
+ calculatedTaxes: {
450
+ tax: number;
451
+ taxRate: number;
452
+ price: number;
453
+ }[];
454
+ taxRules: {
455
+ taxRate: number;
456
+ percentage: number;
457
+ }[];
458
+ };
459
+ priceDefinition: {
460
+ type: string;
461
+ price: number;
462
+ quantity: number;
463
+ taxRules: {
464
+ taxRate: number;
465
+ percentage: number;
466
+ }[];
467
+ listPrice: number;
468
+ isCalculated: boolean;
469
+ referencePriceDefinition: null;
470
+ };
471
+ };
472
+ getBasicPromotionStruct(salesChannelId?: string, overrides?: Partial<Promotion>): Partial<Promotion>;
473
+ }
474
+
89
475
  interface ApiContextTypes {
90
476
  AdminApiContext: AdminApiContext;
91
477
  StoreApiContext: StoreApiContext;
478
+ TestDataService: TestDataService;
92
479
  }
93
480
 
94
481
  interface PageContextTypes {
@@ -111,25 +498,10 @@ interface ActorFixtureTypes {
111
498
  ShopAdmin: Actor;
112
499
  }
113
500
 
114
- type Customer = components['schemas']['Customer'] & {
115
- id: string;
116
- password: string;
117
- };
118
- type Product = components['schemas']['Product'] & {
119
- id: string;
120
- price: {
121
- gross: number;
122
- net: number;
123
- linked: boolean;
124
- currencyId: string;
125
- }[];
126
- };
127
- type Category$1 = components['schemas']['Category'] & {
128
- id: string;
129
- };
130
- type Order = components['schemas']['Order'] & {
131
- id: string;
132
- };
501
+ interface HelperFixtureTypes {
502
+ IdProvider: IdProvider;
503
+ SaaSInstanceSetup: () => Promise<void>;
504
+ }
133
505
 
134
506
  interface StoreBaseConfig {
135
507
  storefrontTypeId: string;
@@ -149,6 +521,12 @@ interface StoreBaseConfig {
149
521
  interface DefaultSalesChannelTypes {
150
522
  SalesChannelBaseConfig: StoreBaseConfig;
151
523
  DefaultSalesChannel: {
524
+ salesChannel: SalesChannel;
525
+ customer: Customer;
526
+ url: string;
527
+ themeSeed: string | null;
528
+ };
529
+ DefaultStorefront: {
152
530
  salesChannel: components['schemas']['SalesChannel'];
153
531
  customer: Customer;
154
532
  url: string;
@@ -595,7 +973,7 @@ declare const getLanguageData: (languageCode: string, adminApiContext: AdminApiC
595
973
  localeId: string;
596
974
  }>;
597
975
  declare const getSnippetSetId: (languageCode: string, adminApiContext: AdminApiContext) => Promise<string>;
598
- declare const getCurrency: (isoCode: 'EUR', adminApiContext: AdminApiContext) => Promise<any>;
976
+ declare const getCurrency: (isoCode: string, adminApiContext: AdminApiContext) => Promise<any>;
599
977
  declare const getTaxId: (adminApiContext: AdminApiContext) => Promise<string>;
600
978
  declare const getPaymentMethodId: (adminApiContext: AdminApiContext, handlerId?: string) => Promise<string>;
601
979
  declare const getDefaultShippingMethodId: (adminApiContext: AdminApiContext) => Promise<string>;
@@ -651,6 +1029,6 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
651
1029
  OpenSearchSuggestPage: Task;
652
1030
  } & {
653
1031
  ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<void>;
654
- }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & HelperFixtureTypes & FixtureTypes>;
1032
+ }, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
655
1033
 
656
- export { AdminPageObjects, type FixtureTypes, type PageObject, StorefrontPageObjects, type Task, createRandomImage, extractIdFromUrl, getCountryId, getCurrency, getDefaultShippingMethodId, getFlowId, getLanguageData, getMediaId, getOrderTransactionId, getPaymentMethodId, getSalutationId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, isSaaSInstance, setOrderStatus, test };
1034
+ 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 };