Possible test framework-agnostic enhancements
It would be nice to keep this package/library test framework-agnostic, yet expand capabilities to allow for deeper tests. Along these lines I have been thinking that the ability to pull out individual results could be quite useful. Flow might be something like this:
// in setup portion of a test
// maybe just specify categories, without thresholds, since in this case they would not be used
const lhr = await getLighthouseReport({
page: page,
thresholds: {
performance: 50,
accessibility: 50,
'best-practices': 50,
seo: 50,
pwa: 50,
},
port: 9222,
});
// in examples we might:
const perfScore = await getCategoryScore('performance');
// example of a simple, Chai, expect
expect(perfScore).to.be.at.least(50);
Rather rough concept right now, but the idea is: run an Audit and allow user/tester to assert/expect/validate only the portions of concern. It might be as broad as Categories (as in the example flow above).
Or perhaps the concern (for a given test) is: Performance --> first-contentful-paint and interactive
Could go coarse-grained or fine-grained.
@tabermike you may run playAudit with ignoreError set to true and then do any assertions you like.
Ex
const results = await playAudit({ url, port, ignoreError: true })
expect(results.lhr.categories['performance'].score * 100).toBeGreaterThan(50)
@grybykm we can think about factory methods to get easy access on the metrics.
Помогите мне найти где-нибудь примеры кода нормальных тестов с playwright-lighthouse где есть авторизация и т.д. Ещё мне нужно узнать есть ли тут интеграции с Docker, чтобы запускать его в докер-контейнерах.