Skip to content

Commit

Permalink
Run simple auth manager UI tests as part of tests-ui (#46142)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincbeck authored Jan 30, 2025
1 parent a1c8717 commit f8453ba
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ indent_size = 2
[*.ts]
indent_size = 2

[*.tsx]
indent_size = 2

[*.css]
indent_size = 2

Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/basic-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- run: uv tool run --from apache-airflow-breeze pytest -n auto --color=yes
working-directory: ./dev/breeze/
tests-ui:
timeout-minutes: 10
timeout-minutes: 15
name: React UI tests
runs-on: ${{ fromJSON(inputs.runs-on-as-json-public) }}
if: inputs.run-ui-tests == 'true'
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
with:
path: airflow/ui/node_modules/
key: cache-ui-node-modules-v1-${{ runner.os }}-${{ hashFiles('airflow/ui/**/pnpm-lock.yaml') }}
id: restore-eslint-cache
id: restore-eslint-cache-ui
- run: cd airflow/ui && pnpm install --frozen-lockfile
- run: cd airflow/ui && pnpm test
env:
Expand All @@ -127,7 +127,29 @@ jobs:
key: cache-ui-node-modules-v1-${{ runner.os }}-${{ hashFiles('airflow/ui/**/pnpm-lock.yaml') }}
if-no-files-found: 'error'
retention-days: '2'
if: steps.restore-eslint-cache.outputs.stash-hit != 'true'
if: steps.restore-eslint-cache-ui.outputs.stash-hit != 'true'
- name: "Restore eslint cache (simple auth manager UI)"
uses: apache/infrastructure-actions/stash/restore@1c35b5ccf8fba5d4c3fdf25a045ca91aa0cbc468
with:
path: airflow/auth/managers/simple/ui/node_modules/
key: >
cache-simple-am-ui-node-modules-v1-
${{ runner.os }}-${{ hashFiles('airflow/auth/managers/simple/ui/**/pnpm-lock.yaml') }}
id: restore-eslint-cache-simple-am-ui
- run: cd airflow/auth/managers/simple/ui && pnpm install --frozen-lockfile
- run: cd airflow/auth/managers/simple/ui && pnpm test
env:
FORCE_COLOR: 2
- name: "Save eslint cache (ui)"
uses: apache/infrastructure-actions/stash/save@1c35b5ccf8fba5d4c3fdf25a045ca91aa0cbc468
with:
path: airflow/auth/managers/simple/ui/node_modules/
key: >
cache-simple-am-ui-node-modules-v1-
${{ runner.os }}-${{ hashFiles('airflow/auth/managers/simple/ui/**/pnpm-lock.yaml') }}
if-no-files-found: 'error'
retention-days: '2'
if: steps.restore-eslint-cache-simple-am-ui.outputs.stash-hit != 'true'

tests-www:
timeout-minutes: 10
Expand Down
24 changes: 15 additions & 9 deletions airflow/auth/managers/simple/ui/src/test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,29 @@
*/

import React, { PropsWithChildren } from "react";
import { ChakraProvider } from "@chakra-ui/react";
import { ChakraProvider, defaultSystem } from "@chakra-ui/react";
import { MemoryRouter, MemoryRouterProps } from "react-router-dom";
import { QueryClientProvider } from "@tanstack/react-query";
import { queryClient } from "./queryClient";
import {QueryClient, QueryClientProvider} from "@tanstack/react-query";

interface WrapperProps extends PropsWithChildren {
initialEntries?: MemoryRouterProps["initialEntries"];
}

export const Wrapper = ({ initialEntries, children }: WrapperProps) => {
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: Infinity,
},
},
});
return (
<ChakraProvider>
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={initialEntries}>
{children}
</MemoryRouter>
</QueryClientProvider>
<ChakraProvider value={defaultSystem}>
<QueryClientProvider client={queryClient}>
<MemoryRouter initialEntries={initialEntries}>
{children}
</MemoryRouter>
</QueryClientProvider>
</ChakraProvider>
);
};

0 comments on commit f8453ba

Please sign in to comment.