From c30fe25fd9fcbeffa6534d3b5dea4e1dd6f08ce7 Mon Sep 17 00:00:00 2001 From: alexandrusoare Date: Thu, 12 Dec 2024 15:32:28 +0200 Subject: [PATCH] fix(e2e): small fixes for e2e --- .../cypress/e2e/dashboard/editmode.test.ts | 8 ++--- .../cypress/e2e/explore/control.test.ts | 8 ++--- .../cypress/e2e/explore/link.test.ts | 4 +-- .../cypress/support/directories.ts | 34 +++++++++---------- .../cypress-base/cypress/support/e2e.ts | 1 + .../databases/DatabaseModal/index.test.tsx | 3 +- 6 files changed, 30 insertions(+), 28 deletions(-) diff --git a/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts b/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts index 0f7005bf854..28be3fae1e8 100644 --- a/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts +++ b/superset-frontend/cypress-base/cypress/e2e/dashboard/editmode.test.ts @@ -51,7 +51,7 @@ function openProperties() { cy.getBySel('header-actions-menu') .contains('Edit properties') .click({ force: true }); - cy.get('.ant-modal-body').should('be.visible'); + cy.get('.antd5-modal-body').should('be.visible'); }); } @@ -60,7 +60,7 @@ function openExploreProperties() { cy.get('.ant-dropdown-menu') .contains('Edit chart properties') .click({ force: true }); - cy.get('.ant-modal-body').should('be.visible'); + cy.get('.antd5-modal-body').should('be.visible'); } function assertMetadata(text: string) { @@ -77,7 +77,7 @@ function assertMetadata(text: string) { } function openAdvancedProperties() { - cy.get('.ant-modal-body') + cy.get('.antd5-modal-body') .contains('Advanced') .should('be.visible') .click({ force: true }); @@ -1100,7 +1100,7 @@ describe('Dashboard edit', () => { cy.allowConsoleErrors(['Error: A valid color scheme is required']); writeMetadata('{"color_scheme":"wrongcolorscheme"}'); applyChanges(); - cy.get('.ant-modal-body') + cy.get('.antd5-modal-body') .contains('A valid color scheme is required') .should('be.visible'); }); diff --git a/superset-frontend/cypress-base/cypress/e2e/explore/control.test.ts b/superset-frontend/cypress-base/cypress/e2e/explore/control.test.ts index 1db90b1968a..e4e7a7dc7e5 100644 --- a/superset-frontend/cypress-base/cypress/e2e/explore/control.test.ts +++ b/superset-frontend/cypress-base/cypress/e2e/explore/control.test.ts @@ -56,7 +56,7 @@ describe('Datasource control', () => { cy.focused().type(`${newMetricName}{enter}`); cy.get('[data-test="datasource-modal-save"]').click(); - cy.get('.ant-modal-confirm-btns button').contains('OK').click(); + cy.get('.antd5-modal-confirm-btns button').contains('OK').click(); // select new metric cy.get('[data-test=metrics]') .contains('Drop columns/metrics here or click') @@ -68,7 +68,7 @@ describe('Datasource control', () => { // delete metric cy.get('[data-test="datasource-menu-trigger"]').click(); cy.get('[data-test="edit-dataset"]').click(); - cy.get('.ant-modal-content').within(() => { + cy.get('.antd5-modal-content').within(() => { cy.get('[data-test="collection-tab-Metrics"]') .contains('Metrics') .click(); @@ -78,7 +78,7 @@ describe('Datasource control', () => { .find('[data-test="crud-delete-icon"]') .click(); cy.get('[data-test="datasource-modal-save"]').click(); - cy.get('.ant-modal-confirm-btns button').contains('OK').click(); + cy.get('.antd5-modal-confirm-btns button').contains('OK').click(); cy.get('[data-test="metrics"]').contains(newMetricName).should('not.exist'); }); }); @@ -121,7 +121,7 @@ describe('VizType control', () => { cy.contains('View all charts').click(); - cy.get('.ant-modal-content').within(() => { + cy.get('.antd5-modal-content').within(() => { cy.get('button').contains('KPI').click(); // change categories cy.get('[role="button"]').contains('Big Number').click(); cy.get('button').contains('Select').click(); diff --git a/superset-frontend/cypress-base/cypress/e2e/explore/link.test.ts b/superset-frontend/cypress-base/cypress/e2e/explore/link.test.ts index f9c616ec85d..5c7be1c968d 100644 --- a/superset-frontend/cypress-base/cypress/e2e/explore/link.test.ts +++ b/superset-frontend/cypress-base/cypress/e2e/explore/link.test.ts @@ -42,8 +42,8 @@ describe('Test explore links', () => { cy.wait('@chartData').then(() => { cy.get('code'); }); - cy.get('.ant-modal-content').within(() => { - cy.get('button.ant-modal-close').first().click({ force: true }); + cy.get('.antd5-modal-content').within(() => { + cy.get('button.antd5-modal-close').first().click({ force: true }); }); }); diff --git a/superset-frontend/cypress-base/cypress/support/directories.ts b/superset-frontend/cypress-base/cypress/support/directories.ts index 9d5a554d3a1..902c4619ac9 100644 --- a/superset-frontend/cypress-base/cypress/support/directories.ts +++ b/superset-frontend/cypress-base/cypress/support/directories.ts @@ -97,8 +97,8 @@ export const databasesPage = { infoAlert: '.antd5-alert', serviceAccountInput: '[name="credentials_info"]', connectionStep: { - modal: '.ant-modal-content', - modalBody: '.ant-modal-body', + modal: '.antd5-modal-content', + modalBody: '.antd5-modal-body', stepTitle: '.css-7x6kk > h4', helperBottom: '.helper-bottom', postgresDatabase: '[name="database"]', @@ -150,7 +150,7 @@ export const sqlLabView = { sqlEditor: '#brace-editor textarea', saveAsButton: '.SaveQuery > .ant-btn', saveAsModal: { - footer: '.ant-modal-footer', + footer: '.antd5-modal-footer', queryNameInput: 'input[class^="ant-input"]', }, sqlToolbar: { @@ -199,12 +199,12 @@ export const annotationLayersView = { }, modal: { content: { - content: '.ant-modal-body', - title: '.ant-modal-body > :nth-child(2) > input', + content: '.antd5-modal-body', + title: '.antd5-modal-body > :nth-child(2) > input', description: "[name='descr']", }, footer: { - footer: '.ant-modal-footer', + footer: '.antd5-modal-footer', addButton: dataTestLocator('modal-confirm-button'), cancelButton: dataTestLocator('modal-cancel-button'), }, @@ -216,7 +216,7 @@ export const datasetsList = { newDatasetModal: { inputField: '[class="section"]', addButton: dataTestLocator('modal-confirm-button'), - body: '.ant-modal-body', + body: '.antd5-modal-body', }, table: { tableRow: { @@ -261,7 +261,7 @@ export const datasetsList = { }, }, deleteDatasetModal: { - modal: '.ant-modal-content', + modal: '.antd5-modal-content', deleteInput: dataTestLocator('delete-modal-input'), deleteButton: dataTestLocator('modal-confirm-button'), text: '.css-kxmt87', @@ -318,8 +318,8 @@ export const chartListView = { }; export const nativeFilters = { modal: { - container: '.ant-modal', - footer: '.ant-modal-footer', + container: '.antd5-modal', + footer: '.antd5-modal-footer', saveButton: dataTestLocator('native-filter-modal-save-button'), cancelButton: dataTestLocator('native-filter-modal-cancel-button'), confirmCancelButton: dataTestLocator( @@ -476,15 +476,15 @@ export const exploreView = { }, chartAreaItem: '.nv-legend-text', viewQueryModal: { - container: '.ant-modal-content', - closeButton: 'button.ant-modal-close', + container: '.antd5-modal-content', + closeButton: 'button.antd5-modal-close', }, embedCodeModal: { container: dataTestLocator('embed-code-popover'), textfield: dataTestLocator('embed-code-textarea'), }, saveModal: { - modal: '.ant-modal-content', + modal: '.antd5-modal-content', chartNameInput: dataTestLocator('new-chart-name'), dashboardNameInput: '.ant-select-selection-search-input', addToDashboardInput: dataTestLocator( @@ -580,7 +580,7 @@ export const exploreView = { }, }, editDatasetModal: { - container: '.ant-modal-content', + container: '.antd5-modal-content', datasetTabsContainer: dataTestLocator('edit-dataset-tabs'), saveButton: dataTestLocator('datasource-modal-save'), metricsTab: { @@ -588,7 +588,7 @@ export const exploreView = { rowsContainer: dataTestLocator('table-content-rows'), }, confirmModal: { - okButton: '.ant-modal-confirm-btns .ant-btn-primary', + okButton: '.antd5-modal-confirm-btns .ant-btn-primary', }, }, visualizationTypeModal: { @@ -619,12 +619,12 @@ export const dashboardView = { closeButton: dataTestLocator('close-button'), }, saveModal: { - modal: '.ant-modal-content', + modal: '.antd5-modal-content', dashboardNameInput: '.ant-input', saveButton: dataTestLocator('modal-save-dashboard-button'), }, dashboardProperties: { - modal: '.ant-modal-content', + modal: '.antd5-modal-content', dashboardTitleInput: dataTestLocator('dashboard-title-input'), modalButton: '[type="button"]', }, diff --git a/superset-frontend/cypress-base/cypress/support/e2e.ts b/superset-frontend/cypress-base/cypress/support/e2e.ts index 7d17935e36a..d896a3c4841 100644 --- a/superset-frontend/cypress-base/cypress/support/e2e.ts +++ b/superset-frontend/cypress-base/cypress/support/e2e.ts @@ -33,6 +33,7 @@ const { getConfig, setConfig } = failOnConsoleError({ 'The pseudo class ":nth-child" is potentially unsafe when doing server-side rendering. Try changing it to ":nth-of-type".', 'Error: Unknown Error', /Unable to infer path to ace from script src/, + /$/ ], }); diff --git a/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx b/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx index 4c4a4dbb4d6..68a3f289d25 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx @@ -331,7 +331,7 @@ describe('DatabaseModal', () => { afterEach(cleanup); describe('Visual: New database connection', () => { - test('renders the initial load of Step 1 correctly', () => { + test.only('renders the initial load of Step 1 correctly', () => { // ---------- Components ---------- // - AntD header const closeButton = screen.getByLabelText('Close'); @@ -415,6 +415,7 @@ describe('DatabaseModal', () => { ]; visibleComponents.forEach(component => { + console.log(component) expect(component).toBeVisible(); }); // there should be a footer but it should not have any buttons in it