feat: Added configuration parameter that controls the amount of connection attempts to the browser (#25848)

* feat: Added configuration parameter that controls the amount of connection attempts to the browser

* Revert "feat: Added configuration parameter that controls the amount of connection attempts to the browser"

This reverts commit 4fd816a7fe.

* feat: Added configuration parameter that controls the amount of connection attempts to the browser

* feat: Adjusted naming to match other env Variables

* Fix Off by one error in firefox utils

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>

* Updated Changelog

* Update cli/CHANGELOG.md

* Update cli/CHANGELOG.md

* Update cli/CHANGELOG.md

* Trying to fix unit test

---------

Co-authored-by: fburgard <fburgard@testfabrik.com>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
This commit is contained in:
Malvitus
2023-03-02 22:56:37 +01:00
committed by GitHub
parent fbc5527703
commit fcac397fe8
5 changed files with 15 additions and 7 deletions
+5 -1
View File
@@ -1,8 +1,12 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 12.7.1
## 12.8.0
_Released 03/14/2023 (PENDING)_
**Features:**
- It is now possible to control the number of connection attempts to the browser using the CYPRESS_CONNECT_RETRY_THRESHOLD Environment Variable. Learn more [here](https://docs.cypress.io/guides/references/advanced-installation#Environment-variables). Addressed in [#25848](https://github.com/cypress-io/cypress/pull/25848).
**Dependency Updates:**
- Upgraded [`mocha-junit-reporter`](https://github.com/michaelleeallen/mocha-junit-reporter) from `2.1.0` to `2.2.0` to be able to use [new placeholders](https://github.com/michaelleeallen/mocha-junit-reporter/pull/163) such as `[suiteFilename]` or `[suiteName]` when defining the test report name. Addressed in [#25922](https://github.com/cypress-io/cypress/pull/25922).
+2 -2
View File
@@ -1063,8 +1063,8 @@ export const AllCypressErrors = {
${fmt.stackTrace(arg1)}`
},
CDP_RETRYING_CONNECTION: (attempt: string | number, browserName: string) => {
return errTemplate`Still waiting to connect to ${fmt.off(_.capitalize(browserName))}, retrying in 1 second ${fmt.meta(`(attempt ${attempt}/62)`)}`
CDP_RETRYING_CONNECTION: (attempt: string | number, browserName: string, connectRetryThreshold: number) => {
return errTemplate`Still waiting to connect to ${fmt.off(_.capitalize(browserName))}, retrying in 1 second ${fmt.meta(`(attempt ${attempt}/${connectRetryThreshold})`)}`
},
UNEXPECTED_BEFORE_BROWSER_LAUNCH_PROPERTIES: (arg1: string[], arg2: string[]) => {
return errTemplate`\
@@ -1009,7 +1009,7 @@ describe('visual error templates', () => {
},
CDP_RETRYING_CONNECTION: () => {
return {
default: [1, 'chrome'],
default: [1, 'chrome', 62],
}
},
UNEXPECTED_BEFORE_BROWSER_LAUNCH_PROPERTIES: () => {
+3 -1
View File
@@ -33,6 +33,8 @@ const getTabId = (tab) => {
}
const getDelayMsForRetry = (i) => {
let maxRetries = Number.parseInt(process.env.CYPRESS_CONNECT_RETRY_THRESHOLD ? process.env.CYPRESS_CONNECT_RETRY_THRESHOLD : '62')
if (i < 10) {
return 100
}
@@ -41,7 +43,7 @@ const getDelayMsForRetry = (i) => {
return 500
}
if (i < 63) {
if (i <= maxRetries) {
return 1000
}
+4 -2
View File
@@ -5,6 +5,8 @@ import utils from './utils'
const errors = require('../errors')
export function _getDelayMsForRetry (i, browserName) {
let maxRetries = Number.parseInt(process.env.CYPRESS_CONNECT_RETRY_THRESHOLD ? process.env.CYPRESS_CONNECT_RETRY_THRESHOLD : '62')
if (i < 10) {
return 100
}
@@ -13,8 +15,8 @@ export function _getDelayMsForRetry (i, browserName) {
return 500
}
if (i < 63) { // after 5 seconds, begin logging and retrying
errors.warning('CDP_RETRYING_CONNECTION', i, browserName)
if (i <= maxRetries) { // after 5 seconds, begin logging and retrying
errors.warning('CDP_RETRYING_CONNECTION', i, browserName, maxRetries)
return 1000
}