@dollarshaveclub/e2e
Advanced tools
Comparing version 4.0.0-rc.0 to 4.1.0-rc.0
@@ -210,5 +210,12 @@ const debug = require('debug')('dsc-e2e:lib:run-test') | ||
const page = await browser.newPage() | ||
page.on('request', req => { | ||
console.log('REQUEST URL', req.url) | ||
}) | ||
// Each page should block non-essential assets/scripts from loading | ||
const isRequestToHost = (request) => request.url().includes(process.env.FACE_E2E_HOSTNAME) | ||
const isVisualAssetRequest = request => ['stylesheet', 'image', 'font'].includes(request.resourceType()) | ||
await page.setRequestInterception(true) | ||
page.on('request', request => | ||
(!isRequestToHost(request) || isVisualAssetRequest(request)) | ||
? request.abort() | ||
: request.continue() | ||
) | ||
await page.setViewport({ | ||
@@ -412,3 +419,3 @@ width: client.width, | ||
// Metrics Events | ||
parseErrorEmitEvent(result.error, this.context, this.eventsEmitter) | ||
parseErrorEmitEvent(result, this.context, this.eventsEmitter) | ||
@@ -415,0 +422,0 @@ return false // SKIP |
@@ -50,3 +50,6 @@ | ||
const parseErrorEmitEvent = (err, ctx, emitter) => { | ||
const parseErrorEmitEvent = (result, ctx, emitter) => { | ||
const err = result.error | ||
const stepName = result.name | ||
if (!ctx || !emitter) return | ||
@@ -56,5 +59,5 @@ const testId = ctx.test.id | ||
if (err.code === 'ERR_ASSERTION') { | ||
emitter.emit('run-step.assertion-failure', { testId }) | ||
emitter.emit('run-step.assertion-failure', { testId, stepName }) | ||
} else if (err.code === 'ETIMEDOUT') { | ||
emitter.emit('run-step.timeout', { testId }) | ||
emitter.emit('run-step.timeout', { testId, stepName }) | ||
} else if (!err.code) { | ||
@@ -64,8 +67,8 @@ const errString = err.toString().toLowerCase() | ||
if (errString.includes('timeout') || errString.includes('timed out')) { | ||
emitter.emit('run-step.timeout', { testId }) | ||
emitter.emit('run-step.timeout', { testId, stepName }) | ||
} else { | ||
emitter.emit('run-step.unspecified-failure', { testId }) | ||
emitter.emit('run-step.unspecified-failure', { testId, stepName }) | ||
} | ||
} | ||
emitter.emit('run-step.failure', { testId }) | ||
emitter.emit('run-step.failure', { testId, stepName }) | ||
} | ||
@@ -72,0 +75,0 @@ |
{ | ||
"name": "@dollarshaveclub/e2e", | ||
"version": "4.0.0-rc.0", | ||
"version": "4.1.0-rc.0", | ||
"description": "Make End-to-End Testing Great for Once", | ||
@@ -5,0 +5,0 @@ "main": "lib", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41853
1022
13