Frontory

Open code, practice, and notes →

Download source with English comments · for reading

Playwright · 14 Saving, Downloading, and Restoring

Series contents · Technology map

Stage: Persistent Data and File Round Trips · Editable example · Storage ID: playwright-02

Goals and learning outcomes

Prerequisites

Prepare the experiment results for Identifier and Round trip from Unit 13, “Per-Item Storage Isolation”.

Key concepts and explanations

Round-trip contract

A backup file must be importable to reproduce the same data. Check file creation and storage restoration together.

Isolation

Do not target an origin used for everyday work. Separate files and storage for each test.

Practice setup

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-14.spec.ts in a separate practice project, use a dedicated Frontory test origin. Write the sequence: write notes → download v3 JSON for all 644 units → edit notes → import the same complete file → validation confirmation screen → click the “전체 교체하여 복원” button → reload.
  2. Input conditions: empty notes, Korean text, and error files. Baseline: valid backup. Run under the baseline conditions, then record observations and errors in notes/day-14.md.
  3. Variable: file; changed value: invalid JSON. Run again through the same input path. Deliverable to save: notes after the round trip and error-preservation results. Hypothesis to check: Restore a valid file and preserve existing values for an invalid file. Compare it with the actual results, and record whether they agree and why they differ.

Variables to observe

VariableBaselineChangeExpected change / hypothesis
filevalid backupinvalid JSONRestore a valid file and preserve existing values for an invalid file.

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 Round-trip contract affect in this exercise? Input cases: empty notes, Korean text, and error files.
  2. Variable: file. Hypothesis to check: Restore a valid file and preserve existing values for an invalid file. Did the actual results agree with the hypothesis? Explain the evidence in terms of Isolation.

Official references

Linked example and execution scope

Example source · Runtime environments and limits

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

Next learning

Previous: Per-Item Storage Isolation · Next: Keyboard Navigation

Open code, practice, and notes →