Last active
October 19, 2021 07:53
-
-
Save mnanchev/25d1237e82453247a9319eca8cfa6e47 to your computer and use it in GitHub Desktop.
Loading blueprint for the canary monitoring
This file contains hidden or 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
const loadBlueprint = async function() { | |
const response = login(USERNAME, PASSWORD); | |
const bearerToken = (await response).AuthenticationResult.IdToken; | |
const urls = ['https://probkotestov.io/api-users/setting']; | |
// Set screenshot option | |
const takeScreenshot = true; | |
/* Disabling default step screen shots taken during Synthetics.executeStep() calls | |
* Step will be used to publish metrics on time taken to load dom content but | |
* Screenshots will be taken outside the executeStep to allow for page to completely load with domcontentloaded | |
* You can change it to load, networkidle0, networkidle2 depending on what works best for you. | |
*/ | |
syntheticsConfiguration.disableStepScreenshots(); | |
syntheticsConfiguration.setConfig({ | |
continueOnStepFailure: true, | |
includeRequestHeaders: true, // Enable if headers should be displayed in HAR | |
includeResponseHeaders: true, // Enable if headers should be displayed in HAR | |
restrictedHeaders: [], // Value of these headers will be redacted from logs and reports | |
restrictedUrlParameters: [], // Values of these url parameters will be redacted from logs and reports | |
}); | |
let page = await synthetics.getPage(); | |
page.setExtraHTTPHeaders({ | |
'accept': 'application/json', | |
'Authorization': 'Bearer ' + bearerToken, | |
}); | |
for (const url of urls) { | |
await loadUrl(page, url, takeScreenshot); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment