(label, note, options = {})
| 179 | } |
| 180 | |
| 181 | async shot(label, note, options = {}) { |
| 182 | this.n += 1; |
| 183 | const file = `${String(this.n).padStart(2, '0')}-${label}.png`; |
| 184 | await mkdir(this.dir, { recursive: true }); |
| 185 | await this.page.screenshot({ path: join(this.dir, file), fullPage: false, ...(options.clip ? { clip: options.clip } : {}) }); |
| 186 | const state = await this.state().catch((error) => ({ error: String(error) })); |
| 187 | this.entries.push({ file, note, at: Date.now(), state, ...(options.extra ? { extra: options.extra } : {}) }); |
| 188 | console.log(`[${this.name}] ${file} ${note}`); |
| 189 | return state; |
| 190 | } |
| 191 | |
| 192 | note(text) { |
| 193 | this.notes.push(text); |
no test coverage detected