-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconstants.ts
More file actions
153 lines (138 loc) · 3.45 KB
/
constants.ts
File metadata and controls
153 lines (138 loc) · 3.45 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
export const PAGE_TRANSITION_COMMANDS: string[] = [
'url',
'navigateTo',
'elementClick',
'click'
]
/**
* Regular expression to strip ANSI escape codes from terminal output
*/
export const ANSI_REGEX = /\x1b\[[0-9;]*m/g
/**
* Console method types for log capturing
*/
export const CONSOLE_METHODS = ['log', 'info', 'warn', 'error'] as const
/**
* Log level detection patterns with priority order (highest to lowest)
*/
export const LOG_LEVEL_PATTERNS: ReadonlyArray<{
level: 'trace' | 'debug' | 'info' | 'warn' | 'error'
pattern: RegExp
}> = [
{ level: 'trace', pattern: /\btrace\b/i },
{ level: 'debug', pattern: /\bdebug\b/i },
{ level: 'info', pattern: /\binfo\b/i },
{ level: 'warn', pattern: /\bwarn(ing)?\b/i },
{ level: 'error', pattern: /\berror\b/i }
] as const
/**
* Visual indicators that suggest error-level logs
*/
export const ERROR_INDICATORS = ['✗', '✓', 'failed', 'failure'] as const
/**
* Console log source types
*/
export const LOG_SOURCES = {
BROWSER: 'browser',
TEST: 'test',
TERMINAL: 'terminal'
} as const
export const DEFAULT_LAUNCH_CAPS: WebdriverIO.Capabilities = {
browserName: 'chrome',
'goog:chromeOptions': {
// production:
args: ['--window-size=1600,1200']
// development:
// args: ['--window-size=1600,1200', '--auto-open-devtools-for-tabs']
}
}
export const INTERNAL_COMMANDS = [
'emit',
'browsingContextLocateNodes',
'browsingContextNavigate',
'waitUntil',
'getTitle',
'getUrl',
'getWindowSize',
'setWindowSize',
'deleteSession',
'findElementFromShadowRoot',
'findElementsFromShadowRoot',
'waitForExist',
'browsingContextGetTree',
'scriptCallFunction',
'getElement',
'execute',
'findElement',
'getElementText',
'getElementShadowRoot'
]
export const CONTEXT_CHANGE_COMMANDS = [
'url',
'back',
'forward',
'refresh',
'switchFrame',
'newWindow',
'createWindow',
'closeWindow'
]
/**
* Existing pattern (kept for any external consumers)
*/
export const SPEC_FILE_PATTERN =
/\/(test|spec|features|pageobjects|@wdio\/expect-webdriverio)\//i
/**
* Parser options
*/
export const PARSE_PLUGINS = [
'typescript',
'jsx',
'decorators-legacy',
'classProperties',
'dynamicImport'
] as const
/**
* Test framework identifiers
*/
export const TEST_FN_NAMES = ['it', 'test', 'specify', 'fit', 'xit'] as const
export const SUITE_FN_NAMES = ['describe', 'context', 'suite'] as const
export const STEP_FN_NAMES = [
'Given',
'When',
'Then',
'And',
'But',
'defineStep'
] as const
/**
* File/type recognizers
*/
export const STEP_FILE_RE = /\.(?:steps?)\.[cm]?[jt]sx?$/i
export const STEP_DIR_RE =
/(?:^|\/)(?:step[-_]?definitions|steps)\/.+\.[cm]?[jt]sx?$/i
export const SPEC_FILE_RE = /\.(?:test|spec)\.[cm]?[jt]sx?$/i
export const FEATURE_FILE_RE = /\.feature$/i
export const SOURCE_FILE_EXT_RE = /\.(?:[cm]?js|[cm]?ts)x?$/
/**
* Gherkin Feature/Scenario line
*/
export const FEATURE_OR_SCENARIO_LINE_RE =
/^\s*(Feature|Scenario(?: Outline)?):\s*(.+)\s*$/i
/**
* Step definition textual scan regexes
*/
export const STEP_DEF_REGEX_LITERAL_RE =
/\b(Given|When|Then|And|But)\s*\(\s*(\/(?:\\.|[^/\\])+\/[gimsuy]*)/
export const STEP_DEF_STRING_RE =
/\b(Given|When|Then|And|But)\s*\(\s*(['`])([^'`\\]*(?:\\.[^'`\\]*)*)\2/
/**
* Step directories discovery
*/
export const STEPS_DIR_CANDIDATES = [
'step-definitions',
'step_definitions',
'steps'
] as const
export const STEPS_DIR_ASCENT_MAX = 6
export const STEPS_GLOBAL_SEARCH_MAX_DEPTH = 5