Skip to content
Merged
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
17 changes: 13 additions & 4 deletions cypress/e2e/tests/pages/generic/diagnostic.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import DiagnosticsPagePo from '@/cypress/e2e/po/pages/diagnostics.po';
import * as path from 'path';
import { qase } from '@/cypress/support/qase';

const downloadsFolder = Cypress.config('downloadsFolder');
const downloadedFilename = path.join(downloadsFolder, 'rancher-diagnostic-data.json');

describe('Diagnostics Page', { tags: ['@generic', '@adminUser'] }, () => {
beforeEach(() => {
cy.login();
// Keep the downloads directory clean between tests.
cy.deleteDownloadsFolder();
});

it('User should be able to download the diagnostics package JSON', () => {
qase(1454, it('User should be able to download the diagnostics package JSON', () => {
// Ignore the focus-trap error that fires when the modal closes immediately
// after the download is triggered (known cosmetic side-effect of the dialog)
// Also the focus-trap error triggered when it can’t find any tabbable node inside its container
// This workaround is needed until we can update the focus-trap library to a version that has the fix for this issue https://github.com/rancher/dashboard/issues/17104

cy.on('uncaught:exception', (err) => {
if (err.message.includes('focus-trap')) {
if (err?.message?.includes('focus-trap') || err?.message?.includes('tabbable')) {
return false;
}
});
Expand All @@ -33,10 +40,12 @@ describe('Diagnostics Page', { tags: ['@generic', '@adminUser'] }, () => {
// modal button to actually trigger the download
diagnosticsPage.downloadDiagnosticsModalActionBtn().click(true);

const downloadedFilename = path.join(downloadsFolder, 'rancher-diagnostic-data.json');

cy.readFile(downloadedFilename).should('exist').then((file: any) => {
expect(Object.keys(file).length).to.equal(4);
});
}));
afterEach(() => {
// Keep the downloads directory clean between tests.
cy.deleteDownloadsFolder();
});
Comment thread
IsaSih marked this conversation as resolved.
});
Loading