Skip to content

test(site): add e2e tests for security #12961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
e2e tests for security
  • Loading branch information
mtojek committed Apr 15, 2024
commit 1daff361dd62e9899de7b86cf4b3d9c0ceef9fee
15 changes: 15 additions & 0 deletions site/e2e/tests/deployment/security.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { expect, test } from "@playwright/test";

Check failure on line 1 in site/e2e/tests/deployment/security.ts

View workflow job for this annotation

GitHub Actions / fmt

'expect' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 1 in site/e2e/tests/deployment/security.ts

View workflow job for this annotation

GitHub Actions / lint

'expect' is defined but never used. Allowed unused vars must match /^_/u

Check failure on line 1 in site/e2e/tests/deployment/security.ts

View workflow job for this annotation

GitHub Actions / lint

'expect' is defined but never used. Allowed unused vars must match /^_/u
import * as API from "api/api";
import { setupApiCalls } from "../../api";

test("enabled security settings", async ({ page }) => {
await setupApiCalls(page);

await page.goto("/deployment/security", { waitUntil: "domcontentloaded" });

// Load deployment settings
const config = await API.getDeploymentConfig();

Check failure on line 11 in site/e2e/tests/deployment/security.ts

View workflow job for this annotation

GitHub Actions / fmt

'config' is assigned a value but never used. Allowed unused vars must match /^_/u

Check failure on line 11 in site/e2e/tests/deployment/security.ts

View workflow job for this annotation

GitHub Actions / lint

'config' is assigned a value but never used. Allowed unused vars must match /^_/u

Check failure on line 11 in site/e2e/tests/deployment/security.ts

View workflow job for this annotation

GitHub Actions / lint

'config' is assigned a value but never used. Allowed unused vars must match /^_/u

// Check flags

});
7 changes: 6 additions & 1 deletion site/src/components/Badges/Badges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ const styles = {
} satisfies Record<string, Interpolation<Theme>>;

export const EnabledBadge: FC = () => {
return <span css={[styles.badge, styles.enabledBadge]}>Enabled</span>;
return (
<span css={[styles.badge, styles.enabledBadge]} className="option-enabled">
Enabled
</span>
);
};

export const EntitledBadge: FC = () => {
Expand Down Expand Up @@ -95,6 +99,7 @@ export const DisabledBadge: FC = forwardRef<
color: theme.experimental.l1.text,
}),
]}
className="option-disabled"
>
Disabled
</span>
Expand Down
24 changes: 20 additions & 4 deletions site/src/pages/DeploySettingsPage/Option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,27 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
}

if (typeof value === "number") {
return <span css={styles.option}>{value}</span>;
return (
<span css={styles.option} className="option-value-number">
{value}
</span>
);
}

if (!value || value.length === 0) {
return <span css={styles.option}>Not set</span>;
return (
<span css={styles.option} className="option-value-empty">
Not set
</span>
);
}

if (typeof value === "string") {
return <span css={styles.option}>{value}</span>;
return (
<span css={styles.option} className="option-value-string">
{value}
</span>
);
}

if (typeof value === "object" && !Array.isArray(value)) {
Expand Down Expand Up @@ -104,7 +116,11 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
);
}

return <span css={styles.option}>{JSON.stringify(value)}</span>;
return (
<span css={styles.option} className="option-value-json">
{JSON.stringify(value)}
</span>
);
};

type OptionConfigProps = HTMLAttributes<HTMLDivElement> & { isSource: boolean };
Expand Down
Loading