bulky-sundown-74498
07/16/2021, 4:13 PM/e2e
working directory and if you could imagine listing ituser
07/16/2021, 4:14 PMe2e
is at the root level of that structure. Hence I'm mapping my /cypress
directory to the e2e
directory within the Cypress container.user
07/16/2021, 4:29 PMcypress.json
supposed to be on the same level with cypress
directory. I have it that way and yet it throws error.user
07/16/2021, 5:32 PMdocker run -v $PWD:/e2e -w /e2e --entrypoint=cypress --network tdd_default cypress/included:7.7.0 run
command did the trick. But don't ask me why it works since I don't have e2e
directory. That part is left mystery.ancient-wire-34126
07/16/2021, 5:45 PMancient-wire-34126
07/16/2021, 5:51 PMuser
07/17/2021, 5:52 AMuser
07/17/2021, 12:02 PMancient-wire-34126
07/17/2021, 12:28 PMuser
07/17/2021, 12:43 PMancient-wire-34126
07/17/2021, 3:43 PMancient-wire-34126
07/17/2021, 3:43 PMuser
07/17/2021, 3:51 PMancient-wire-34126
07/17/2021, 6:48 PMuser
07/17/2021, 7:07 PMuser
07/17/2021, 7:12 PMancient-wire-34126
07/17/2021, 8:27 PMuser
07/17/2021, 9:53 PMconst { lighthouse, pa11y, prepareAudit } = require('cypress-audit');
const fs = require('fs');
const ReportGenerator = require('lighthouse/report/report-generator');
module.exports = (on, config) => {
on('before:browser:launch', (browser, launchOptions) => {
prepareAudit(launchOptions);
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push('--disable-gpu');
return launchOptions;
}
});
on('task', {
lighthouse: lighthouse((lighthouseReport) => {
fs.writeFileSync(`cypress/lhreport-${cy.location('pathname')}.html`, ReportGenerator.generateReport(lighthouseReport.lhr, 'html'));
}),
pa11y: pa11y(),
});
};
My example test case:
const customThresholds = {
performance: 0,
accessibility: 0,
seo: 0,
'best-practices': 0,
pwa: 0,
};
const desktopConfig = {
extends: 'lighthouse:default',
formFactor: 'desktop',
screenEmulation: {disabled: true}
};
it('Should load Dashboard', () => {
cy.wait(500);
cy.location('pathname', { timeout: 3000 }).should('eq', '/accounts/overview');
cy.lighthouse(customThresholds, desktopConfig);
cy.pa11y();
});
user
07/18/2021, 9:38 AMancient-wire-34126
07/18/2021, 12:46 PMuser
07/18/2021, 1:19 PM'baseUrl': 'http://<service><port>'
and then specifying url by cy.visit('/')
for root route. What if I want to navigate to "/something"
? I get status code 200 on "/"
but getting 404 on others.steep-account-67575
07/19/2021, 12:14 PM@cypress/watch-preprocessor
in GitHub actions. Simply requiring it is throwing this error:
1) An uncaught error was detected outside of a test:
SyntaxError: The following error originated from your test code, not from Cypress.
> Cannot use import statement outside a module
This is with Cypress 7.7.0, Chrome 91, Node 14.15.4. I think I eliminated all other factors by now and can get my build working by not using the watch preprocesser in GH actions.user
07/19/2021, 2:19 PMancient-wire-34126
07/19/2021, 3:34 PMancient-wire-34126
07/19/2021, 3:35 PMts
cy.intercept({ method: 'POST', url: 'https://cognito-idp.us-east-1.amazonaws.com' }, (req) => {
const { body } = req
if (body.AuthFlow && body.AuthFlow === 'CUSTOM_AUTH') {
cy.fixture('cognito/email-valid').then(fixture => {
return req.reply({ fixture })
})
}
})
This, for some reason, doesn't work and I have no clue how to get around itancient-wire-34126
07/19/2021, 3:49 PMThe cy command you invoked inside the promise was:
> cy.readFile()
>
I mean how is that a Promise?ancient-wire-34126
07/19/2021, 3:50 PMcy.intercept
ancient-wire-34126
07/19/2021, 4:04 PMts
cy.intercept({ method: 'POST', url: 'https://cognito-idp.us-east-1.amazonaws.com' }, (req) => {
const { body } = req
if (body.AuthFlow && body.AuthFlow === 'CUSTOM_AUTH') {
req.alias = 'customAuthValid'
req.reply({ fixture: 'cognito/email-valid.json' })
}
if (body.ChallengeName && body.ChallengeName === 'CUSTOM_CHALLENGE') {
req.alias = 'customChallengeValid'
req.reply({ fixture: 'cognito/challenge-valid.json' })
}
})
This works because... reasonsancient-wire-34126
07/19/2021, 4:05 PM