| 334 | } |
| 335 | |
| 336 | function checkIfFolderExists(block, name) { |
| 337 | const root = path.join(__dirname, '../dist/headless/'); |
| 338 | |
| 339 | if (!fs.existsSync(root)) { |
| 340 | fs.mkdirSync(root); |
| 341 | } |
| 342 | |
| 343 | const clearPath = path.join(root, 'clear'); |
| 344 | if (!fs.existsSync(clearPath)) { |
| 345 | fs.mkdirSync(clearPath); |
| 346 | } |
| 347 | |
| 348 | const folderPath = path.join(clearPath, block); |
| 349 | if (!fs.existsSync(folderPath)) { |
| 350 | fs.mkdirSync(folderPath); |
| 351 | } |
| 352 | |
| 353 | const filePath = path.join(folderPath, name); |
| 354 | if (!fs.existsSync(filePath)) { |
| 355 | fs.mkdirSync(filePath); |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | async function singleCase(block, test, page, testPage, retry = 0) { |
| 360 | const saveCallback = await PreparePage(block, page, test.url, testPage); |