feat(theming): land Ant Design v5 overhaul — dynamic themes, real dark mode + massive styling refactor (#31590)

Co-authored-by: Enzo Martellucci <52219496+EnxDev@users.noreply.github.com>
Co-authored-by: Diego Pucci <diegopucci.me@gmail.com>
Co-authored-by: Mehmet Salih Yavuz <salih.yavuz@proton.me>
Co-authored-by: Geido <60598000+geido@users.noreply.github.com>
Co-authored-by: Alexandru Soare <37236580+alexandrusoare@users.noreply.github.com>
Co-authored-by: Damian Pendrak <dpendrak@gmail.com>
Co-authored-by: Pius Iniobong <67148161+payose@users.noreply.github.com>
Co-authored-by: Enzo Martellucci <enzomartellucci@gmail.com>
Co-authored-by: Kamil Gabryjelski <kamil.gabryjelski@gmail.com>
This commit is contained in:
Maxime Beauchemin
2025-06-20 13:38:58 -07:00
committed by GitHub
parent 2cc1ef88c8
commit dd129fa403
1267 changed files with 32958 additions and 23592 deletions

View File

@@ -25,8 +25,9 @@ import {
screen,
waitFor,
userEvent,
fireEvent,
} from 'spec/helpers/testing-library';
import { UploadFile } from 'antd/lib/upload/interface';
import { UploadFile } from '@superset-ui/core/components/Upload';
const csvProps = {
show: true,
@@ -567,7 +568,6 @@ test('Columnar, does not render the rows', () => {
});
test('database and schema are correctly populated', async () => {
jest.setTimeout(10000);
render(<UploadDataModal {...csvProps} />, {
useRedux: true,
});
@@ -585,7 +585,9 @@ test('database and schema are correctly populated', async () => {
await waitFor(() => screen.getByText('database2'));
screen.getByText('database1').click();
userEvent.click(selectSchema);
// make sure the schemas for database1 are displayed
await waitFor(() => screen.getAllByText('information_schema'));
await waitFor(() => screen.getAllByText('public'));
@@ -595,7 +597,7 @@ test('database and schema are correctly populated', async () => {
// make sure the schemas for database2 are displayed
await waitFor(() => screen.getAllByText('schema1'));
await waitFor(() => screen.getAllByText('schema2'));
});
}, 30000);
test('form without required fields', async () => {
render(<UploadDataModal {...csvProps} />, {
@@ -609,9 +611,13 @@ test('form without required fields', async () => {
// Submit form without filling any fields
userEvent.click(uploadButton);
await waitFor(() => screen.getByText('Uploading a file is required'));
await waitFor(() => screen.getByText('Selecting a database is required'));
await waitFor(() => screen.getByText('Table name is required'));
expect(
await screen.findByText('Uploading a file is required'),
).toBeInTheDocument();
expect(
await screen.findByText('Selecting a database is required'),
).toBeInTheDocument();
expect(await screen.findByText('Table name is required')).toBeInTheDocument();
});
test('CSV form post', async () => {
@@ -625,17 +631,17 @@ test('CSV form post', async () => {
userEvent.click(selectButton);
// Select a file from the file dialog
const file = new File(['test'], 'test.csv', { type: 'text' });
const file = new File(['test'], 'test.csv', { type: 'text/csv' });
const inputElement = screen.getByTestId('model-file-input');
if (inputElement) {
userEvent.upload(inputElement as HTMLElement, file);
}
expect(inputElement).toBeInTheDocument();
fireEvent.change(inputElement, { target: { files: [file] } });
const selectDatabase = screen.getByRole('combobox', {
name: /select a database/i,
});
userEvent.click(selectDatabase);
await screen.findByText('database1');
await screen.findByText('database2');
@@ -644,6 +650,7 @@ test('CSV form post', async () => {
name: /schema/i,
});
userEvent.click(selectSchema);
await screen.findAllByText('public');
screen.getAllByText('public')[1].click();
@@ -670,7 +677,7 @@ test('CSV form post', async () => {
expect(formData.get('table_name')).toBe('table1');
const fileData = formData.get('file') as File;
expect(fileData.name).toBe('test.csv');
});
}, 30000);
test('Excel form post', async () => {
render(<UploadDataModal {...excelProps} />, {
@@ -686,14 +693,14 @@ test('Excel form post', async () => {
const file = new File(['test'], 'test.xls', { type: 'text' });
const inputElement = screen.getByTestId('model-file-input');
if (inputElement) {
userEvent.upload(inputElement as HTMLElement, file);
}
expect(inputElement).toBeInTheDocument();
fireEvent.change(inputElement, { target: { files: [file] } });
const selectDatabase = screen.getByRole('combobox', {
name: /select a database/i,
});
userEvent.click(selectDatabase);
await screen.findByText('database1');
await screen.findByText('database2');
@@ -702,6 +709,7 @@ test('Excel form post', async () => {
name: /schema/i,
});
userEvent.click(selectSchema);
await screen.findAllByText('public');
screen.getAllByText('public')[1].click();
@@ -728,7 +736,7 @@ test('Excel form post', async () => {
expect(formData.get('table_name')).toBe('table1');
const fileData = formData.get('file') as File;
expect(fileData.name).toBe('test.xls');
});
}, 30000);
test('Columnar form post', async () => {
render(<UploadDataModal {...columnarProps} />, {
@@ -744,14 +752,14 @@ test('Columnar form post', async () => {
const file = new File(['test'], 'test.parquet', { type: 'text' });
const inputElement = screen.getByTestId('model-file-input');
if (inputElement) {
userEvent.upload(inputElement as HTMLElement, file);
}
expect(inputElement).toBeInTheDocument();
fireEvent.change(inputElement, { target: { files: [file] } });
const selectDatabase = screen.getByRole('combobox', {
name: /select a database/i,
});
userEvent.click(selectDatabase);
await screen.findByText('database1');
await screen.findByText('database2');
@@ -760,6 +768,7 @@ test('Columnar form post', async () => {
name: /schema/i,
});
userEvent.click(selectSchema);
await screen.findAllByText('public');
screen.getAllByText('public')[1].click();
@@ -772,6 +781,7 @@ test('Columnar form post', async () => {
name: 'Upload',
});
expect(uploadButton).toBeEnabled();
userEvent.click(uploadButton);
await waitFor(() => fetchMock.called('glob:*api/v1/database/1/upload/'));
@@ -786,7 +796,7 @@ test('Columnar form post', async () => {
expect(formData.get('table_name')).toBe('table1');
const fileData = formData.get('file') as File;
expect(fileData.name).toBe('test.parquet');
});
}, 30000);
test('CSV, validate file extension returns false', () => {
const invalidFileNames = ['out', 'out.exe', 'out.csv.exe', '.csv', 'out.xls'];