diff --git a/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts index 70b01351e..c65b5dfb5 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/control.test.ts @@ -104,7 +104,7 @@ describe('VizType control', () => { numScripts = nodes.length; }); - cy.get('.Control .label').contains('Table').click(); + cy.get('[data-test="visualization-type"]').contains('Table').click(); cy.get('[role="button"]').contains('Line Chart').click(); diff --git a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts index 868d2fe27..0af7dce36 100644 --- a/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/explore/visualizations/table.test.ts @@ -161,7 +161,7 @@ describe('Visualization > Table', () => { cy.verifySliceContainer('table'); expect(response?.body.result[0].data.length).to.eq(limit); }); - cy.get('span.label-danger').contains('10 rows'); + cy.get('[data-test="row-count-label"]').contains('10 rows'); }); it('Test table with columns and row limit', () => { diff --git a/superset-frontend/spec/javascripts/components/Timer_spec.tsx b/superset-frontend/spec/javascripts/components/Timer_spec.tsx index 4af7ae708..f37004af8 100644 --- a/superset-frontend/spec/javascripts/components/Timer_spec.tsx +++ b/superset-frontend/spec/javascripts/components/Timer_spec.tsx @@ -21,7 +21,7 @@ */ import React from 'react'; import { render, sleep, waitFor } from 'spec/helpers/testing-library'; -import Timer from 'src/components/Timer'; +import Timer, { TimerProps } from 'src/components/Timer'; import { now } from 'src/modules/dates'; function parseTime(text?: string | null) { @@ -29,7 +29,7 @@ function parseTime(text?: string | null) { } describe('Timer', () => { - const mockProps = { + const mockProps: TimerProps = { startTime: now(), endTime: undefined, isRunning: true, @@ -41,7 +41,6 @@ describe('Timer', () => { const node = screen.getByRole('timer'); let text = node.textContent || ''; expect(node).toBeInTheDocument(); - expect(node).toHaveClass('label-warning'); expect(node).toHaveTextContent('00:00:00.00'); // should start running await waitFor(() => { diff --git a/superset-frontend/spec/javascripts/explore/components/RowCountLabel_spec.jsx b/superset-frontend/spec/javascripts/explore/components/RowCountLabel_spec.jsx index 7776788cb..13de226e7 100644 --- a/superset-frontend/spec/javascripts/explore/components/RowCountLabel_spec.jsx +++ b/superset-frontend/spec/javascripts/explore/components/RowCountLabel_spec.jsx @@ -45,6 +45,6 @@ describe('RowCountLabel', () => { limit: 100, }; const wrapper = shallow(); - expect(wrapper.find(Label).first().props().bsStyle).toBe('danger'); + expect(wrapper.find(Label).first().props().type).toBe('danger'); }); }); diff --git a/superset-frontend/spec/javascripts/profile/Security_spec.tsx b/superset-frontend/spec/javascripts/profile/Security_spec.tsx index 6732e7b2a..31eda0aae 100644 --- a/superset-frontend/spec/javascripts/profile/Security_spec.tsx +++ b/superset-frontend/spec/javascripts/profile/Security_spec.tsx @@ -19,7 +19,7 @@ import React from 'react'; import { styledMount as mount } from 'spec/helpers/theming'; import Security from 'src/profile/components/Security'; - +import Label from 'src/components/Label'; import { user, userNoPerms } from './fixtures'; describe('Security', () => { @@ -31,19 +31,19 @@ describe('Security', () => { }); it('renders 2 role labels', () => { const wrapper = mount(); - expect(wrapper.find('.roles').find('.label')).toHaveLength(2); + expect(wrapper.find('.roles').find(Label)).toHaveLength(2); }); it('renders 2 datasource labels', () => { const wrapper = mount(); - expect(wrapper.find('.datasources').find('.label')).toHaveLength(2); + expect(wrapper.find('.datasources').find(Label)).toHaveLength(2); }); it('renders 3 database labels', () => { const wrapper = mount(); - expect(wrapper.find('.databases').find('.label')).toHaveLength(3); + expect(wrapper.find('.databases').find(Label)).toHaveLength(3); }); it('renders no permission label when empty', () => { const wrapper = mount(); - expect(wrapper.find('.datasources').find('.label')).not.toExist(); - expect(wrapper.find('.databases').find('.label')).not.toExist(); + expect(wrapper.find('.datasources').find(Label)).not.toExist(); + expect(wrapper.find('.databases').find(Label)).not.toExist(); }); }); diff --git a/superset-frontend/src/SqlLab/components/QueryStateLabel.jsx b/superset-frontend/src/SqlLab/components/QueryStateLabel.jsx index 74b0d3f7a..5afb30bd3 100644 --- a/superset-frontend/src/SqlLab/components/QueryStateLabel.jsx +++ b/superset-frontend/src/SqlLab/components/QueryStateLabel.jsx @@ -20,16 +20,16 @@ import React from 'react'; import PropTypes from 'prop-types'; import Label from 'src/components/Label'; -import { STATE_BSSTYLE_MAP } from '../constants'; +import { STATE_TYPE_MAP } from '../constants'; const propTypes = { query: PropTypes.object.isRequired, }; export default function QueryStateLabel({ query }) { - const bsStyle = STATE_BSSTYLE_MAP[query.state]; + const type = STATE_TYPE_MAP[query.state]; return ( -