-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add cypress-audits to execute lighthouse during end-2-end tests #14681
add cypress-audits to execute lighthouse during end-2-end tests #14681
Conversation
Looks like some configs passes the audit some not (guess somehow depends on the shared runner). I think it would be best to have a dedicated command e.g. npm run audits which just executes the audit spec while the default cypress run does not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The results seem to change a lot each run.
That may be related to virtual environment shared resources.
So IMO it should be optional and disabled by default.
A test enabling it should be discussed separately, probably an application with no entity with focus on pwa.
generators/cypress/templates/src/test/javascript/cypress/plugins/index.ts.ejs
Outdated
Show resolved
Hide resolved
generators/cypress/templates/src/test/javascript/cypress/plugins/index.ts.ejs
Outdated
Show resolved
Hide resolved
A custom command would be great too. |
I did not expect such results, but yes I will disable it by default and it must be started e.g. with |
-%> | ||
describe('Audits', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we are trying to calculate the lighthouse score for the application landing page (/
route). For more comprehensive coverage, we should do that for each route in our application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you expect huge differences between them? But of course that could be extended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I don't know. I haven't looked into cypress audits and it's capabilities. Do you have assertions to check on best practices? If yes, then, you may want to run the audit for each page.
In the svelte
blueprint, I used a different approach and the integration is only in the CI (not in generated code). You can of course do that in the generated code, but that was not the concern that I want to handle at moment.
49130cb
to
f84506c
Compare
…ns/index.ts.ejs Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
…ns/index.ts.ejs Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
I have changed it such that
|
…ede/generator-jhipster into 14615-continous-lighthouse-audits
8b25335
to
4b6c6b2
Compare
generators/cypress/templates/src/test/javascript/cypress/plugins/index.ts.ejs
Outdated
Show resolved
Hide resolved
generators/cypress/templates/src/test/javascript/cypress/plugins/index.ts.ejs
Outdated
Show resolved
Hide resolved
generators/cypress/templates/src/test/javascript/cypress/plugins/index.ts.ejs
Outdated
Show resolved
Hide resolved
generators/cypress/templates/src/test/javascript/cypress/plugins/index.ts.ejs
Outdated
Show resolved
Hide resolved
generators/cypress/templates/src/test/javascript/cypress/plugins/index.ts.ejs
Outdated
Show resolved
Hide resolved
generators/cypress/templates/src/test/javascript/cypress/plugins/index.ts.ejs
Outdated
Show resolved
Hide resolved
generators/cypress/templates/src/test/javascript/cypress/integration/lighthouse.audits.ts.ejs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to remove whitespaces, but removed lines.
LGTM.
Thanks @mshima for your review. you are awesome! |
Bounty claimed https://opencollective.com/generator-jhipster/expenses/40724 |
@atomfrede : approved |
Right now the cypress audit uses desktop emulation and no cpu slowdown. With 4x cpu slowdown I get very bad results with angular, so I am not sure what happens in our CI with the current thresholds, especially when the frontend is not packaged in prod mode. Maybe we can add an environment variable to skip audits (e.g. when running in dev mode).
Closes #14615
Please make sure the below checklist is followed for Pull Requests.
When you are still working on the PR, consider converting it to Draft (bellow reviewers) and adding
skip-ci
label, you can still see CI build result at your branch.