-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FI-705 fix: stricter type of
expect
function
fix: support usual promises in `expect` function feat: add field `maxIntervalBetweenRequestsInMs` ot abstract class `Page` feat: add examples of `mapBackendResponseErrorToLog`/`mapBackendResponseToLog` tests: more tests of types of selectors methods chore: update nodejs to current LTS (20.10.0) chore: update alpine to 3.18.5 fix: support new contributor in `updateChangelog` script refactor: move selectors code to `utils/selectors` refactor: remove `utils/locators` fix: use default cursor for empty expanded steps feat: add duration to backend response logs
- Loading branch information
Showing
64 changed files
with
574 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import {getDurationWithUnits} from 'e2ed/utils'; | ||
|
||
import type {MapBackendResponseErrorToLog} from 'autotests/types/packSpecific'; | ||
|
||
/** | ||
* Maps responses with errors from the backend to "red" logs (as errors) during the test. | ||
* It is assumed that the function will select responses with | ||
* statuse codes of 400 and higher (client and server errors). | ||
* Backend responses with errors are accumulated in separate "red" log step | ||
* (with `logEventStatus: 'failed'`). | ||
* Log the `responseBody` field carefully, as the body of backend response can be very large. | ||
* If the function returns `undefined`, the response is not logged (skipped). | ||
*/ | ||
export const mapBackendResponseErrorToLog: MapBackendResponseErrorToLog = ({ | ||
completionTimeInMs, | ||
request, | ||
responseBody, | ||
responseHeaders, | ||
statusCode, | ||
}) => { | ||
if (statusCode < 400) { | ||
return undefined; | ||
} | ||
|
||
const {requestBody, utcTimeInMs, ...requestWithoutBody} = request ?? {}; | ||
|
||
const maybeWithDuration: {duration?: string} = {}; | ||
|
||
if (completionTimeInMs !== undefined && utcTimeInMs !== undefined) { | ||
maybeWithDuration.duration = getDurationWithUnits(completionTimeInMs - utcTimeInMs); | ||
} | ||
|
||
return { | ||
...maybeWithDuration, | ||
request: { | ||
requestBody: requestBody instanceof Buffer ? String(requestBody) : requestBody, | ||
...requestWithoutBody, | ||
}, | ||
responseBody: responseBody instanceof Buffer ? String(responseBody) : responseBody, | ||
responseHeaders, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import {getDurationWithUnits} from 'e2ed/utils'; | ||
|
||
import type {MapBackendResponseToLog} from 'autotests/types/packSpecific'; | ||
|
||
/** | ||
* Maps responses from the backend to logs during the test. | ||
* Backend responses received during a certain test step are accumulated | ||
* in an array in the `backendResponses` field of the log of this step. | ||
* Log the `responseBody` field carefully, as the body of backend response can be very large. | ||
* If the function returns `undefined`, the response is not logged (skipped). | ||
*/ | ||
export const mapBackendResponseToLog: MapBackendResponseToLog = ({ | ||
completionTimeInMs, | ||
request, | ||
responseBody, | ||
responseHeaders, | ||
statusCode, | ||
}) => { | ||
if (statusCode >= 400) { | ||
return undefined; | ||
} | ||
|
||
if (request) { | ||
const maybeWithDuration: {duration?: string} = {}; | ||
|
||
if (completionTimeInMs !== undefined && request.utcTimeInMs !== undefined) { | ||
maybeWithDuration.duration = getDurationWithUnits(completionTimeInMs - request.utcTimeInMs); | ||
} | ||
|
||
return {...maybeWithDuration, statusCode, url: request?.url}; | ||
} | ||
|
||
return { | ||
responseBody: responseBody instanceof Buffer ? String(responseBody) : responseBody, | ||
responseHeaders, | ||
statusCode, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.