-
Notifications
You must be signed in to change notification settings - Fork 917
/
cypress.config.ts
73 lines (67 loc) · 1.88 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { defineConfig } from 'cypress';
import webpackPreprocessor from '@cypress/webpack-preprocessor';
module.exports = defineConfig({
defaultCommandTimeout: 60000,
requestTimeout: 60000,
responseTimeout: 60000,
viewportWidth: 2000,
viewportHeight: 1320,
env: {
ENGINE: {
name: 'default',
url: 'http://localhost:9200',
},
SECONDARY_ENGINE: {
name: 'test_cluster',
url: 'http://localhost:9200',
},
openSearchUrl: 'http://localhost:9200',
SECURITY_ENABLED: false,
AGGREGATION_VIEW: false,
username: 'admin',
password: 'myStrongPassword123!',
ENDPOINT_WITH_PROXY: false,
MANAGED_SERVICE_ENDPOINT: false,
VISBUILDER_ENABLED: true,
DATASOURCE_MANAGEMENT_ENABLED: false,
ML_COMMONS_DASHBOARDS_ENABLED: true,
WAIT_FOR_LOADER_BUFFER_MS: 0,
},
e2e: {
baseUrl: 'http://localhost:5601',
specPattern: 'cypress/integration/**/*.spec.{js,jsx,ts,tsx}',
testIsolation: false,
setupNodeEvents,
},
});
function setupNodeEvents(
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
): Cypress.PluginConfigOptions {
const { webpackOptions } = webpackPreprocessor.defaultOptions;
/**
* By default, cypress' internal webpack preprocessor doesn't allow imports without file extensions.
* This makes our life a bit hard since if any file in our testing dependency graph has an import without
* the .js extension our cypress build will fail.
*
* This extra rule relaxes this a bit by allowing imports without file extension
* ex. import module from './module'
*/
webpackOptions!.module!.rules.unshift({
test: /\.m?js/,
resolve: {
enforceExtension: false,
},
});
on(
'file:preprocessor',
webpackPreprocessor({
webpackOptions,
})
);
return config;
}