@shopware-ag/acceptance-test-suite 12.14.1 → 12.15.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 +396 -381
- package/dist/index.d.ts +396 -381
- package/dist/index.mjs +61 -39
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -3893,11 +3893,28 @@ async function createNewAdminPageContext(browser, SalesChannelBaseConfig) {
|
|
|
3893
3893
|
baseURL: SalesChannelBaseConfig.adminUrl,
|
|
3894
3894
|
serviceWorkers: "block"
|
|
3895
3895
|
});
|
|
3896
|
+
await mockApiCalls(context);
|
|
3896
3897
|
const adminPage = await context.newPage();
|
|
3897
3898
|
await adminPage.goto("#/login");
|
|
3898
|
-
await mockApiCalls(adminPage);
|
|
3899
3899
|
return adminPage;
|
|
3900
3900
|
}
|
|
3901
|
+
function hideSymfonyToolbarOnReload(page) {
|
|
3902
|
+
const originalReload = page.reload.bind(page);
|
|
3903
|
+
page.reload = async () => {
|
|
3904
|
+
const res = await originalReload();
|
|
3905
|
+
await page.addStyleTag({
|
|
3906
|
+
content: `
|
|
3907
|
+
.sf-toolbar {
|
|
3908
|
+
width: 0 !important;
|
|
3909
|
+
height: 0 !important;
|
|
3910
|
+
display: none !important;
|
|
3911
|
+
pointer-events: none !important;
|
|
3912
|
+
}
|
|
3913
|
+
`.trim()
|
|
3914
|
+
});
|
|
3915
|
+
return res;
|
|
3916
|
+
};
|
|
3917
|
+
}
|
|
3901
3918
|
async function loginToAdministration(adminLoginPage, merchant, AdminApiContext) {
|
|
3902
3919
|
const usernamePattern = new RegExp(`${translate("administration:login:username")}|${translate("administration:login:emailAddress")}`);
|
|
3903
3920
|
const passwordLabel = translate("administration:login:password");
|
|
@@ -3914,21 +3931,7 @@ async function loginToAdministration(adminLoginPage, merchant, AdminApiContext)
|
|
|
3914
3931
|
const loginButtonLabel = translate("administration:login:loginButton");
|
|
3915
3932
|
await adminLoginPage.getByRole("button", { name: loginButtonLabel, exact: true }).click();
|
|
3916
3933
|
await Promise.all(jsLoadingPromises);
|
|
3917
|
-
|
|
3918
|
-
adminLoginPage.reload = async () => {
|
|
3919
|
-
const res = await originalReload();
|
|
3920
|
-
await adminLoginPage.addStyleTag({
|
|
3921
|
-
content: `
|
|
3922
|
-
.sf-toolbar {
|
|
3923
|
-
width: 0 !important;
|
|
3924
|
-
height: 0 !important;
|
|
3925
|
-
display: none !important;
|
|
3926
|
-
pointer-events: none !important;
|
|
3927
|
-
}
|
|
3928
|
-
`.trim()
|
|
3929
|
-
});
|
|
3930
|
-
return res;
|
|
3931
|
-
};
|
|
3934
|
+
hideSymfonyToolbarOnReload(adminLoginPage);
|
|
3932
3935
|
await clearDelayedCache(AdminApiContext);
|
|
3933
3936
|
await expect(adminLoginPage.locator(".sw-skeleton")).toHaveCount(0);
|
|
3934
3937
|
await adminLoginPage.waitForURL((url) => {
|
|
@@ -3939,32 +3942,47 @@ async function loginToAdministration(adminLoginPage, merchant, AdminApiContext)
|
|
|
3939
3942
|
}
|
|
3940
3943
|
|
|
3941
3944
|
const test$b = test$e.extend({
|
|
3942
|
-
|
|
3945
|
+
AdminSession: [
|
|
3946
|
+
async ({ IdProvider, AdminApiContext, SalesChannelBaseConfig, browser }, use) => {
|
|
3947
|
+
const { id, uuid } = IdProvider.getIdPair();
|
|
3948
|
+
const adminUser = {
|
|
3949
|
+
id: uuid,
|
|
3950
|
+
username: `admin_${id}`,
|
|
3951
|
+
firstName: `${id} admin`,
|
|
3952
|
+
lastName: `${id} admin`,
|
|
3953
|
+
localeId: SalesChannelBaseConfig.currentLocaleId,
|
|
3954
|
+
email: `admin_${id}@example.com`,
|
|
3955
|
+
timeZone: "Europe/Berlin",
|
|
3956
|
+
password: "shopware",
|
|
3957
|
+
admin: true
|
|
3958
|
+
};
|
|
3959
|
+
const response = await AdminApiContext.post("user", {
|
|
3960
|
+
data: adminUser
|
|
3961
|
+
});
|
|
3962
|
+
expect(response.ok()).toBeTruthy();
|
|
3963
|
+
const loginPage = await loginToAdministration(await createNewAdminPageContext(browser, SalesChannelBaseConfig), adminUser, AdminApiContext);
|
|
3964
|
+
const context = loginPage.context();
|
|
3965
|
+
await loginPage.close();
|
|
3966
|
+
await use({ context, user: adminUser });
|
|
3967
|
+
await context.close();
|
|
3968
|
+
await AdminApiContext.delete(`user/${uuid}`);
|
|
3969
|
+
},
|
|
3970
|
+
{ scope: "worker" }
|
|
3971
|
+
],
|
|
3972
|
+
AdminPage: async ({ AdminSession, CustomTranslationResources }, use) => {
|
|
3943
3973
|
const locale = getLocale();
|
|
3944
3974
|
const languageHelper = await LanguageHelper.createInstance(locale, CustomTranslationResources);
|
|
3945
|
-
const
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
localeId: SalesChannelBaseConfig.currentLocaleId,
|
|
3952
|
-
email: `admin_${id}@example.com`,
|
|
3953
|
-
timezone: "Europe/Berlin",
|
|
3954
|
-
password: "shopware",
|
|
3955
|
-
admin: true
|
|
3956
|
-
};
|
|
3957
|
-
const response = await AdminApiContext.post("user", {
|
|
3958
|
-
data: adminUser
|
|
3959
|
-
});
|
|
3960
|
-
expect(response.ok()).toBeTruthy();
|
|
3961
|
-
const page = await loginToAdministration(await createNewAdminPageContext(browser, SalesChannelBaseConfig), adminUser, AdminApiContext);
|
|
3975
|
+
const page = await AdminSession.context.newPage();
|
|
3976
|
+
hideSymfonyToolbarOnReload(page);
|
|
3977
|
+
await page.goto("./");
|
|
3978
|
+
await page.waitForURL((url) => url.hash.startsWith("#/") && !url.hash.startsWith("#/login"));
|
|
3979
|
+
await expect(page.getByText(AdminSession.user.firstName + " " + AdminSession.user.lastName).first()).toBeVisible({ timeout: 6e4 });
|
|
3980
|
+
await expect(page.locator(".sw-skeleton")).toHaveCount(0);
|
|
3962
3981
|
LanguageHelper.setForContext(page.context(), languageHelper);
|
|
3963
3982
|
setCurrentContext(page.context());
|
|
3964
3983
|
await use(page);
|
|
3965
3984
|
await page.close();
|
|
3966
3985
|
setCurrentContext(null);
|
|
3967
|
-
await AdminApiContext.delete(`user/${uuid}`);
|
|
3968
3986
|
},
|
|
3969
3987
|
StorefrontPage: async ({ DefaultSalesChannel, SalesChannelBaseConfig, browser, AdminApiContext, StoreApiContext, InstanceMeta, CustomTranslationResources }, use) => {
|
|
3970
3988
|
const { url, salesChannel } = DefaultSalesChannel;
|
|
@@ -4306,7 +4324,7 @@ class TestDataService {
|
|
|
4306
4324
|
const product = await this.createBasicProduct({ type: "digital", maxPurchase: 1, ...overrides }, taxId, currencyId);
|
|
4307
4325
|
const media = await this.createMediaTXT(content);
|
|
4308
4326
|
await this.assignProductDownload(product.id, media.id);
|
|
4309
|
-
return product;
|
|
4327
|
+
return { ...product, states: [...product.states ?? [], "is-download"] };
|
|
4310
4328
|
}
|
|
4311
4329
|
/**
|
|
4312
4330
|
* Creates a basic product with a price range matrix.
|
|
@@ -6687,7 +6705,10 @@ class IdProvider {
|
|
|
6687
6705
|
bytes[6] = 1 << 5;
|
|
6688
6706
|
bytes[8] = 128;
|
|
6689
6707
|
return {
|
|
6690
|
-
|
|
6708
|
+
// Derived from the hash like the uuid, so ids (and names/emails built from
|
|
6709
|
+
// them, e.g. the worker customer email) stay distinct between runs with
|
|
6710
|
+
// different seeds. A plain worker index collides across concurrent suites.
|
|
6711
|
+
id: `${buffer.readUIntBE(16, 6)}`,
|
|
6691
6712
|
uuid: stringify(bytes).replaceAll("-", "")
|
|
6692
6713
|
};
|
|
6693
6714
|
}
|
|
@@ -6696,7 +6717,8 @@ class IdProvider {
|
|
|
6696
6717
|
const test$8 = test$e.extend({
|
|
6697
6718
|
IdProvider: [
|
|
6698
6719
|
async ({}, use, workerInfo) => {
|
|
6699
|
-
const
|
|
6720
|
+
const baseSeed = process.env.SHOPWARE_ACCESS_KEY_ID || process.env.SHOPWARE_ADMIN_PASSWORD || "test-suite";
|
|
6721
|
+
const seed = process.env.ATS_ID_SEED ? `${process.env.ATS_ID_SEED}:${baseSeed}` : baseSeed;
|
|
6700
6722
|
const idProvider = new IdProvider(workerInfo.parallelIndex, seed);
|
|
6701
6723
|
await use(idProvider);
|
|
6702
6724
|
},
|
|
@@ -13215,4 +13237,4 @@ const test = mergeTests(
|
|
|
13215
13237
|
test$3
|
|
13216
13238
|
);
|
|
13217
13239
|
|
|
13218
|
-
export { Actor, AdminPageObjects, BUNDLED_RESOURCES, COUNTRY_ADDRESS_DATA, FeatureService, IdProvider, LanguageHelper, RuleType, StorefrontPageObjects, TestDataService, assertScreenshot, baseNamespaces, clearDelayedCache, compareFlowTemplateWithFlow, createNewAdminPageContext, createRandomImage, createSolidColorImage, encodeImage, extractIdFromUrl, formatPrice, getCountryAddressData, getCountryCodeFromLocale, getCountryId, getCurrency, getCurrencyCodeFromLocale, getCurrencySymbolFromLocale, getCurrentContext, getDefaultShippingMethodId, getFlow, getFlowId, getFlowTemplate, getLanguageCode, getLanguageData, getLocale, getMediaId, getOrderTransactionId, getPaymentMethodId, getPromotionWithDiscount, getSalutationId, getShippingMethodId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, hideElements, isPaaSInstance, isSaaSInstance, isThemeCompiled, loginToAdministration, mockApiCalls, replaceElements, replaceElementsIndividually, setCurrentContext, setOrderStatus, setViewport, test, translate, updateAdminUser, uploadRandomPngMedia };
|
|
13240
|
+
export { Actor, AdminPageObjects, BUNDLED_RESOURCES, COUNTRY_ADDRESS_DATA, FeatureService, IdProvider, LanguageHelper, RuleType, StorefrontPageObjects, TestDataService, assertScreenshot, baseNamespaces, clearDelayedCache, compareFlowTemplateWithFlow, createNewAdminPageContext, createRandomImage, createSolidColorImage, encodeImage, extractIdFromUrl, formatPrice, getCountryAddressData, getCountryCodeFromLocale, getCountryId, getCurrency, getCurrencyCodeFromLocale, getCurrencySymbolFromLocale, getCurrentContext, getDefaultShippingMethodId, getFlow, getFlowId, getFlowTemplate, getLanguageCode, getLanguageData, getLocale, getMediaId, getOrderTransactionId, getPaymentMethodId, getPromotionWithDiscount, getSalutationId, getShippingMethodId, getSnippetSetId, getStateMachineId, getStateMachineStateId, getTaxId, getThemeId, hideElements, hideSymfonyToolbarOnReload, isPaaSInstance, isSaaSInstance, isThemeCompiled, loginToAdministration, mockApiCalls, replaceElements, replaceElementsIndividually, setCurrentContext, setOrderStatus, setViewport, test, translate, updateAdminUser, uploadRandomPngMedia };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopware-ag/acceptance-test-suite",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.15.0",
|
|
4
4
|
"description": "Shopware Acceptance Test Suite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fixtures",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"format": "oxfmt --write .",
|
|
36
36
|
"typecheck": "tsgo --noEmit",
|
|
37
37
|
"build": "unbuild",
|
|
38
|
-
"prepare": "lefthook install",
|
|
38
|
+
"prepare": "(lefthook install || true) && npm run build",
|
|
39
39
|
"prepublishOnly": "npm run build"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|