Skip to content

Commit f8453ba

Browse files
authored
Run simple auth manager UI tests as part of tests-ui (apache#46142)
1 parent a1c8717 commit f8453ba

File tree

3 files changed

+43
-12
lines changed

3 files changed

+43
-12
lines changed

.editorconfig

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ indent_size = 2
4040
[*.ts]
4141
indent_size = 2
4242

43+
[*.tsx]
44+
indent_size = 2
45+
4346
[*.css]
4447
indent_size = 2
4548

.github/workflows/basic-tests.yml

+25-3
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
- run: uv tool run --from apache-airflow-breeze pytest -n auto --color=yes
8686
working-directory: ./dev/breeze/
8787
tests-ui:
88-
timeout-minutes: 10
88+
timeout-minutes: 15
8989
name: React UI tests
9090
runs-on: ${{ fromJSON(inputs.runs-on-as-json-public) }}
9191
if: inputs.run-ui-tests == 'true'
@@ -115,7 +115,7 @@ jobs:
115115
with:
116116
path: airflow/ui/node_modules/
117117
key: cache-ui-node-modules-v1-${{ runner.os }}-${{ hashFiles('airflow/ui/**/pnpm-lock.yaml') }}
118-
id: restore-eslint-cache
118+
id: restore-eslint-cache-ui
119119
- run: cd airflow/ui && pnpm install --frozen-lockfile
120120
- run: cd airflow/ui && pnpm test
121121
env:
@@ -127,7 +127,29 @@ jobs:
127127
key: cache-ui-node-modules-v1-${{ runner.os }}-${{ hashFiles('airflow/ui/**/pnpm-lock.yaml') }}
128128
if-no-files-found: 'error'
129129
retention-days: '2'
130-
if: steps.restore-eslint-cache.outputs.stash-hit != 'true'
130+
if: steps.restore-eslint-cache-ui.outputs.stash-hit != 'true'
131+
- name: "Restore eslint cache (simple auth manager UI)"
132+
uses: apache/infrastructure-actions/stash/restore@1c35b5ccf8fba5d4c3fdf25a045ca91aa0cbc468
133+
with:
134+
path: airflow/auth/managers/simple/ui/node_modules/
135+
key: >
136+
cache-simple-am-ui-node-modules-v1-
137+
${{ runner.os }}-${{ hashFiles('airflow/auth/managers/simple/ui/**/pnpm-lock.yaml') }}
138+
id: restore-eslint-cache-simple-am-ui
139+
- run: cd airflow/auth/managers/simple/ui && pnpm install --frozen-lockfile
140+
- run: cd airflow/auth/managers/simple/ui && pnpm test
141+
env:
142+
FORCE_COLOR: 2
143+
- name: "Save eslint cache (ui)"
144+
uses: apache/infrastructure-actions/stash/save@1c35b5ccf8fba5d4c3fdf25a045ca91aa0cbc468
145+
with:
146+
path: airflow/auth/managers/simple/ui/node_modules/
147+
key: >
148+
cache-simple-am-ui-node-modules-v1-
149+
${{ runner.os }}-${{ hashFiles('airflow/auth/managers/simple/ui/**/pnpm-lock.yaml') }}
150+
if-no-files-found: 'error'
151+
retention-days: '2'
152+
if: steps.restore-eslint-cache-simple-am-ui.outputs.stash-hit != 'true'
131153

132154
tests-www:
133155
timeout-minutes: 10

airflow/auth/managers/simple/ui/src/test-utils.tsx

+15-9
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,29 @@
1818
*/
1919

2020
import React, { PropsWithChildren } from "react";
21-
import { ChakraProvider } from "@chakra-ui/react";
21+
import { ChakraProvider, defaultSystem } from "@chakra-ui/react";
2222
import { MemoryRouter, MemoryRouterProps } from "react-router-dom";
23-
import { QueryClientProvider } from "@tanstack/react-query";
24-
import { queryClient } from "./queryClient";
23+
import {QueryClient, QueryClientProvider} from "@tanstack/react-query";
2524

2625
interface WrapperProps extends PropsWithChildren {
2726
initialEntries?: MemoryRouterProps["initialEntries"];
2827
}
2928

3029
export const Wrapper = ({ initialEntries, children }: WrapperProps) => {
30+
const queryClient = new QueryClient({
31+
defaultOptions: {
32+
queries: {
33+
staleTime: Infinity,
34+
},
35+
},
36+
});
3137
return (
32-
<ChakraProvider>
33-
<QueryClientProvider client={queryClient}>
34-
<MemoryRouter initialEntries={initialEntries}>
35-
{children}
36-
</MemoryRouter>
37-
</QueryClientProvider>
38+
<ChakraProvider value={defaultSystem}>
39+
<QueryClientProvider client={queryClient}>
40+
<MemoryRouter initialEntries={initialEntries}>
41+
{children}
42+
</MemoryRouter>
43+
</QueryClientProvider>
3844
</ChakraProvider>
3945
);
4046
};

0 commit comments

Comments
 (0)