Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix: less confusing error message (#2305)
Andrey Lushnikove312845ba9b1
diff --git a/src/frames.ts b/src/frames.tsindex 01b7479b93..b9d60d2047 100644--- a/src/frames.ts+++ b/src/frames.ts@@ -451,7 +451,7 @@ export class Frame {const deadline = this._page._timeoutSettings.computeDeadline(options);const { world, task } = selectors._waitForSelectorTask(selector, state, deadline);- const result = await this._scheduleRerunnableTask(task, world, deadline, `selector "${selectorToString(selector, state)}"`);+ const result = await this._scheduleRerunnableTask(task, world, deadline, `selector "${selector}"${state === 'attached' ? '' : ' to be ' + state}`);if (!result.asElement()) {result.dispose();return null;@@ -469,7 +469,7 @@ export class Frame {async dispatchEvent(selector: string, type: string, eventInit?: Object, options?: types.TimeoutOptions): Promise<void> {const deadline = this._page._timeoutSettings.computeDeadline(options);const task = selectors._dispatchEventTask(selector, type, eventInit || {}, deadline);- const result = await this._scheduleRerunnableTask(task, 'main', deadline, `selector "${selectorToString(selector, 'attached')}"`);+ const result = await this._scheduleRerunnableTask(task, 'main', deadline, `selector "${selector}"`);result.dispose();}@@ -970,17 +970,6 @@ class RerunnableTask {}}-function selectorToString(selector: string, state: 'attached' | 'detached' | 'visible' | 'hidden'): string {- let label;- switch (state) {- case 'visible': label = '[visible] '; break;- case 'hidden': label = '[hidden] '; break;- case 'attached': label = ''; break;- case 'detached': label = '[detached]'; break;- }- return `${label}${selector}`;-}-export class SignalBarrier {private _options: types.NavigatingActionWaitOptions;private _protectCount = 0;diff --git a/test/waittask.spec.js b/test/waittask.spec.jsindex 03b1ea9f9a..2b52882981 100644--- a/test/waittask.spec.js+++ b/test/waittask.spec.js@@ -341,7 +341,7 @@ describe('Frame.waitForSelector', function() {let error = null;await page.waitForSelector('div', { state: 'hidden', timeout: 1000 }).catch(e => error = e);expect(error).toBeTruthy();- expect(error.message).toContain('waiting for selector "[hidden] div" failed: timeout');+ expect(error.message).toContain('waiting for selector "div" to be hidden failed: timeout');});it('should respond to node attribute mutation', async({page, server}) => {let divFound = false;