Giter Club home page Giter Club logo

Comments (7)

olyhaa-aetna avatar olyhaa-aetna commented on May 20, 2024 5

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.

mfrachet avatar mfrachet commented on May 20, 2024 1

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.

olyhaa-aetna avatar olyhaa-aetna commented on May 20, 2024 1

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.

MuckT avatar MuckT commented on May 20, 2024

@olyhaa-aetna Can you try with the workaround from this issue #65 (comment)?

from cypress-audit.

olyhaa-aetna avatar olyhaa-aetna commented on May 20, 2024

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.

mfrachet avatar mfrachet commented on May 20, 2024

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.

mfrachet avatar mfrachet commented on May 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.