원클릭으로
wait-strategy
Implicit wait as default, explicit wait only for slow paths. Trigger: wait strategy, timeout, wait, implicit wait, explicit wait.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Implicit wait as default, explicit wait only for slow paths. Trigger: wait strategy, timeout, wait, implicit wait, explicit wait.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Incrementally add regression test points to an existing PageObject. Trigger: add test point, add regression point, add test point, increase coverage, extend page methods.
POM layering and context sharing decision tree. Trigger: architecture, layering, POM, Page Object, base class design, add new role.
Browser viewport / headless / timeout layered configuration. Trigger: viewport, browser config, navigation timeout, headless, slow_mo, incognito.
Under a shared page, a test case that leaves the start page must return via the UI and assert. Trigger: round-trip closure, case round trip, reset timeout, scope shared page.
AST knowledge graph: change review, exploration, debugging, refactoring. Trigger: knowledge graph, code review, impact analysis, blast radius, refactoring.
One-click generation of PageObject + matching tests. Trigger: new page, generate page, gen page, create page, add page object.
Implicit wait covers 99% of scenarios; explicit wait is only used for known slow paths.
Set via page.set_default_timeout(ms) immediately after page creation. After that, all Playwright operations on that page (click, fill, locator.wait_for, is_visible, etc.) automatically wait for element readiness, retrying continuously before timeout — no need to specify timeout individually for each call.
The implicit wait timeout duration is declared centrally in the config file (e.g. DEFAULT_TIMEOUT constant), and injected into each page instance in the fixture layer:
# Config file
DEFAULT_TIMEOUT = 15000 # 15 seconds, tolerates network fluctuations
# Fixture layer (set for both function-level and class-level)
page = context.new_page()
page.set_default_timeout(DEFAULT_TIMEOUT)
| Environment | Recommended | Notes |
|---|---|---|
| Internal network / CI | 10000 (10s) | Stable network, no need for long waits |
| External network / production | 15000 (15s) | Tolerates occasional network fluctuations |
| Weak network testing | 20000~30000 | Specialized weak network scenarios |
| Scenario | Reason | Approach |
|---|---|---|
| Large file upload / import | Server processing takes much longer than typical page operations | self.is_visible(LOCATOR, timeout=60000) |
| Long polling / async task callback | Backend processing completes before frontend state refreshes | page.locator(...).wait_for(state="visible", timeout=30000) |
| Third-party service redirect | OAuth / payment etc. external page response is unpredictable | page.wait_for_url("**/callback**", timeout=30000) |
| First cold start | Service just deployed, first request is slow | Increase timeout individually for the first navigation |
Pass an explicit timeout at the call site, overriding the implicit default:
# BasePage wrapper method supports timeout parameter
def is_visible(self, locator, timeout=DEFAULT_TIMEOUT) -> bool:
...
# In test case: only specify explicitly for known slow operations
def test_upload_large_file(self):
self.page_obj.click_upload()
assert self.page_obj.is_visible(
self.page_obj.UPLOAD_SUCCESS_INDICATOR,
timeout=60000 # explicit 60-second wait, only here
), "Large file upload timed out"
time.sleep() hard waits — Playwright's auto-wait mechanism already covers this; hard waits waste time and are unreliablewait_for_load_state and Implicit Waitpage.wait_for_load_state("networkidle") is a navigation-level wait, complementary to element-level implicit wait — they don't conflict:
| Wait Type | Level | Trigger Timing | Controlled by set_default_timeout |
|---|---|---|---|
wait_for_load_state | Navigation / Network | After page jump, bulk AJAX requests | Controlled by set_default_navigation_timeout |
| Implicit wait | Element | Before each element operation | Yes |
Recommended pattern:
def click_navigate_to_target(self):
self.click(self.TARGET_LINK)
self.page.wait_for_load_state("networkidle") # wait for network requests to complete
# subsequent is_visible / click operations are covered by implicit wait
DEFAULT_TIMEOUT declared centrally in config filepage.set_default_timeout()time.sleep() in PageObject business methodsis_visible() and similar methods retain a timeout parameter for callers to override