Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Playwright Helper - Improve and fix issues of wait* methods #5092

Closed
@kobenguyent

Description

Status Quo

Current playwright helper implementations for wait* methods may cause potential issues like not waiting as expected, waiting too much, etc.

Analysis
Analyze the potential issues of all wait* methods in Playwright Helper.

Action

  • fix issues
  • improve the code quality
  • add more unit tests
  • add more acceptance tests

Here is a reported issue

@kobenguyent I patched my Playwright.js by the fix and it works well, no delay occurs when the test finishes.

But there is a regression 🐛 - I.waitForText() doesn't wait for waitForTimeout if the string can't be found. It waits for a short time only.

Could you reopen it?

test:

Feature("My");

Scenario("test something", ({ I }) => {
I.amOnPage("https://codecept.io/");
I.waitForText("CodeceptJS ‐ superchargedx");
});
Before the fix - the method waits for 30 secs ✔️

Aug 21 18:54:45 My --
Aug 21 18:54:45 /home/mirao/workspace/my/My_test.ts
Aug 21 18:54:45 [1] Starting recording promises
Aug 21 18:54:45 Timeouts: 
Aug 21 18:54:45 › [Session] Starting singleton browser session
Aug 21 18:54:45 test something
Aug 21 18:54:45 › [New Session] {"ignoreHTTPSErrors":false,"acceptDownloads":true}
Aug 21 18:54:45 Scenario()
Aug 21 18:54:45 I am on page "https://codecept.io/"
Aug 21 18:54:46 I wait for text "CodeceptJS ‐ superchargedx"
Aug 21 18:55:16 [1] Error (Non-Terminated) | Text "CodeceptJS ‐ superchargedx" was not found on page after 30 sec. | err => { step.status = 'failed' step.endTime = +Da...
Aug 21 18:55:16 [1] Error | Error: [Wrapped Error] "Text \"CodeceptJS ‐ superchargedx\" was not found on page after 30 sec." undefined...
Aug 21 18:55:16 [1] <teardown> Stopping recording promises
Aug 21 18:55:16 › <screenshotOnFail> Test failed, try to save a screenshot
Aug 21 18:55:16 › [Screenshot] output/test_something.failed.png
Aug 21 18:55:17 ✖ FAILED in 31314ms
Aug 21 18:55:17 
Aug 21 18:55:17 [2] Starting recording promises
Aug 21 18:55:17 
Aug 21 18:55:17 -- FAILURES:
Aug 21 18:55:17 
Aug 21 18:55:17 1) My
Aug 21 18:55:17 test something:
Aug 21 18:55:17 
Aug 21 18:55:17 [Wrapped Error] "Text \"CodeceptJS ‐ superchargedx\" was not found on page after 30 sec."
Aug 21 18:55:17 at /home/mirao/workspace/my/node_modules/codeceptjs/lib/recorder.js:280:15
Aug 21 18:55:17 
Aug 21 18:55:17 
Aug 21 18:55:17 ◯ File: /home/mirao/workspace/my/My_test.ts
Aug 21 18:55:17 
Aug 21 18:55:17 ◯ Scenario Steps:
Aug 21 18:55:17 ✖ I.waitForText("CodeceptJS ‐ superchargedx") at Test.<anonymous> (./My_test.ts:5:5)
Aug 21 18:55:17 ✔ I.amOnPage("https://codecept.io/") at Test.<anonymous> (./My_test.ts:4:5)
Aug 21 18:55:17 
Aug 21 18:55:17 ◯ Artifacts:
Aug 21 18:55:17 - screenshot: /home/mirao/workspace/my/output/test_something.failed.png
Aug 21 18:55:17 
Aug 21 18:55:17 ◯ Metadata:
Aug 21 18:55:17 - browser: chromium
Aug 21 18:55:17 - browserVersion: 139.0.7258.5
Aug 21 18:55:17 - windowSize: 1280x720
Aug 21 18:55:17 
Aug 21 18:55:17 
Aug 21 18:55:17 FAIL | 0 passed, 1 failed // 32s

After the fix - the method waits for 4 secs only 🐛

Aug 21 18:56:24 My --
Aug 21 18:56:24 /home/mirao/workspace/my/My_test.ts
Aug 21 18:56:24 [1] Starting recording promises
Aug 21 18:56:24 Timeouts: 
Aug 21 18:56:24 › [Session] Starting singleton browser session
Aug 21 18:56:24 test something
Aug 21 18:56:24 › [New Session] {"ignoreHTTPSErrors":false,"acceptDownloads":true}
Aug 21 18:56:24 Scenario()
Aug 21 18:56:24 I am on page "https://codecept.io/"
Aug 21 18:56:25 I wait for text "CodeceptJS ‐ superchargedx"
Aug 21 18:56:29 [1] Error (Non-Terminated) | Text "CodeceptJS ‐ superchargedx" was not found on page after 30 sec. | err => { step.status = 'failed' step.endTime = +Da...
Aug 21 18:56:29 [1] Error | Error: [Wrapped Error] "Text \"CodeceptJS ‐ superchargedx\" was not found on page after 30 sec." undefined...
Aug 21 18:56:29 [1] <teardown> Stopping recording promises
Aug 21 18:56:29 › <screenshotOnFail> Test failed, try to save a screenshot
Aug 21 18:56:29 › [Screenshot] output/test_something.failed.png
Aug 21 18:56:29 ✖ FAILED in 5052ms
Aug 21 18:56:29 
Aug 21 18:56:29 [2] Starting recording promises
Aug 21 18:56:29 
Aug 21 18:56:29 -- FAILURES:
Aug 21 18:56:29 
Aug 21 18:56:29 1) My
Aug 21 18:56:29 test something:
Aug 21 18:56:29 
Aug 21 18:56:29 [Wrapped Error] "Text \"CodeceptJS ‐ superchargedx\" was not found on page after 30 sec."
Aug 21 18:56:29 at /home/mirao/workspace/my/node_modules/codeceptjs/lib/recorder.js:280:15
Aug 21 18:56:29 
Aug 21 18:56:29 
Aug 21 18:56:29 ◯ File: /home/mirao/workspace/my/My_test.ts
Aug 21 18:56:29 
Aug 21 18:56:29 ◯ Scenario Steps:
Aug 21 18:56:29 ✖ I.waitForText("CodeceptJS ‐ superchargedx") at Test.<anonymous> (./My_test.ts:5:5)
Aug 21 18:56:29 ✔ I.amOnPage("https://codecept.io/") at Test.<anonymous> (./My_test.ts:4:5)
Aug 21 18:56:29 
Aug 21 18:56:29 ◯ Artifacts:
Aug 21 18:56:29 - screenshot: /home/mirao/workspace/my/output/test_something.failed.png
Aug 21 18:56:29 
Aug 21 18:56:29 ◯ Metadata:
Aug 21 18:56:29 - browser: chromium
Aug 21 18:56:29 - browserVersion: 139.0.7258.5
Aug 21 18:56:29 - windowSize: 1280x720
Aug 21 18:56:29 
Aug 21 18:56:29 
Aug 21 18:56:29 FAIL | 0 passed, 1 failed // 5s

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      AltStyle によって変換されたページ (->オリジナル) /