-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.ts
57 lines (52 loc) · 2.1 KB
/
cypress.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { defineConfig } from 'cypress';
import dotenv from 'dotenv';
import { existsSync } from 'fs';
dotenv.config();
const protocolMap: { [key: string]: 'http' | 'https' } = {
'1': 'https',
'0': 'http',
http: 'http',
https: 'https',
};
const protocol = protocolMap[getEnvVar('ENV_PROTOCOL', 'SPRYKER_SSL_ENABLED')];
const backofficeHost = getEnvVar('ENV_BACKOFFICE_HOST', 'SPRYKER_BE_HOST');
const merchantPortalHost = getEnvVar('ENV_MERCHANT_PORTAL_HOST', 'SPRYKER_MP_HOST');
const glueHost = getEnvVar('ENV_GLUE_HOST', 'SPRYKER_API_HOST');
const glueBackendHost = getEnvVar('ENV_GLUE_BACKEND_HOST', 'SPRYKER_GLUE_BACKEND_HOST');
const glueStorefrontHost = getEnvVar('ENV_GLUE_STOREFRONT_HOST', 'SPRYKER_GLUE_STOREFRONT_HOST');
const mailCatcherHost = getEnvVar('ENV_MAIL_CATCHER_HOST', 'SPRYKER_SMTP_HOST');
const baseHost = getEnvVar('E2E_BASE_HOST', 'SPRYKER_FE_HOST');
export default defineConfig({
env: {
repositoryId: process.env.ENV_REPOSITORY_ID,
isDynamicStoreEnabled: getEnvVar('ENV_IS_DYNAMIC_STORE_ENABLED', 'SPRYKER_DYNAMIC_STORE_MODE') === 'true',
backofficeUrl: `${protocol}://${backofficeHost}`,
merchantPortalUrl: `${protocol}://${merchantPortalHost}`,
glueUrl: `${protocol}://${glueHost}`,
glueBackendUrl: `${protocol}://${glueBackendHost}`,
glueStorefrontUrl: `${protocol}://${glueStorefrontHost}`,
mailCatcherUrl: `${protocol}://${mailCatcherHost}`,
},
e2e: {
baseUrl: `${protocol}://${baseHost}`,
setupNodeEvents(on) {
on('task', {
isFileExists(filename: string): boolean {
return existsSync(filename);
},
});
},
retries: {
runMode: 2,
openMode: 0,
},
experimentalMemoryManagement: true,
},
viewportWidth: parseInt(process.env.VIEWPORT_WIDGTH ?? '1920', 10),
viewportHeight: parseInt(process.env.VIEWPORT_HEIGHT ?? '1080', 10),
});
function getEnvVar(primary: string, fallback: string): string {
const primaryValue = process.env[primary];
const fallbackValue = process.env[fallback];
return primaryValue !== undefined ? primaryValue : fallbackValue !== undefined ? fallbackValue : '';
}