Skip to content

Commit

Permalink
docs(user-flows): use new api location (#14533)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine committed Nov 15, 2022
1 parent 635b9ca commit 579c408
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/user-flows.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ In DevTools, navigation is easy: ensure it's the selected mode and then click _A
```js
import {writeFileSync} from 'fs';
import puppeteer from 'puppeteer';
import lighthouse from 'lighthouse/core/api.js';
import {startFlow} from 'lighthouse';

(async function() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
const flow = await lighthouse.startFlow(page);
const flow = await startFlow(page);

// Navigate with a URL
await flow.navigate('https://example.com');
Expand Down Expand Up @@ -90,13 +90,13 @@ In DevTools, select "Timespan" as the mode and click _Start timespan_. Record wh
```js
import {writeFileSync} from 'fs';
import puppeteer from 'puppeteer';
import lighthouse from 'lighthouse/core/api.js';
import {startFlow} from 'lighthouse';

(async function() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://secret.login');
const flow = await lighthouse.startFlow(page);
const flow = await startFlow(page);

await flow.beginTimespan();
await page.type('#password', 'L1ghth0useR0cks!');
Expand Down Expand Up @@ -125,13 +125,13 @@ In DevTools, select "Snapshot" as the mode. Set up the page in the state you wan
```js
import {writeFileSync} from 'fs';
import puppeteer from 'puppeteer';
import lighthouse from 'lighthouse/core/api.js';
import {startFlow} from 'lighthouse';

(async function() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
const flow = await lighthouse.startFlow(page);
const flow = await startFlow(page);

await page.click('#expand-sidebar');
await flow.snapshot();
Expand Down Expand Up @@ -164,7 +164,7 @@ The below example codifies a user flow for an ecommerce site where the user navi
import {writeFileSync} from 'fs';
import puppeteer from 'puppeteer';
import * as pptrTestingLibrary from 'pptr-testing-library';
import lighthouse from 'lighthouse/core/api.js';
import {startFlow} from 'lighthouse';

const {getDocument, queries} = pptrTestingLibrary;

Expand All @@ -182,7 +182,7 @@ async function search(page) {
// Setup the browser and Lighthouse.
const browser = await puppeteer.launch();
const page = await browser.newPage();
const flow = await lighthouse.startFlow(page);
const flow = await startFlow(page);

// Phase 1 - Navigate to the landing page.
await flow.navigate('https://www.bestbuy.com');
Expand Down

0 comments on commit 579c408

Please sign in to comment.