Skip to content

Commit 63dc179

Browse files
committed
assert page navigated
1 parent e6bbaec commit 63dc179

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

puppeteer/click.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
'use scrict'
1515

1616
import puppeteer from 'puppeteer-core';
17+
import assert from 'assert';
1718

1819
// ws address
1920
const browserAddress = process.env.BROWSER_ADDRESS ? process.env.BROWSER_ADDRESS : 'ws://127.0.0.1:9222';
@@ -35,6 +36,8 @@ await page.goto('http://127.0.0.1:1234', {waitUntil: 'load'});
3536

3637
await page.click("a[href='campfire-commerce/']");
3738

39+
assert.strictEqual(page.url(), 'http://127.0.0.1:1234/campfire-commerce/', 'The new page URL is not as expected.');
40+
3841
await page.close();
3942
await context.close();
4043
await browser.disconnect();

runner/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func run(ctx context.Context, args []string, stdout, stderr io.Writer) error {
100100
{Bin: "node", Args: []string{"puppeteer/cdp.js"}, Env: []string{"RUNS=10"}},
101101
{Bin: "node", Args: []string{"puppeteer/dump.js"}, Env: []string{"URL=http://127.0.0.1:1234/campfire-commerce/"}},
102102
{Bin: "node", Args: []string{"puppeteer/links.js"}, Env: []string{"URL=http://127.0.0.1:1234/campfire-commerce/"}},
103-
{Bin: "node", Args: []string{"puppeteer/click.js"}, Env: []string{"URL=http://127.0.0.1:1234/campfire-commerce/"}},
103+
{Bin: "node", Args: []string{"puppeteer/click.js"}},
104104
{Bin: "node", Args: []string{"playwright/connect.js"}},
105105
{Bin: "node", Args: []string{"playwright/cdp.js"}, Env: []string{"RUNS=2"}},
106106
{Bin: "go", Args: []string{"run", "fetch/main.go", "http://127.0.0.1:1234/"}, Dir: "chromedp"},

0 commit comments

Comments
 (0)