Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: fix console-api tests when tracing was enabled (#10782)

Max Schmitta4e68dbac116
diff --git a/tests/inspector/console-api.spec.ts b/tests/inspector/console-api.spec.ts
index 02148a43de..1e04ad4897 100644
--- a/tests/inspector/console-api.spec.ts
+++ b/tests/inspector/console-api.spec.ts
@@ -36,7 +36,7 @@ it.afterEach(async ({ recorderPageGetter }) => {
it('should support playwright.$, playwright.$$', async ({ page }) => {
const body = await page.evaluateHandle('playwright.$("body")');
- expect(body.toString()).toBe('JSHandle@node');
+ expect(await body.evaluate<string, HTMLBodyElement>((node: HTMLBodyElement) => node.nodeName)).toBe('BODY');
const length = await page.evaluate('playwright.$$("body").length');
expect(length).toBe(1);
});
@@ -49,7 +49,7 @@ it('should support playwright.selector', async ({ page }) => {
it('should support playwright.locator.value', async ({ page }) => {
await page.setContent('<div>Hello<div>');
const handle = await page.evaluateHandle(`playwright.locator('div').withText('Hello').element`);
- expect(handle.toString()).toBe('JSHandle@node');
+ expect(await handle.evaluate<string, HTMLDivElement>((node: HTMLDivElement) => node.nodeName)).toBe('DIV');
});
it('should support playwright.locator.values', async ({ page }) => {