Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/ui/tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
/playwright-report/
/playwright/.cache/
.env
/downloads/
25 changes: 16 additions & 9 deletions packages/ui/tests/e2e/pages/table.download-manager.base.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,25 @@ test('Download manager: downloaded file should be equal to ideal', async ({page}
await downloadButton.waitFor();
await downloadButton.click();

const downloadButtonModal = page.locator('[data-qa="download-static-table"]');
const downloadButtonModal = page.getByTestId('download-static-table');
await downloadButtonModal.waitFor();

const downloadPromise = page.waitForEvent('download');
await downloadButtonModal.click();

page.on('download', async (download) => {
const destination = './downloads/' + download.suggestedFilename();
await download.saveAs(destination);

const fileHash = getFileHash(destination);
const idealFileHash = getFileHash('./data/static-table/static-table');
expect(fileHash).toEqual(idealFileHash);
});
const download = await downloadPromise;

const toastTitle = page.locator('.g-toast__title');
await toastTitle.waitFor();
const text = await toastTitle.innerText();
expect(text).toBe('Success');

const destination = './downloads/' + download.suggestedFilename();
await download.saveAs(destination);

const fileHash = getFileHash(destination);
const idealFileHash = getFileHash('./data/static-table/static-table');
expect(fileHash).toEqual(idealFileHash);
});

function getFileHash(filePath: string) {
Expand Down
34 changes: 19 additions & 15 deletions packages/ui/tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/ui/tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"license": "ISC",
"private": true,
"devDependencies": {
"@playwright/test": "^1.44.1"
"@playwright/test": "^1.50.1"
}
}