Frontory

Open code, practice, and notes →

Download source with English comments · for reading

Playwright · 20 Console and PageError

Series contents · Technology map

Stage: Asynchrony, Isolation, and Diagnosis · External example · preview instructions · Storage ID: playwright-step-20

Goals and learning outcomes

Prerequisites

Prepare the experiment results for Time control and Observation conditions from Unit 19, “Clock and Scheduled Saving”.

Key concepts and explanations

Signal collection

Console errors and pageerror are different events. Ignoring them unconditionally misses execution failures.

Filter rationale

An allowlist needs reasons. Distinguish expected-error tests from unexpected errors.

Practice setup

First check the execution scope guidance on the example screen. The following describes the environment needed to extend the assignment in a separate project. Write and run all tests in a separate Node project using @playwright/test and a dedicated local test origin. The existing playwright-01·02·03 previews only display test source; they do not run Playwright in the iframe. Write new test files yourself for the assignments and judge whether they pass only from actual runner output. Do not use a user profile or storage used for everyday work; preserve CSP and isolation.

The linked example is a starting point. It does not implement every task below. Complete work beyond its supported scope in a separate project.

Practice tasks

  1. In tests/day-20.spec.ts in a separate practice project, collect pageerror·console events and check that there are no unexpected errors at the end. Refer to the existing Unit 1·14·28 examples only as starting points.
  2. Input conditions: normal navigation and an intentional exception. Baseline: none. Run under the baseline conditions, then record observations and errors in notes/day-20.md.
  3. Variable: error; changed value: injected exception. Run again through the same input path. Deliverable to save: error type, message, and stage of occurrence. Hypothesis to check: Expose unexpected exceptions as test failures. Compare it with the actual results, and record whether they agree and why they differ.

Variables to observe

VariableBaselineChangeExpected change / hypothesis
errornoneinjected exceptionExpose unexpected exceptions as test failures.

Predictions in this table are not measured results. Change one condition at a time and record why the actual result differs.

Completion criteria

Self-check

  1. Which processing stage does Signal collection affect in this exercise? Input cases: normal navigation and an intentional exception.
  2. Variable: error. Hypothesis to check: Expose unexpected exceptions as test failures. Did the actual results agree with the hypothesis? Explain the evidence in terms of Filter rationale.

Official references

Linked example and execution scope

Example source · Runtime environments and limits

Runnable standalone Playwright spec and HTTP fixture; preview does not run tests.

Source code and records are not overwritten automatically. Resetting an existing example also preserves your notes.

Next learning

Previous: Clock and Scheduled Saving · Next: Reading Traces

Open code, practice, and notes →