Skip to content

Commit

Permalink
fix: cosmetics
Browse files Browse the repository at this point in the history
  • Loading branch information
alicechaitea committed Feb 13, 2024
1 parent 1f3efbe commit 7d36aba
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/wallet-automation/typhon/typhon-wallet-download.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ const url = 'https://clients2.google.com/service/update2/crx?response=redirect&o
const downloadPath = path.resolve(__dirname, 'extensions');

test('downloadFile test', async ({ page }) => {
// Ensure the download directory exists
// ensure the download directory exists
await fs.mkdir(downloadPath, { recursive: true });

// Preemptively set up to handle the download
// preemptively set up to handle the download
const downloadPromise = new Promise(async (resolve) => {
page.once('download', async (download) => {
const filePath = path.join(downloadPath, download.suggestedFilename());
await download.saveAs(filePath);
console.log(`File has been downloaded to: ${filePath}`);
console.log(`file has been downloaded to: ${filePath}`);
resolve(filePath);
});
});
Expand All @@ -28,16 +28,16 @@ test('downloadFile test', async ({ page }) => {
console.log('navigation caused an exception, likely due to immediate download:', 'directDownload');
}

// Wait for the download to complete
// wait for the download to complete
const downloadedFilePath = await downloadPromise;

// Verify the file exists
// verify the file exists
try {
await fs.access(downloadedFilePath); // Corrected the variable name here
console.log('File verification succeeded, file exists.');
console.log('file verification succeeded, file exists.');
} catch {
console.error('File verification failed, file does not exist.');
throw new Error('Downloaded file does not exist.');
console.error('file verification failed, file does not exist.');
throw new Error('downloaded file does not exist.');
};

});
Expand Down

0 comments on commit 7d36aba

Please sign in to comment.