Comments (7)
As an update....
I have found a workaround by using Lighthouse's custom gatherers/audits. There's a lifecycle hook in the custom gatherer (beforePass
) that runs in the new tab before the url is visited for the audit. At this point, we can add in any needed sessionStorage
values which will be present on the tab once the url is visited / app is loaded.
I'll update my repo I referenced above with the workaround and post here once that's done. Examples are usually helpful!
That all being said, it would be really cool if this plugin had an option to pass in a function that could run in the new Lighthouse before visiting the URL without having to implement this fake custom gatherer / audit. I'll leave that decision up to you :)
from cypress-audit.
I'll try to take a look when I'll have some spare time 😊 New job is taking a bunch of my time 😅 (and thank you for the complete issue and explanations, really appreciated 🙏🏻 )
from cypress-audit.
https://github.com/olyhaa-aetna/simple-auth-example has been updated to include the custom gatherer and audit which populates sessionStorage
with values before the Lighthouse scan is run.
from cypress-audit.
@olyhaa-aetna Can you try with the workaround from this issue #65 (comment)?
from cypress-audit.
Hi @MuckT!
It looks like that workaround uses localStorage
to remember login credentials between tests. However, our app uses sessionStorage
.
We already have the tokens in the sessionStorage
carry over in-between tests via running in the before
/ after
of each test. This seems to be working fine (from the perspective of the Cypress tests). However, these are not run in the new Lighthouse tab, so the session data is not transferred over.
We are never visiting an external url for authentication - we just store a mocked token in the sessionStorage
.
from cypress-audit.
Oh wow, very nice workaround 🤯 . And thank you so much for providing this exampe 🙏🏻 . Would you mind if we (you or I, depending if you want to make the PR) add a link to the example to orientate people that are using session storage?
Thanks for the amazing example, again 🙏🏻
from cypress-audit.
I'm closing this issue since you've found a way to fix it. I will add a link to your repo in the documentation :)
from cypress-audit.
Related Issues (20)
- Light House: Save Trace File after audit HOT 1
- More detailed failure report HOT 1
- Error: Webpack Compilation Error: Module parse failed: Unexpected token (151:33) HOT 2
- Lighthouse check is skipped when we pass chrome binary path in cypress run HOT 1
- cy.pa11y() fails with the following error: The "listener" argument must be of type function. Received undefined
- Cypress Lighthouse test failing after latest Chrome Version Upgrade (Version 111.0.5563.64 ) HOT 30
- Can't install v1.4.1 via npm HOT 1
- Cypress-Audit support for Lighthouse-user-flow
- Unexpected token '||=' HOT 3
- Create output report (html and json) doesn't work HOT 4
- CRA example does not work out of the box: Unexpected token '??=' HOT 1
- pa11y/cypress integration with typescript
- Cypress screenshot error since Chrome 107
- cy.task('lighthouse') failed with the following error: > Unexpected token '??=' HOT 2
- VSCode Pa11y and typescript - /node_modules/.pnpm/@[email protected]/node_modules/@cypress-audit/pa11y/index.d.ts' is not a module HOT 1
- Seeing invalid arguments compilation error with HTML Reports "Expected 0 arguments, but got 1."
- This plugin doesn't work with Cypress version >= 13
- When cy.lighthouse() command is run, Cypress opens a new browser tab HOT 1
- Typescript: compilation error when using plugin with and Cypress >= 13.5.1 (no exported member BrowserLaunchOptions)
- 3rd party authentication scenario: lighthouse runs the login page on a separate new tab
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cypress-audit.