Skip to content

Commit

Permalink
(@wdio/lighthouse-service): migrate over from devtools service
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann committed Apr 27, 2024
1 parent b14befd commit 02fd52c
Show file tree
Hide file tree
Showing 68 changed files with 61 additions and 334 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ __Did you build a WebdriverIO service or reporter?__ That's awesome! Please add

- [@wdio/appium-service](https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-appium-service) - A WebdriverIO service to start & stop Appium Server
- [@wdio/browserstack-service](https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-browserstack-service) - A WebdriverIO service that can be used to use BrowserStack Test Observability which is a reporting, debugging, and test suite quality tracking tool for any test running anywhere. The service also helps for a better integration with the BrowserStack grid if you're running tests on the grid.
- [@wdio/devtools-service](https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-devtools-service) - A WebdriverIO service that allows you to run Chrome DevTools commands in your tests
- [@wdio/lighthouse-service](https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-lighthouse-service) - A WebdriverIO service that integrates Google Lighthouse commands to use it for automate tests
- [@wdio/firefox-profile-service](https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-firefox-profile-service) - A WebdriverIO service that lets you define your Firefox profile in your wdio.conf.js
- [@wdio/sauce-service](https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-sauce-service) - A WebdriverIO service that provides a better integration into Sauce Labs
- [@wdio/shared-store-service](https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-shared-store-service) - A WebdriverIO service to exchange data across processes
Expand Down
2 changes: 1 addition & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ We are organising all roadmap items [in GitHub](https://github.com/orgs/webdrive
|---------|-------------|
|[Component Testing](https://github.com/orgs/webdriverio/projects/1)|Ideas, issues and enhancements related to unit and component testing capabilities with WebdriverIO.|
|[Core Initiatives](https://github.com/orgs/webdriverio/projects/2)|Everything related to WebdriverIOs core functionality and technical stack.|
|[Devtools and Google Lighthouse Integration](https://github.com/orgs/webdriverio/projects/3)|The @wdio/devtools-service provides automation capabilities beyond WebDriver (e.g. get network logs, tracing, performance etc). There is a variety of things that can be added to help people test their applications (e.g. better mocking/stubbing of browser requests and responses). Also it would be desire-able if the service would work in Firefox and Edge in the same way.|
|[Google Lighthouse Integration](https://github.com/orgs/webdriverio/projects/3)|The @wdio/lighthouse-service provides automation capabilities beyond WebDriver (e.g. PWA or performance testing). It would be desire-able if the service would work in Firefox and Edge in the same way.|
|[Network Recording](https://github.com/orgs/webdriverio/projects/4)|We want to make it seamless to assert network behavior of the browser. Inspired by Jest and their Snapshot functionality we can implement similar behavior in WebdriverIO.|
|[Improved Frontend Framework Support](https://github.com/orgs/webdriverio/projects/5)|Almost all web applications are written in either React, Angular, Vue, Svelte or a different frontend framework that allows you to ship modern web application today. These frameworks are often difficult to deal with when it comes to selecting elements or introspection of app states and important parts. WebdriverIO has the capabilities to help the user to test these applications better.|
|[Better Debugging Capabilities](https://github.com/orgs/webdriverio/projects/6)|There are already a [handful options](https://webdriver.io/docs/debugging.html) to debug test code with WebdriverIO. However it is still not straight forward to use native Node.js debugging capabilities which requires special handling of workers and sub processes. Goal has to be that developers can use their IDEs to set breakpoints to debug.|
Expand Down
2 changes: 1 addition & 1 deletion __mocks__/lighthouse/lighthouse-core/gather/driver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { vi } from 'vitest'
import tracelog from '../../../../packages/wdio-devtools-service/tests/__fixtures__/tracelog.json' assert { type: 'json' }
import tracelog from '../../../../packages/wdio-lighthouse-service/tests/__fixtures__/tracelog.json' assert { type: 'json' }

export const beginTrace = vi.fn()
export const endTrace = vi.fn().mockResolvedValue(tracelog)
Expand Down
2 changes: 1 addition & 1 deletion examples/wdio/vite-vue-example/wdio.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const config: Options.Testrunner = {
// Set specific log levels per logger
// loggers:
// - webdriver, webdriverio
// - @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service
// - @wdio/browserstack-service, @wdio/lighthouse-service, @wdio/sauce-service
// - @wdio/mocha-framework, @wdio/jasmine-framework
// - @wdio/local-runner
// - @wdio/sumologic-reporter
Expand Down
2 changes: 1 addition & 1 deletion packages/wdio-cli/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const SUPPORTED_PACKAGES = {
{ name: 'sauce', value: '@wdio/sauce-service$--$sauce' },
{ name: 'testingbot', value: '@wdio/testingbot-service$--$testingbot' },
{ name: 'browserstack', value: '@wdio/browserstack-service$--$browserstack' },
{ name: 'devtools', value: '@wdio/devtools-service$--$devtools' },
{ name: 'lighthouse', value: '@wdio/lighthouse-service$--$lighthouse' },
{ name: 'vscode', value: 'wdio-vscode-service$--$vscode' },
{ name: 'electron', value: 'wdio-electron-service$--$electron' },
{ name: 'appium', value: '@wdio/appium-service$--$appium' },
Expand Down
2 changes: 1 addition & 1 deletion packages/wdio-cli/src/templates/wdio.conf.tpl.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ if (answers.isUsingTypeScript) {
// Set specific log levels per logger
// loggers:
// - webdriver, webdriverio
// - @wdio/browserstack-service, @wdio/devtools-service, @wdio/sauce-service
// - @wdio/browserstack-service, @wdio/lighthouse-service, @wdio/sauce-service
// - @wdio/mocha-framework, @wdio/jasmine-framework
// - @wdio/local-runner
// - @wdio/sumologic-reporter
Expand Down
284 changes: 0 additions & 284 deletions packages/wdio-devtools-service/tests/gatherer/coverage.test.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ console.log(nodeId) // outputs: [ 40, 41, 42, 43, 44, 45 ]

### `startTracing(categories, samplingFrequency)` Command

Start tracing the browser. You can optionally pass in custom tracing categories (defaults to [this list](https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-devtools-service/src/constants.js#L1-L9)) and the sampling frequency (defaults to `10000`).
Start tracing the browser. You can optionally pass in custom tracing categories (defaults to [this list](https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-lighthouse-service/src/constants.js#L1-L9)) and the sampling frequency (defaults to `10000`).

```js
await browser.startTracing()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@
"version": "9.0.0-alpha.0",
"description": "A WebdriverIO service that allows you to run Chrome DevTools commands in your tests",
"author": "Christian Bromann <mail@bromann.dev>",
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-devtools-service",
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-lighthouse-service",
"license": "MIT",
"engines": {
"node": ">=18"
},
"repository": {
"type": "git",
"url": "git://github.com/webdriverio/webdriverio.git",
"directory": "packages/wdio-devtools-service"
"directory": "packages/wdio-lighthouse-service"
},
"keywords": [
"webdriver",
"wdio",
"wdio-service",
"devtools",
"lighthouse",
"chrome",
"selenium",
"performance",
"audit",
"testing",
"pwa",
"progressive web app",
"test"
],
"bugs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {
import type { Trace } from './gatherer/trace.js'
import type { CDPSessionOnMessageObject } from './gatherer/devtools.js'

const log = logger('@wdio/devtools-service:Auditor')
const log = logger('@wdio/lighthouse-service:Auditor')

type RunAuditResult = [string, LHAuditResult | ErrorAudit]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import PWAGatherer from './gatherer/pwa.js'
import TraceGatherer from './gatherer/trace.js'
import CoverageGatherer from './gatherer/coverage.js'

const log = logger('@wdio/devtools-service:CommandHandler')
const log = logger('@wdio/lighthouse-service:CommandHandler')
const TRACE_COMMANDS = ['click', 'navigateTo', 'url']

function isCDPSessionOnMessageObject(
Expand Down

0 comments on commit 02fd52c

Please sign in to comment.