Skip to content

Commit

Permalink
fix login tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maany committed Oct 17, 2023
1 parent fa1469b commit 55733f7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/component-library/Demos/01_1_Login_OIDC.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const AMultiVOOIDCEnabledLogin: Story = {
loginViewModel: {
status: 'success',
x509Enabled: true,
oidcEnabled: false,
oidcEnabled: true,
oidcProviders: [cernOIDCProvider],
multiVOEnabled: true,
voList: [voAtlas, voCMS, voLHCb],
Expand Down
2 changes: 2 additions & 0 deletions src/component-library/Pages/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export const Login = ({
className="flex justify-center flex-col space-y-4"
aria-label="Choose Login Method"
>
{ loginViewModel.oidcEnabled == true ?
<div
className={twMerge(
"flex flex-row justify-center space-x-2",
Expand All @@ -145,6 +146,7 @@ export const Login = ({
return (<Button theme='orange' label={provider.name} key={index.toString()} icon={<MdAccountCircle />} />)
})}
</div>
: <></>}

<Button
label="x509"
Expand Down
6 changes: 3 additions & 3 deletions test/component/Login.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("Login Page Test", () => {
await act( async () => render(<Login/>))

// Check OIDC buttons are present but NOT rendered
oidcProviders.map((provider) => {
voList[1].oidcProviders.map((provider) => {
const OIDCButton = screen.getByText(provider.name)
expect(OIDCButton).toBeInTheDocument()
})
Expand Down Expand Up @@ -107,8 +107,8 @@ describe("Login Page Test", () => {
await act( async () => render(<Login/>))

// Check OIDC buttons: 2 pieces and collapsed
const oidcParent = screen.getByRole('generic', {name: /OIDC Login Buttons/})
expect(oidcParent.className).toContain('hidden')
const oidcParent = screen.queryByRole('generic', { name: /OIDC Login Buttons/ });
expect(oidcParent).toBeNull();

})

Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/multi-vo-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export const getSampleVOs = (): VO[] => {
name: "CMS",
shortName: "cms",
logoUrl: "https://cms.ch/logo.png",
oidcEnabled: false,
oidcProviders: [],
oidcEnabled: true,
oidcProviders: [getSampleOIDCProviders()[0]],
};
vos.push(atlas);
vos.push(cms);
Expand Down
5 changes: 0 additions & 5 deletions tools/check-env.ts

This file was deleted.

0 comments on commit 55733f7

Please sign in to comment.