@shopware-ag/acceptance-test-suite 2.3.11 → 2.5.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 +85 -2
- package/dist/index.d.ts +85 -2
- package/dist/index.mjs +204 -15
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as axe_core from 'axe-core';
|
|
1
2
|
import * as _playwright_test from '@playwright/test';
|
|
2
3
|
import { APIRequestContext, APIResponse, Page, Locator } from '@playwright/test';
|
|
3
4
|
export * from '@playwright/test';
|
|
@@ -70,9 +71,61 @@ declare class StoreApiContext {
|
|
|
70
71
|
head<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
interface Email {
|
|
75
|
+
fromName: string;
|
|
76
|
+
fromAddress: string;
|
|
77
|
+
toName: string;
|
|
78
|
+
toAddress: string;
|
|
79
|
+
subject: string;
|
|
80
|
+
emailId: string;
|
|
81
|
+
}
|
|
82
|
+
declare class MailpitApiContext {
|
|
83
|
+
context: APIRequestContext;
|
|
84
|
+
constructor(context: APIRequestContext);
|
|
85
|
+
/**
|
|
86
|
+
* Fetches email headers based on the recipient's email address.
|
|
87
|
+
* @param email - The email address of the recipient.
|
|
88
|
+
* @returns An Email object containing the email headers.
|
|
89
|
+
*/
|
|
90
|
+
getEmailHeaders(email: string): Promise<Email>;
|
|
91
|
+
/**
|
|
92
|
+
* Retrieves the body content of the latest email as an HTML string.
|
|
93
|
+
* @returns The HTML content of the latest email.
|
|
94
|
+
*/
|
|
95
|
+
getEmailBody(): Promise<string>;
|
|
96
|
+
/**
|
|
97
|
+
* Generates the full email content, combining headers and body.
|
|
98
|
+
* @param email - The email address to fetch headers for.
|
|
99
|
+
* @returns The full email content as a string.
|
|
100
|
+
*/
|
|
101
|
+
generateEmailContent(email: string): Promise<string>;
|
|
102
|
+
/**
|
|
103
|
+
* Retrieves the plain text content of the latest email.
|
|
104
|
+
* @returns The plain text content of the latest email.
|
|
105
|
+
*/
|
|
106
|
+
getRenderMessageTxt(): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Extracts the first URL found in the plain text content of the latest email.
|
|
109
|
+
* @returns The first URL found in the email content.
|
|
110
|
+
* @throws An error if no URL is found in the email content.
|
|
111
|
+
*/
|
|
112
|
+
getLinkFromMail(): Promise<string>;
|
|
113
|
+
/**
|
|
114
|
+
* Deletes a specific email by ID if provided, or deletes all emails if no ID is provided.
|
|
115
|
+
* @param emailId - The ID of the email to delete (optional).
|
|
116
|
+
*/
|
|
117
|
+
deleteMail(emailId?: string): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new EmailApiContext instance with the appropriate configuration.
|
|
120
|
+
* @returns A promise that resolves to an EmailApiContext instance.
|
|
121
|
+
*/
|
|
122
|
+
static create(baseURL: string): Promise<MailpitApiContext>;
|
|
123
|
+
}
|
|
124
|
+
|
|
73
125
|
interface ApiContextTypes {
|
|
74
126
|
AdminApiContext: AdminApiContext;
|
|
75
127
|
StoreApiContext: StoreApiContext;
|
|
128
|
+
MailpitApiContext: MailpitApiContext;
|
|
76
129
|
}
|
|
77
130
|
|
|
78
131
|
interface PageContextTypes {
|
|
@@ -142,6 +195,9 @@ type Product = Omit<components['schemas']['Product'], 'price' | 'prices'> & {
|
|
|
142
195
|
name: string;
|
|
143
196
|
};
|
|
144
197
|
};
|
|
198
|
+
type Manufacturer = components['schemas']['ProductManufacturer'] & {
|
|
199
|
+
id: string;
|
|
200
|
+
};
|
|
145
201
|
type PropertyGroup = components['schemas']['PropertyGroup'] & {
|
|
146
202
|
id: string;
|
|
147
203
|
};
|
|
@@ -286,6 +342,18 @@ declare class TestDataService {
|
|
|
286
342
|
* @param currencyId - The uuid of the currency to use for the product pricing.
|
|
287
343
|
*/
|
|
288
344
|
createProductWithPriceRange(overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
|
|
345
|
+
/**
|
|
346
|
+
* Creates a basic manufacturer without images or other special configuration.
|
|
347
|
+
*
|
|
348
|
+
* @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
|
|
349
|
+
*/
|
|
350
|
+
createBasicManufacturer(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
|
|
351
|
+
/**
|
|
352
|
+
* Creates a basic manufacturer with one randomly generated image.
|
|
353
|
+
*
|
|
354
|
+
* @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
|
|
355
|
+
*/
|
|
356
|
+
createManufacturerWithImage(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
|
|
289
357
|
/**
|
|
290
358
|
* Creates a basic product category to assign products to.
|
|
291
359
|
*
|
|
@@ -367,6 +435,20 @@ declare class TestDataService {
|
|
|
367
435
|
* @param mediaId - The uuid of the media resource.
|
|
368
436
|
*/
|
|
369
437
|
assignProductMedia(productId: string, mediaId: string): Promise<any>;
|
|
438
|
+
/**
|
|
439
|
+
* Assigns a media resource to a manufacturer as a logo.
|
|
440
|
+
*
|
|
441
|
+
* @param manufacturerId - The uuid of the manufacturer.
|
|
442
|
+
* @param mediaId - The uuid of the media resource.
|
|
443
|
+
*/
|
|
444
|
+
assignManufacturerMedia(manufacturerId: string, mediaId: string): Promise<any>;
|
|
445
|
+
/**
|
|
446
|
+
* Assigns a manufacturer to a product.
|
|
447
|
+
*
|
|
448
|
+
* @param manufacturerId - The uuid of the manufacturer.
|
|
449
|
+
* @param productId - The uuid of the product.
|
|
450
|
+
*/
|
|
451
|
+
assignManufacturerProduct(manufacturerId: string, productId: string): Promise<playwright_core.APIResponse>;
|
|
370
452
|
/**
|
|
371
453
|
* Assigns a product to a category.
|
|
372
454
|
*
|
|
@@ -469,6 +551,7 @@ declare class TestDataService {
|
|
|
469
551
|
convertDateTime(date: Date): string;
|
|
470
552
|
getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
|
|
471
553
|
getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
|
|
554
|
+
getBasicManufacturerStruct(overrides?: Partial<Manufacturer>): Partial<Manufacturer>;
|
|
472
555
|
getBasicCategoryStruct(overrides?: Partial<Category$1>, parentId?: string): {
|
|
473
556
|
id: string;
|
|
474
557
|
name: string;
|
|
@@ -1063,7 +1146,7 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
|
|
|
1063
1146
|
} & {
|
|
1064
1147
|
OpenSearchSuggestPage: Task;
|
|
1065
1148
|
} & {
|
|
1066
|
-
ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<
|
|
1149
|
+
ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
|
|
1067
1150
|
}, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
|
|
1068
1151
|
|
|
1069
|
-
export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency$1 as 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 };
|
|
1152
|
+
export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Manufacturer, 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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as axe_core from 'axe-core';
|
|
1
2
|
import * as _playwright_test from '@playwright/test';
|
|
2
3
|
import { APIRequestContext, APIResponse, Page, Locator } from '@playwright/test';
|
|
3
4
|
export * from '@playwright/test';
|
|
@@ -70,9 +71,61 @@ declare class StoreApiContext {
|
|
|
70
71
|
head<PAYLOAD>(url: string, options?: RequestOptions<PAYLOAD>): Promise<APIResponse>;
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
interface Email {
|
|
75
|
+
fromName: string;
|
|
76
|
+
fromAddress: string;
|
|
77
|
+
toName: string;
|
|
78
|
+
toAddress: string;
|
|
79
|
+
subject: string;
|
|
80
|
+
emailId: string;
|
|
81
|
+
}
|
|
82
|
+
declare class MailpitApiContext {
|
|
83
|
+
context: APIRequestContext;
|
|
84
|
+
constructor(context: APIRequestContext);
|
|
85
|
+
/**
|
|
86
|
+
* Fetches email headers based on the recipient's email address.
|
|
87
|
+
* @param email - The email address of the recipient.
|
|
88
|
+
* @returns An Email object containing the email headers.
|
|
89
|
+
*/
|
|
90
|
+
getEmailHeaders(email: string): Promise<Email>;
|
|
91
|
+
/**
|
|
92
|
+
* Retrieves the body content of the latest email as an HTML string.
|
|
93
|
+
* @returns The HTML content of the latest email.
|
|
94
|
+
*/
|
|
95
|
+
getEmailBody(): Promise<string>;
|
|
96
|
+
/**
|
|
97
|
+
* Generates the full email content, combining headers and body.
|
|
98
|
+
* @param email - The email address to fetch headers for.
|
|
99
|
+
* @returns The full email content as a string.
|
|
100
|
+
*/
|
|
101
|
+
generateEmailContent(email: string): Promise<string>;
|
|
102
|
+
/**
|
|
103
|
+
* Retrieves the plain text content of the latest email.
|
|
104
|
+
* @returns The plain text content of the latest email.
|
|
105
|
+
*/
|
|
106
|
+
getRenderMessageTxt(): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Extracts the first URL found in the plain text content of the latest email.
|
|
109
|
+
* @returns The first URL found in the email content.
|
|
110
|
+
* @throws An error if no URL is found in the email content.
|
|
111
|
+
*/
|
|
112
|
+
getLinkFromMail(): Promise<string>;
|
|
113
|
+
/**
|
|
114
|
+
* Deletes a specific email by ID if provided, or deletes all emails if no ID is provided.
|
|
115
|
+
* @param emailId - The ID of the email to delete (optional).
|
|
116
|
+
*/
|
|
117
|
+
deleteMail(emailId?: string): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new EmailApiContext instance with the appropriate configuration.
|
|
120
|
+
* @returns A promise that resolves to an EmailApiContext instance.
|
|
121
|
+
*/
|
|
122
|
+
static create(baseURL: string): Promise<MailpitApiContext>;
|
|
123
|
+
}
|
|
124
|
+
|
|
73
125
|
interface ApiContextTypes {
|
|
74
126
|
AdminApiContext: AdminApiContext;
|
|
75
127
|
StoreApiContext: StoreApiContext;
|
|
128
|
+
MailpitApiContext: MailpitApiContext;
|
|
76
129
|
}
|
|
77
130
|
|
|
78
131
|
interface PageContextTypes {
|
|
@@ -142,6 +195,9 @@ type Product = Omit<components['schemas']['Product'], 'price' | 'prices'> & {
|
|
|
142
195
|
name: string;
|
|
143
196
|
};
|
|
144
197
|
};
|
|
198
|
+
type Manufacturer = components['schemas']['ProductManufacturer'] & {
|
|
199
|
+
id: string;
|
|
200
|
+
};
|
|
145
201
|
type PropertyGroup = components['schemas']['PropertyGroup'] & {
|
|
146
202
|
id: string;
|
|
147
203
|
};
|
|
@@ -286,6 +342,18 @@ declare class TestDataService {
|
|
|
286
342
|
* @param currencyId - The uuid of the currency to use for the product pricing.
|
|
287
343
|
*/
|
|
288
344
|
createProductWithPriceRange(overrides?: Partial<Product>, taxId?: string, currencyId?: string): Promise<Product>;
|
|
345
|
+
/**
|
|
346
|
+
* Creates a basic manufacturer without images or other special configuration.
|
|
347
|
+
*
|
|
348
|
+
* @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
|
|
349
|
+
*/
|
|
350
|
+
createBasicManufacturer(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
|
|
351
|
+
/**
|
|
352
|
+
* Creates a basic manufacturer with one randomly generated image.
|
|
353
|
+
*
|
|
354
|
+
* @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
|
|
355
|
+
*/
|
|
356
|
+
createManufacturerWithImage(overrides?: Partial<Manufacturer>): Promise<Manufacturer>;
|
|
289
357
|
/**
|
|
290
358
|
* Creates a basic product category to assign products to.
|
|
291
359
|
*
|
|
@@ -367,6 +435,20 @@ declare class TestDataService {
|
|
|
367
435
|
* @param mediaId - The uuid of the media resource.
|
|
368
436
|
*/
|
|
369
437
|
assignProductMedia(productId: string, mediaId: string): Promise<any>;
|
|
438
|
+
/**
|
|
439
|
+
* Assigns a media resource to a manufacturer as a logo.
|
|
440
|
+
*
|
|
441
|
+
* @param manufacturerId - The uuid of the manufacturer.
|
|
442
|
+
* @param mediaId - The uuid of the media resource.
|
|
443
|
+
*/
|
|
444
|
+
assignManufacturerMedia(manufacturerId: string, mediaId: string): Promise<any>;
|
|
445
|
+
/**
|
|
446
|
+
* Assigns a manufacturer to a product.
|
|
447
|
+
*
|
|
448
|
+
* @param manufacturerId - The uuid of the manufacturer.
|
|
449
|
+
* @param productId - The uuid of the product.
|
|
450
|
+
*/
|
|
451
|
+
assignManufacturerProduct(manufacturerId: string, productId: string): Promise<playwright_core.APIResponse>;
|
|
370
452
|
/**
|
|
371
453
|
* Assigns a product to a category.
|
|
372
454
|
*
|
|
@@ -469,6 +551,7 @@ declare class TestDataService {
|
|
|
469
551
|
convertDateTime(date: Date): string;
|
|
470
552
|
getBasicProductStruct(taxId?: string, currencyId?: string, overrides?: Partial<Product>): Partial<Product>;
|
|
471
553
|
getProductPriceRangeStruct(currencyId: string, ruleId: string): Partial<Product>;
|
|
554
|
+
getBasicManufacturerStruct(overrides?: Partial<Manufacturer>): Partial<Manufacturer>;
|
|
472
555
|
getBasicCategoryStruct(overrides?: Partial<Category$1>, parentId?: string): {
|
|
473
556
|
id: string;
|
|
474
557
|
name: string;
|
|
@@ -1063,7 +1146,7 @@ declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArg
|
|
|
1063
1146
|
} & {
|
|
1064
1147
|
OpenSearchSuggestPage: Task;
|
|
1065
1148
|
} & {
|
|
1066
|
-
ValidateAccessibility: (pageName: string, assertViolations?: boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<
|
|
1149
|
+
ValidateAccessibility: (pageName: string, assertViolations?: number | boolean | undefined, createReport?: boolean | undefined, ruleTags?: string[] | undefined, outputDir?: string | undefined) => () => Promise<axe_core.Result[]>;
|
|
1067
1150
|
}, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions & FixtureTypes>;
|
|
1068
1151
|
|
|
1069
|
-
export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency$1 as 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 };
|
|
1152
|
+
export { AdminPageObjects, type Category$1 as Category, type CreatedRecord, type Currency$1 as Currency, type Customer, type CustomerAddress, type DataServiceOptions, type FixtureTypes, type Manufacturer, 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
|
@@ -393,16 +393,16 @@ const test$b = test$d.extend({
|
|
|
393
393
|
]
|
|
394
394
|
});
|
|
395
395
|
|
|
396
|
-
var __defProp$
|
|
397
|
-
var __defNormalProp$
|
|
398
|
-
var __publicField$
|
|
399
|
-
__defNormalProp$
|
|
396
|
+
var __defProp$t = Object.defineProperty;
|
|
397
|
+
var __defNormalProp$t = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
398
|
+
var __publicField$t = (obj, key, value) => {
|
|
399
|
+
__defNormalProp$t(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
400
400
|
return value;
|
|
401
401
|
};
|
|
402
402
|
const _AdminApiContext = class _AdminApiContext {
|
|
403
403
|
constructor(context, options) {
|
|
404
|
-
__publicField$
|
|
405
|
-
__publicField$
|
|
404
|
+
__publicField$t(this, "context");
|
|
405
|
+
__publicField$t(this, "options");
|
|
406
406
|
this.context = context;
|
|
407
407
|
this.options = options;
|
|
408
408
|
}
|
|
@@ -494,7 +494,7 @@ const _AdminApiContext = class _AdminApiContext {
|
|
|
494
494
|
return this.context.head(url, options);
|
|
495
495
|
}
|
|
496
496
|
};
|
|
497
|
-
__publicField$
|
|
497
|
+
__publicField$t(_AdminApiContext, "defaultOptions", {
|
|
498
498
|
app_url: process.env["APP_URL"],
|
|
499
499
|
client_id: process.env["SHOPWARE_ACCESS_KEY_ID"],
|
|
500
500
|
client_secret: process.env["SHOPWARE_SECRET_ACCESS_KEY"],
|
|
@@ -504,16 +504,16 @@ __publicField$s(_AdminApiContext, "defaultOptions", {
|
|
|
504
504
|
});
|
|
505
505
|
let AdminApiContext = _AdminApiContext;
|
|
506
506
|
|
|
507
|
-
var __defProp$
|
|
508
|
-
var __defNormalProp$
|
|
509
|
-
var __publicField$
|
|
510
|
-
__defNormalProp$
|
|
507
|
+
var __defProp$s = Object.defineProperty;
|
|
508
|
+
var __defNormalProp$s = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
509
|
+
var __publicField$s = (obj, key, value) => {
|
|
510
|
+
__defNormalProp$s(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
511
511
|
return value;
|
|
512
512
|
};
|
|
513
513
|
const _StoreApiContext = class _StoreApiContext {
|
|
514
514
|
constructor(context, options) {
|
|
515
|
-
__publicField$
|
|
516
|
-
__publicField$
|
|
515
|
+
__publicField$s(this, "context");
|
|
516
|
+
__publicField$s(this, "options");
|
|
517
517
|
this.context = context;
|
|
518
518
|
this.options = options;
|
|
519
519
|
}
|
|
@@ -572,12 +572,122 @@ const _StoreApiContext = class _StoreApiContext {
|
|
|
572
572
|
return this.context.head(url, options);
|
|
573
573
|
}
|
|
574
574
|
};
|
|
575
|
-
__publicField$
|
|
575
|
+
__publicField$s(_StoreApiContext, "defaultOptions", {
|
|
576
576
|
app_url: process.env["APP_URL"],
|
|
577
577
|
ignoreHTTPSErrors: true
|
|
578
578
|
});
|
|
579
579
|
let StoreApiContext = _StoreApiContext;
|
|
580
580
|
|
|
581
|
+
var __defProp$r = Object.defineProperty;
|
|
582
|
+
var __defNormalProp$r = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
583
|
+
var __publicField$r = (obj, key, value) => {
|
|
584
|
+
__defNormalProp$r(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
585
|
+
return value;
|
|
586
|
+
};
|
|
587
|
+
class MailpitApiContext {
|
|
588
|
+
constructor(context) {
|
|
589
|
+
__publicField$r(this, "context");
|
|
590
|
+
this.context = context;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Fetches email headers based on the recipient's email address.
|
|
594
|
+
* @param email - The email address of the recipient.
|
|
595
|
+
* @returns An Email object containing the email headers.
|
|
596
|
+
*/
|
|
597
|
+
async getEmailHeaders(email) {
|
|
598
|
+
const response = await this.context.get("/api/v1/search", {
|
|
599
|
+
params: {
|
|
600
|
+
kind: "To.Address",
|
|
601
|
+
query: email
|
|
602
|
+
}
|
|
603
|
+
});
|
|
604
|
+
const responseJson = await response.json();
|
|
605
|
+
return {
|
|
606
|
+
fromName: responseJson.messages[0].From.Name,
|
|
607
|
+
fromAddress: responseJson.messages[0].From.Address,
|
|
608
|
+
toName: responseJson.messages[0].To[0].Name,
|
|
609
|
+
toAddress: responseJson.messages[0].To[0].Address,
|
|
610
|
+
subject: responseJson.messages[0].Subject,
|
|
611
|
+
emailId: responseJson.messages[0].ID
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Retrieves the body content of the latest email as an HTML string.
|
|
616
|
+
* @returns The HTML content of the latest email.
|
|
617
|
+
*/
|
|
618
|
+
async getEmailBody() {
|
|
619
|
+
const response = await this.context.get("view/latest.html");
|
|
620
|
+
const buffer = await response.body();
|
|
621
|
+
const htmlString = buffer.toString("utf-8");
|
|
622
|
+
return htmlString;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Generates the full email content, combining headers and body.
|
|
626
|
+
* @param email - The email address to fetch headers for.
|
|
627
|
+
* @returns The full email content as a string.
|
|
628
|
+
*/
|
|
629
|
+
async generateEmailContent(email) {
|
|
630
|
+
const headers = await this.getEmailHeaders(email);
|
|
631
|
+
const htmlTemplate = await this.getEmailBody();
|
|
632
|
+
const headerSection = `
|
|
633
|
+
<div style="font-family:arial; font-size:16px;" id="email-container">
|
|
634
|
+
<p id="from"><strong>From:</strong> ${headers.fromName} <${headers.fromAddress}></p>
|
|
635
|
+
<p id="to"><strong>To:</strong> ${headers.toName} <${headers.toAddress}></p>
|
|
636
|
+
<p id="subject"><strong>Subject:</strong> ${headers.subject}</p>
|
|
637
|
+
</div>
|
|
638
|
+
`;
|
|
639
|
+
const emailContent = headerSection + htmlTemplate;
|
|
640
|
+
return emailContent;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* Retrieves the plain text content of the latest email.
|
|
644
|
+
* @returns The plain text content of the latest email.
|
|
645
|
+
*/
|
|
646
|
+
async getRenderMessageTxt() {
|
|
647
|
+
const response = await this.context.get("view/latest.txt");
|
|
648
|
+
const buffer = await response.body();
|
|
649
|
+
const text = buffer.toString("utf-8");
|
|
650
|
+
return text;
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Extracts the first URL found in the plain text content of the latest email.
|
|
654
|
+
* @returns The first URL found in the email content.
|
|
655
|
+
* @throws An error if no URL is found in the email content.
|
|
656
|
+
*/
|
|
657
|
+
async getLinkFromMail() {
|
|
658
|
+
const textContent = await this.getRenderMessageTxt();
|
|
659
|
+
const urlMatch = textContent.match(/https?:\/\/[^\s]+/);
|
|
660
|
+
if (urlMatch && urlMatch.length > 0) {
|
|
661
|
+
return urlMatch[0];
|
|
662
|
+
}
|
|
663
|
+
throw new Error("No URL found in the email content");
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Deletes a specific email by ID if provided, or deletes all emails if no ID is provided.
|
|
667
|
+
* @param emailId - The ID of the email to delete (optional).
|
|
668
|
+
*/
|
|
669
|
+
async deleteMail(emailId) {
|
|
670
|
+
const data = emailId ? { IDs: [emailId] } : {};
|
|
671
|
+
await this.context.delete(`api/v1/messages`, { data });
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Creates a new EmailApiContext instance with the appropriate configuration.
|
|
675
|
+
* @returns A promise that resolves to an EmailApiContext instance.
|
|
676
|
+
*/
|
|
677
|
+
static async create(baseURL) {
|
|
678
|
+
const extraHTTPHeaders = {
|
|
679
|
+
"Accept": "application/json",
|
|
680
|
+
"Content-Type": "application/json"
|
|
681
|
+
};
|
|
682
|
+
const context = await request.newContext({
|
|
683
|
+
baseURL,
|
|
684
|
+
ignoreHTTPSErrors: true,
|
|
685
|
+
extraHTTPHeaders
|
|
686
|
+
});
|
|
687
|
+
return new MailpitApiContext(context);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
581
691
|
const test$a = test$d.extend({
|
|
582
692
|
AdminApiContext: [
|
|
583
693
|
async ({}, use) => {
|
|
@@ -597,6 +707,13 @@ const test$a = test$d.extend({
|
|
|
597
707
|
await use(storeApiContext);
|
|
598
708
|
},
|
|
599
709
|
{ scope: "worker" }
|
|
710
|
+
],
|
|
711
|
+
MailpitApiContext: [
|
|
712
|
+
async ({}, use) => {
|
|
713
|
+
const mailpitApiContext = await MailpitApiContext.create(process.env["MAILPIT_BASE_URL"]);
|
|
714
|
+
await use(mailpitApiContext);
|
|
715
|
+
},
|
|
716
|
+
{ scope: "worker" }
|
|
600
717
|
]
|
|
601
718
|
});
|
|
602
719
|
|
|
@@ -915,6 +1032,31 @@ class TestDataService {
|
|
|
915
1032
|
const productOverrides = Object.assign({}, priceRange, overrides);
|
|
916
1033
|
return this.createBasicProduct(productOverrides, taxId, currencyId);
|
|
917
1034
|
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Creates a basic manufacturer without images or other special configuration.
|
|
1037
|
+
*
|
|
1038
|
+
* @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
|
|
1039
|
+
*/
|
|
1040
|
+
async createBasicManufacturer(overrides = {}) {
|
|
1041
|
+
const basicManufacturer = this.getBasicManufacturerStruct(overrides);
|
|
1042
|
+
const manufacturerResponse = await this.AdminApiClient.post("./product-manufacturer?_response=detail", {
|
|
1043
|
+
data: basicManufacturer
|
|
1044
|
+
});
|
|
1045
|
+
const { data: manufacturer } = await manufacturerResponse.json();
|
|
1046
|
+
this.addCreatedRecord("product-manufacturer", manufacturer.id);
|
|
1047
|
+
return manufacturer;
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Creates a basic manufacturer with one randomly generated image.
|
|
1051
|
+
*
|
|
1052
|
+
* @param overrides - Specific data overrides that will be applied to the manufacturer data struct.
|
|
1053
|
+
*/
|
|
1054
|
+
async createManufacturerWithImage(overrides = {}) {
|
|
1055
|
+
const manufacturer = await this.createBasicManufacturer(overrides);
|
|
1056
|
+
const media = await this.createMediaPNG();
|
|
1057
|
+
await this.assignManufacturerMedia(manufacturer.id, media.id);
|
|
1058
|
+
return manufacturer;
|
|
1059
|
+
}
|
|
918
1060
|
/**
|
|
919
1061
|
* Creates a basic product category to assign products to.
|
|
920
1062
|
*
|
|
@@ -1172,6 +1314,34 @@ class TestDataService {
|
|
|
1172
1314
|
const { data: productMedia } = await mediaResponse.json();
|
|
1173
1315
|
return productMedia;
|
|
1174
1316
|
}
|
|
1317
|
+
/**
|
|
1318
|
+
* Assigns a media resource to a manufacturer as a logo.
|
|
1319
|
+
*
|
|
1320
|
+
* @param manufacturerId - The uuid of the manufacturer.
|
|
1321
|
+
* @param mediaId - The uuid of the media resource.
|
|
1322
|
+
*/
|
|
1323
|
+
async assignManufacturerMedia(manufacturerId, mediaId) {
|
|
1324
|
+
const mediaResponse = await this.AdminApiClient.patch(`product-manufacturer/${manufacturerId}?_response=basic`, {
|
|
1325
|
+
data: {
|
|
1326
|
+
mediaId
|
|
1327
|
+
}
|
|
1328
|
+
});
|
|
1329
|
+
const { data: manufacturerMedia } = await mediaResponse.json();
|
|
1330
|
+
return manufacturerMedia;
|
|
1331
|
+
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Assigns a manufacturer to a product.
|
|
1334
|
+
*
|
|
1335
|
+
* @param manufacturerId - The uuid of the manufacturer.
|
|
1336
|
+
* @param productId - The uuid of the product.
|
|
1337
|
+
*/
|
|
1338
|
+
async assignManufacturerProduct(manufacturerId, productId) {
|
|
1339
|
+
return await this.AdminApiClient.patch(`product/${productId}?_response=basic`, {
|
|
1340
|
+
data: {
|
|
1341
|
+
manufacturerId
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1175
1345
|
/**
|
|
1176
1346
|
* Assigns a product to a category.
|
|
1177
1347
|
*
|
|
@@ -1526,6 +1696,21 @@ class TestDataService {
|
|
|
1526
1696
|
}]
|
|
1527
1697
|
};
|
|
1528
1698
|
}
|
|
1699
|
+
getBasicManufacturerStruct(overrides = {}) {
|
|
1700
|
+
const { id: manufacturerId, uuid: manufacturerUuid } = this.IdProvider.getIdPair();
|
|
1701
|
+
const manufacturerName = `${this.namePrefix}Manufacturer-${manufacturerId}${this.nameSuffix}`;
|
|
1702
|
+
const description = `
|
|
1703
|
+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
|
|
1704
|
+
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
|
|
1705
|
+
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
|
|
1706
|
+
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.`.trim();
|
|
1707
|
+
const basicManufacturer = {
|
|
1708
|
+
id: manufacturerUuid,
|
|
1709
|
+
name: manufacturerName,
|
|
1710
|
+
description
|
|
1711
|
+
};
|
|
1712
|
+
return Object.assign({}, basicManufacturer, overrides);
|
|
1713
|
+
}
|
|
1529
1714
|
getBasicCategoryStruct(overrides = {}, parentId = this.defaultCategoryId) {
|
|
1530
1715
|
const { id: categoryId, uuid: categoryUuid } = this.IdProvider.getIdPair();
|
|
1531
1716
|
const categoryName = `${this.namePrefix}Category-${categoryId}${this.nameSuffix}`;
|
|
@@ -3540,6 +3725,7 @@ const ValidateAccessibility = test$d.extend({
|
|
|
3540
3725
|
const task = (pageName, assertViolations = true, createReport = true, ruleTags = ["wcag2a", "wcag2aa", "wcag2aaa", "wcag21a", "wcag21aa", "best-practice"], outputDir = "test-results/AccessibilityReports") => {
|
|
3541
3726
|
return async function ValidateAccessibility2() {
|
|
3542
3727
|
const axeBuilder = new AxeBuilder({ page: ShopCustomer.page });
|
|
3728
|
+
axeBuilder.exclude(".sf-toolbar");
|
|
3543
3729
|
const accessibilityResults = await axeBuilder.withTags(ruleTags).analyze();
|
|
3544
3730
|
if (createReport) {
|
|
3545
3731
|
createHtmlReport({
|
|
@@ -3551,9 +3737,12 @@ const ValidateAccessibility = test$d.extend({
|
|
|
3551
3737
|
}
|
|
3552
3738
|
});
|
|
3553
3739
|
}
|
|
3554
|
-
if (assertViolations) {
|
|
3740
|
+
if (typeof assertViolations === "number") {
|
|
3741
|
+
ShopCustomer.expects(accessibilityResults.violations.length).toBeLessThanOrEqual(assertViolations);
|
|
3742
|
+
} else if (assertViolations) {
|
|
3555
3743
|
ShopCustomer.expects(accessibilityResults.violations).toEqual([]);
|
|
3556
3744
|
}
|
|
3745
|
+
return accessibilityResults.violations;
|
|
3557
3746
|
};
|
|
3558
3747
|
};
|
|
3559
3748
|
await use(task);
|