forked from cypress-io/cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathknown-browsers.ts
More file actions
151 lines (142 loc) · 4.85 KB
/
known-browsers.ts
File metadata and controls
151 lines (142 loc) · 4.85 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
import type { Browser, BrowserValidatorResult, FoundBrowser } from '@packages/types'
// Chrome started exposing CDP 1.3 in 64
export const MIN_CHROME_VERSION = 64
// Firefox started exposing CDP in 86
export const MIN_FIREFOX_VERSION = 86
// Edge switched to Blink in 79
export const MIN_EDGE_VERSION = 79
// Compares a detected browser's major version to its minimum supported version
// to determine if the browser is supported by Cypress.
export const validateMinVersion = (browser: FoundBrowser): BrowserValidatorResult => {
const minSupportedVersion = browser.minSupportedVersion
const majorVersion = browser.majorVersion
if (majorVersion && minSupportedVersion && parseInt(majorVersion) < minSupportedVersion) {
return {
isSupported: false,
warningMessage: `Cypress does not support running ${browser.displayName} version ${majorVersion}. To use ${browser.displayName} with Cypress, install a version of ${browser.displayName} newer than or equal to ${minSupportedVersion}.`,
}
}
return {
isSupported: true,
}
}
/** list of the browsers we can detect and use by default */
export const knownBrowsers: Browser[] = [
{
name: 'chrome',
family: 'chromium',
channel: 'stable',
displayName: 'Chrome',
versionRegex: /Google Chrome (\S+)/m,
binary: ['google-chrome', 'chrome', 'google-chrome-stable'],
minSupportedVersion: MIN_CHROME_VERSION,
},
{
name: 'chromium',
family: 'chromium',
// technically Chromium is always in development
channel: 'stable',
displayName: 'Chromium',
versionRegex: /Chromium (\S+)/m,
binary: ['chromium-browser', 'chromium'],
minSupportedVersion: MIN_CHROME_VERSION,
},
{
name: 'chrome',
family: 'chromium',
channel: 'beta',
displayName: 'Chrome Beta',
versionRegex: /Google Chrome (\S+) beta/m,
binary: 'google-chrome-beta',
minSupportedVersion: MIN_CHROME_VERSION,
},
{
name: 'chrome',
family: 'chromium',
channel: 'canary',
displayName: 'Canary',
versionRegex: /Google Chrome Canary (\S+)/m,
binary: 'google-chrome-canary',
minSupportedVersion: MIN_CHROME_VERSION,
},
{
name: 'firefox',
family: 'firefox',
channel: 'stable',
displayName: 'Firefox',
// Mozilla Firefox 70.0.1
versionRegex: /^Mozilla Firefox ([^\sab]+)$/m,
binary: 'firefox',
minSupportedVersion: MIN_FIREFOX_VERSION,
validator: (browser: FoundBrowser, platform: NodeJS.Platform): BrowserValidatorResult => {
// Firefox 101 and 102 on Windows features a bug that results in Cypress being unable
// to connect to the launched browser. A fix was first released in stable 103.
// See https://github.com/cypress-io/cypress/issues/22086 for related info.
if (platform === 'win32' && browser.majorVersion && ['101', '102'].includes(browser.majorVersion)) {
return {
isSupported: false,
warningMessage: `Cypress does not support running ${browser.displayName} version ${browser.majorVersion} on Windows due to a blocking bug in ${browser.displayName}. To use ${browser.displayName} with Cypress on Windows, install version 103 or newer.`,
}
}
return validateMinVersion(browser)
},
},
{
name: 'firefox',
family: 'firefox',
channel: 'dev',
displayName: 'Firefox Developer Edition',
// Mozilla Firefox 73.0b12
versionRegex: /^Mozilla Firefox (\S+b\S*)$/m,
// ubuntu PPAs install it as firefox
binary: ['firefox-developer-edition', 'firefox'],
minSupportedVersion: MIN_FIREFOX_VERSION,
},
{
name: 'firefox',
family: 'firefox',
channel: 'nightly',
displayName: 'Firefox Nightly',
// Mozilla Firefox 74.0a1
versionRegex: /^Mozilla Firefox (\S+a\S*)$/m,
// ubuntu PPAs install it as firefox-trunk
binary: ['firefox-nightly', 'firefox-trunk'],
minSupportedVersion: MIN_FIREFOX_VERSION,
},
{
name: 'edge',
family: 'chromium',
channel: 'stable',
displayName: 'Edge',
versionRegex: /Microsoft Edge (\S+)/mi,
binary: ['edge', 'microsoft-edge'],
minSupportedVersion: MIN_EDGE_VERSION,
},
{
name: 'edge',
family: 'chromium',
channel: 'canary',
displayName: 'Edge Canary',
versionRegex: /Microsoft Edge.+?(\S*(?= canary)|(?<=canary )\S*)/mi,
binary: ['edge-canary', 'microsoft-edge-canary'],
minSupportedVersion: MIN_EDGE_VERSION,
},
{
name: 'edge',
family: 'chromium',
channel: 'beta',
displayName: 'Edge Beta',
versionRegex: /Microsoft Edge.+?(\S*(?= beta)|(?<=beta )\S*)/mi,
binary: ['edge-beta', 'microsoft-edge-beta'],
minSupportedVersion: MIN_EDGE_VERSION,
},
{
name: 'edge',
family: 'chromium',
channel: 'dev',
displayName: 'Edge Dev',
versionRegex: /Microsoft Edge.+?(\S*(?= dev)|(?<=dev )\S*)/mi,
binary: ['edge-dev', 'microsoft-edge-dev'],
minSupportedVersion: MIN_EDGE_VERSION,
},
]