Skip to content

Modern Docker Management, Designed for Everyone

chore: update lint-staged formatting checks

Kyle Mendellc2201b6b89a9
diff --git a/Justfile b/Justfile
index ac4e7e681..5e5f65cf7 100644
--- a/Justfile
+++ b/Justfile
@@ -1031,11 +1031,16 @@ _gomod-sync-all:
gomod action="tidy" target="all":
@just "_gomod-{{ action }}-{{ target }}"
-# Format frontend (Prettier) and Go modules (gofmt)
+# Format frontend (Prettier), test/email TypeScript (oxfmt), and Go modules (gofmt)
[group('format')]
_format-frontend:
pnpm -C frontend format
+[group('format')]
+_format-js:
+ pnpm -C tests exec oxfmt "**/*.{ts,tsx,js,jsx,mts,cts}"
+ pnpm -C email-templates exec oxfmt "**/*.{ts,tsx,js,jsx,mts,cts}"
+
[group('format')]
_format-go:
cd backend && gofmt -s -w .
@@ -1050,6 +1055,11 @@ _format-just:
_format-check-frontend:
pnpm -C frontend format:check
+[group('format')]
+_format-check-js:
+ pnpm -C tests exec oxfmt --check "**/*.{ts,tsx,js,jsx,mts,cts}"
+ pnpm -C email-templates exec oxfmt --check "**/*.{ts,tsx,js,jsx,mts,cts}"
+
[group('format')]
_format-check-go:
#!/usr/bin/env bash
@@ -1065,15 +1075,17 @@ _format-check-go:
[group('format')]
_format-all:
@just _format-frontend
+ @just _format-js
@just _format-go
@just _format-just
[group('format')]
_format-check-all:
@just _format-check-frontend
+ @just _format-check-js
@just _format-check-go
-# Format targets. Valid: "frontend", "go", "just", "all". Use --check to verify formatting.
+# Format targets. Valid: "frontend", "js", "go", "just", "all". Use --check to verify formatting.
[group('format')]
format target="all" check="":
@if [ "{{ check }}" = "--check" ]; then just "_format-check-{{ target }}"; else just "_format-{{ target }}"; fi
diff --git a/email-templates/.oxfmtrc.json b/email-templates/.oxfmtrc.json
new file mode 100644
index 000000000..9501a0894
--- /dev/null
+++ b/email-templates/.oxfmtrc.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "./node_modules/oxfmt/configuration_schema.json",
+ "useTabs": true,
+ "singleQuote": true,
+ "trailingComma": "none",
+ "printWidth": 100,
+ "sortPackageJson": true
+}
diff --git a/email-templates/build.ts b/email-templates/build.ts
index a52130de1..89e878fed 100644
--- a/email-templates/build.ts
+++ b/email-templates/build.ts
@@ -5,11 +5,11 @@ import * as path from 'node:path';
const outputDir = '../backend/resources/email-templates';
if (!fs.existsSync(outputDir)) {
- fs.mkdirSync(outputDir, { recursive: true });
+ fs.mkdirSync(outputDir, { recursive: true });
}
function getTemplateName(filename: string): string {
- return filename.replace('.tsx', '');
+ return filename.replace('.tsx', '');
}
/**
@@ -19,109 +19,109 @@ function getTemplateName(filename: string): string {
* - If no '>' exists in the window, hard-break at maxLen.
*/
function tagAwareWrap(input: string, maxLen: number): string {
- const out: string[] = [];
-
- for (const originalLine of input.split(/\r?\n/)) {
- let line = originalLine;
- while (line.length > maxLen) {
- let breakPos = line.lastIndexOf('>', maxLen);
-
- // If '>' happens to be exactly at maxLen, break after it
- if (breakPos === maxLen) breakPos = maxLen;
-
- // If we found a '>' before the limit, break right after it
- if (breakPos > -1 && breakPos < maxLen) {
- out.push(line.slice(0, breakPos + 1));
- line = line.slice(breakPos + 1);
- continue;
- }
-
- // No suitable tag end found—hard break
- out.push(line.slice(0, maxLen));
- line = line.slice(maxLen);
- }
- out.push(line);
- }
-
- return out.join('\n');
+ const out: string[] = [];
+
+ for (const originalLine of input.split(/\r?\n/)) {
+ let line = originalLine;
+ while (line.length > maxLen) {
+ let breakPos = line.lastIndexOf('>', maxLen);
+
+ // If '>' happens to be exactly at maxLen, break after it
+ if (breakPos === maxLen) breakPos = maxLen;
+
+ // If we found a '>' before the limit, break right after it
+ if (breakPos > -1 && breakPos < maxLen) {
+ out.push(line.slice(0, breakPos + 1));
+ line = line.slice(breakPos + 1);
+ continue;
+ }
+
+ // No suitable tag end found—hard break
+ out.push(line.slice(0, maxLen));
+ line = line.slice(maxLen);
+ }
+ out.push(line);
+ }
+
+ return out.join('\n');
}
async function buildTemplateFile(Component: any, templateName: string, isPlainText: boolean) {
- const rendered = await render(Component(Component.TemplateProps), {
- plainText: isPlainText,
- });
-
- // Normalize quotes
- let normalized = rendered.replace(/&quot;/g, '"');
-
- // Post-process: Replace special placeholders with Go template syntax
- // This allows us to inject Go template loops that can't be rendered by React
- if (isPlainText) {
- // For plain text, use simple line-by-line rendering
- normalized = normalized.replace(
- /IMAGELIST_PLACEHOLDER/g,
- '{{range .ImageList}}• {{.}}\n{{end}}'
- );
- } else {
- // For HTML, wrap each item in a paragraph tag with proper styling
- normalized = normalized.replace(
- /<p[^>]*>IMAGELIST_PLACEHOLDER<\/p>/g,
- '{{range .ImageList}}<p style="font-size:13px;line-height:20px;color:#cbd5e1;margin:4px 0;font-family:monospace">• {{.}}</p>{{end}}'
- );
- }
-
- // Enforce line length: prefer tag boundaries, never spaces
- const maxLen = isPlainText ? 78 : 998; // RFC-safe
- const safe = tagAwareWrap(normalized, maxLen);
-
- const goTemplate = `{{define "root"}}${safe}{{end}}\n`;
- const suffix = isPlainText ? '_text.tmpl' : '_html.tmpl';
- const templatePath = path.join(outputDir, `${templateName}${suffix}`);
-
- fs.writeFileSync(templatePath, goTemplate);
+ const rendered = await render(Component(Component.TemplateProps), {
+ plainText: isPlainText
+ });
+
+ // Normalize quotes
+ let normalized = rendered.replace(/&quot;/g, '"');
+
+ // Post-process: Replace special placeholders with Go template syntax
+ // This allows us to inject Go template loops that can't be rendered by React
+ if (isPlainText) {
+ // For plain text, use simple line-by-line rendering
+ normalized = normalized.replace(
+ /IMAGELIST_PLACEHOLDER/g,
+ '{{range .ImageList}}• {{.}}\n{{end}}'
+ );
+ } else {
+ // For HTML, wrap each item in a paragraph tag with proper styling
+ normalized = normalized.replace(
+ /<p[^>]*>IMAGELIST_PLACEHOLDER<\/p>/g,
+ '{{range .ImageList}}<p style="font-size:13px;line-height:20px;color:#cbd5e1;margin:4px 0;font-family:monospace">• {{.}}</p>{{end}}'
+ );
+ }
+
+ // Enforce line length: prefer tag boundaries, never spaces
+ const maxLen = isPlainText ? 78 : 998; // RFC-safe
+ const safe = tagAwareWrap(normalized, maxLen);
+
+ const goTemplate = `{{define "root"}}${safe}{{end}}\n`;
+ const suffix = isPlainText ? '_text.tmpl' : '_html.tmpl';
+ const templatePath = path.join(outputDir, `${templateName}${suffix}`);
+
+ fs.writeFileSync(templatePath, goTemplate);
}
async function discoverAndBuildTemplates() {
- console.log('Discovering and building email templates...');
+ console.log('Discovering and building email templates...');
- const emailsDir = './emails';
- const files = fs.readdirSync(emailsDir);
+ const emailsDir = './emails';
+ const files = fs.readdirSync(emailsDir);
- for (const file of files) {
- if (!file.endsWith('.tsx')) continue;
+ for (const file of files) {
+ if (!file.endsWith('.tsx')) continue;
- const templateName = getTemplateName(file);
- const modulePath = `./${emailsDir}/${file}`;
+ const templateName = getTemplateName(file);
+ const modulePath = `./${emailsDir}/${file}`;
- console.log(`Building ${templateName}...`);
+ console.log(`Building ${templateName}...`);
- try {
- const module = await import(modulePath);
- const Component = module.default || module[Object.keys(module)[0]];
+ try {
+ const module = await import(modulePath);
+ const Component = module.default || module[Object.keys(module)[0]];
- if (!Component) {
- console.error(`✗ No component found in ${file}`);
- continue;
- }
+ if (!Component) {
+ console.error(`✗ No component found in ${file}`);
+ continue;
+ }
- if (!Component.TemplateProps) {
- console.error(`✗ No TemplateProps found in ${file}`);
- continue;
- }
+ if (!Component.TemplateProps) {
+ console.error(`✗ No TemplateProps found in ${file}`);
+ continue;
+ }
- await buildTemplateFile(Component, templateName, false); // HTML
- await buildTemplateFile(Component, templateName, true); // Text
+ await buildTemplateFile(Component, templateName, false); // HTML
+ await buildTemplateFile(Component, templateName, true); // Text
- console.log(`✓ Built ${templateName}`);
- } catch (error) {
- console.error(`✗ Error building ${templateName}:`, error);
- }
- }
+ console.log(`✓ Built ${templateName}`);
+ } catch (error) {
+ console.error(`✗ Error building ${templateName}:`, error);
+ }
+ }
}
async function main() {
- await discoverAndBuildTemplates();
- console.log('All templates built successfully!');
+ await discoverAndBuildTemplates();
+ console.log('All templates built successfully!');
}
main().catch(console.error);
diff --git a/email-templates/components/base-template.tsx b/email-templates/components/base-template.tsx
index 415cb8ab6..bee28d641 100644
--- a/email-templates/components/base-template.tsx
+++ b/email-templates/components/base-template.tsx
@@ -1,77 +1,78 @@
import { Body, Container, Head, Html, Img, Link, Section, Text } from '@react-email/components';
interface BaseTemplateProps {
- logoURL?: string;
- appURL?: string;
- children: React.ReactNode;
+ logoURL?: string;
+ appURL?: string;
+ children: React.ReactNode;
}
export const BaseTemplate = ({ logoURL, appURL, children }: BaseTemplateProps) => {
- return (
- <Html>
- <Head />
- <Body style={mainStyle}>
- <Container style={{ width: '600px', margin: '0 auto' }}>
- <Section style={logoSection}>
- <Img src={logoURL} width="180" height="auto" alt="Arcane" style={logoStyle} />
- </Section>
- <div style={glassCard}>{children}</div>
- {appURL && (
- <Section style={footerSection}>
- <Text style={footerText}>
- <Link href={appURL} style={footerLink}>
- Open Arcane Dashboard →
- </Link>
- </Text>
- </Section>
- )}
- </Container>
- </Body>
- </Html>
- );
+ return (
+ <Html>
+ <Head />
+ <Body style={mainStyle}>
+ <Container style={{ width: '600px', margin: '0 auto' }}>
+ <Section style={logoSection}>
+ <Img src={logoURL} width="180" height="auto" alt="Arcane" style={logoStyle} />
+ </Section>
+ <div style={glassCard}>{children}</div>
+ {appURL && (
+ <Section style={footerSection}>
+ <Text style={footerText}>
+ <Link href={appURL} style={footerLink}>
+ Open Arcane Dashboard →
+ </Link>
+ </Text>
+ </Section>
+ )}
+ </Container>
+ </Body>
+ </Html>
+ );
};
const mainStyle = {
- padding: '40px 20px',
- backgroundColor: '#0f172a',
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
+ padding: '40px 20px',
+ backgroundColor: '#0f172a',
+ fontFamily:
+ "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif"
};
const logoSection = {
- textAlign: 'center' as const,
- marginBottom: '32px',
+ textAlign: 'center' as const,
+ marginBottom: '32px'
};
const logoStyle = {
- width: '180px',
- height: 'auto',
- display: 'inline-block',
+ width: '180px',
+ height: 'auto',
+ display: 'inline-block'
};
const glassCard = {
- backgroundColor: 'rgba(30, 41, 59, 0.6)',
- backdropFilter: 'blur(20px)',
- WebkitBackdropFilter: 'blur(20px)',
- border: '1px solid rgba(148, 163, 184, 0.1)',
- padding: '32px',
- borderRadius: '16px',
- boxShadow: '0 8px 32px 0 rgba(0, 0, 0, 0.37)',
+ backgroundColor: 'rgba(30, 41, 59, 0.6)',
+ backdropFilter: 'blur(20px)',
+ WebkitBackdropFilter: 'blur(20px)',
+ border: '1px solid rgba(148, 163, 184, 0.1)',
+ padding: '32px',
+ borderRadius: '16px',
+ boxShadow: '0 8px 32px 0 rgba(0, 0, 0, 0.37)'
};
const footerSection = {
- textAlign: 'center' as const,
- marginTop: '32px',
- paddingTop: '24px',
+ textAlign: 'center' as const,
+ marginTop: '32px',
+ paddingTop: '24px'
};
const footerText = {
- margin: '0',
- fontSize: '14px',
- lineHeight: '20px',
+ margin: '0',
+ fontSize: '14px',
+ lineHeight: '20px'
};
const footerLink = {
- color: '#a78bfa',
- textDecoration: 'none',
- fontWeight: '500' as const,
+ color: '#a78bfa',
+ textDecoration: 'none',
+ fontWeight: '500' as const
};
diff --git a/email-templates/components/button.tsx b/email-templates/components/button.tsx
index ea1b3eed8..d9134138e 100644
--- a/email-templates/components/button.tsx
+++ b/email-templates/components/button.tsx
@@ -1,33 +1,33 @@
-import { Button as EmailButton } from "@react-email/components";
+import { Button as EmailButton } from '@react-email/components';
interface ButtonProps {
- href: string;
- children: React.ReactNode;
- style?: React.CSSProperties;
+ href: string;
+ children: React.ReactNode;
+ style?: React.CSSProperties;
}
export const Button = ({ href, children, style = {} }: ButtonProps) => {
- const buttonStyle = {
- backgroundColor: "#000000",
- color: "#ffffff",
- padding: "12px 24px",
- borderRadius: "4px",
- fontSize: "15px",
- fontWeight: "500",
- cursor: "pointer",
- marginTop: "10px",
- ...style,
- };
+ const buttonStyle = {
+ backgroundColor: '#000000',
+ color: '#ffffff',
+ padding: '12px 24px',
+ borderRadius: '4px',
+ fontSize: '15px',
+ fontWeight: '500',
+ cursor: 'pointer',
+ marginTop: '10px',
+ ...style
+ };
- return (
- <div style={buttonContainer}>
- <EmailButton style={buttonStyle} href={href}>
- {children}
- </EmailButton>
- </div>
- );
+ return (
+ <div style={buttonContainer}>
+ <EmailButton style={buttonStyle} href={href}>
+ {children}
+ </EmailButton>
+ </div>
+ );
};
const buttonContainer = {
- textAlign: "center" as const,
+ textAlign: 'center' as const
};
diff --git a/email-templates/components/card-header.tsx b/email-templates/components/card-header.tsx
index cb63c6401..ffa1e0d76 100644
--- a/email-templates/components/card-header.tsx
+++ b/email-templates/components/card-header.tsx
@@ -1,32 +1,32 @@
import { Column, Heading, Row, Text } from '@react-email/components';
export default function CardHeader({ title, warning }: { title: string; warning?: boolean }) {
- return (
- <Row>
- <Column>
- <Heading as="h1" style={titleStyle}>
- {title}
- </Heading>
- </Column>
- <Column align="right">{warning && <Text style={warningStyle}>Warning</Text>}</Column>
- </Row>
- );
+ return (
+ <Row>
+ <Column>
+ <Heading as="h1" style={titleStyle}>
+ {title}
+ </Heading>
+ </Column>
+ <Column align="right">{warning && <Text style={warningStyle}>Warning</Text>}</Column>
+ </Row>
+ );
}
const titleStyle = {
- fontSize: '24px',
- fontWeight: 'bold' as const,
- margin: 0,
- color: '#f1f5f9',
+ fontSize: '24px',
+ fontWeight: 'bold' as const,
+ margin: 0,
+ color: '#f1f5f9'
};
const warningStyle = {
- backgroundColor: '#fbbf24',
- color: '#78350f',
- padding: '4px 12px',
- borderRadius: '12px',
- fontSize: '12px',
- fontWeight: '600' as const,
- display: 'inline-block',
- margin: 0,
+ backgroundColor: '#fbbf24',
+ color: '#78350f',
+ padding: '4px 12px',
+ borderRadius: '12px',
+ fontSize: '12px',
+ fontWeight: '600' as const,
+ display: 'inline-block',
+ margin: 0
};
diff --git a/email-templates/emails/batch-image-updates.tsx b/email-templates/emails/batch-image-updates.tsx
index f4db64f6d..ce9b187f7 100644
--- a/email-templates/emails/batch-image-updates.tsx
+++ b/email-templates/emails/batch-image-updates.tsx
@@ -4,195 +4,199 @@ import CardHeader from '../components/card-header';
import { sharedPreviewProps, sharedTemplateProps } from '../props';
interface BatchImageUpdatesEmailProps {
- logoURL: string;
- appURL: string;
- environment: string;
- updateCount: number;
- checkTime: string;
- imageList?: string[];
+ logoURL: string;
+ appURL: string;
+ environment: string;
+ updateCount: number;
+ checkTime: string;
+ imageList?: string[];
}
export const BatchImageUpdatesEmail = ({
- logoURL,
- appURL,
- environment,
- updateCount,
- checkTime,
- imageList = [],
+ logoURL,
+ appURL,
+ environment,
+ updateCount,
+ checkTime,
+ imageList = []
}: BatchImageUpdatesEmailProps) => {
- // Handle both array (preview) and string (template placeholder)
- const images = Array.isArray(imageList) ? imageList : [];
-
- // For template generation, always include image list section with placeholder text
- // This will be replaced with Go template range syntax
- const showImageList = images.length > 0 || typeof imageList === 'string';
-
- return (
- <BaseTemplate logoURL={logoURL} appURL={appURL}>
- <CardHeader title="Image Updates Available" />
-
- <Section style={{ marginTop: '24px' }}>
- <Text style={mainTextStyle}>
- {updateCount === 1 ?
- `1 container image has an update available.`
- : `${updateCount} container images have updates available.`}
- </Text>
- </Section>
-
- <Section style={infoSectionStyle}>
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Environment:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{environment}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Updates Available:</Text>
- </Column>
- <Column>
- <Text style={countStyle}>{updateCount}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Checked At:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{checkTime}</Text>
- </Column>
- </Row>
- </Section>
-
- {showImageList && (
- <Section style={imageListSectionStyle}>
- <Text style={imageListHeaderStyle}>Images with Updates:</Text>
- {images.length > 0 ?
- images.map((image, index) => (
- <Text key={index} style={imageItemStyle}>
- • {image}
- </Text>
- ))
- : <Text style={imageItemStyle}>IMAGELIST_PLACEHOLDER</Text>}
- </Section>
- )}
-
- <Section style={{ marginTop: '24px' }}>
- <Text style={footerStyle}>Log in to Arcane to view details and update your containers.</Text>
- </Section>
- </BaseTemplate>
- );
+ // Handle both array (preview) and string (template placeholder)
+ const images = Array.isArray(imageList) ? imageList : [];
+
+ // For template generation, always include image list section with placeholder text
+ // This will be replaced with Go template range syntax
+ const showImageList = images.length > 0 || typeof imageList === 'string';
+
+ return (
+ <BaseTemplate logoURL={logoURL} appURL={appURL}>
+ <CardHeader title="Image Updates Available" />
+
+ <Section style={{ marginTop: '24px' }}>
+ <Text style={mainTextStyle}>
+ {updateCount === 1
+ ? `1 container image has an update available.`
+ : `${updateCount} container images have updates available.`}
+ </Text>
+ </Section>
+
+ <Section style={infoSectionStyle}>
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Environment:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{environment}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Updates Available:</Text>
+ </Column>
+ <Column>
+ <Text style={countStyle}>{updateCount}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Checked At:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{checkTime}</Text>
+ </Column>
+ </Row>
+ </Section>
+
+ {showImageList && (
+ <Section style={imageListSectionStyle}>
+ <Text style={imageListHeaderStyle}>Images with Updates:</Text>
+ {images.length > 0 ? (
+ images.map((image, index) => (
+ <Text key={index} style={imageItemStyle}>
+ • {image}
+ </Text>
+ ))
+ ) : (
+ <Text style={imageItemStyle}>IMAGELIST_PLACEHOLDER</Text>
+ )}
+ </Section>
+ )}
+
+ <Section style={{ marginTop: '24px' }}>
+ <Text style={footerStyle}>
+ Log in to Arcane to view details and update your containers.
+ </Text>
+ </Section>
+ </BaseTemplate>
+ );
};
export default BatchImageUpdatesEmail;
const mainTextStyle = {
- fontSize: '16px',
- lineHeight: '24px',
- color: '#cbd5e1',
- margin: '0 0 16px 0',
+ fontSize: '16px',
+ lineHeight: '24px',
+ color: '#cbd5e1',
+ margin: '0 0 16px 0'
};
const infoSectionStyle = {
- marginTop: '20px',
- backgroundColor: 'rgba(15, 23, 42, 0.5)',
- border: '1px solid rgba(148, 163, 184, 0.1)',
- padding: '20px',
- borderRadius: '12px',
+ marginTop: '20px',
+ backgroundColor: 'rgba(15, 23, 42, 0.5)',
+ border: '1px solid rgba(148, 163, 184, 0.1)',
+ padding: '20px',
+ borderRadius: '12px'
};
const infoRowStyle = {
- marginBottom: '0',
+ marginBottom: '0'
};
const labelColumnStyle = {
- width: '160px',
- verticalAlign: 'top' as const,
- paddingRight: '12px',
+ width: '160px',
+ verticalAlign: 'top' as const,
+ paddingRight: '12px'
};
const labelStyle = {
- fontSize: '14px',
- fontWeight: '600' as const,
- color: '#94a3b8',
- margin: '8px 0',
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#94a3b8',
+ margin: '8px 0'
};
const valueStyle = {
- fontSize: '14px',
- color: '#e2e8f0',
- margin: '8px 0',
- wordBreak: 'break-word' as const,
+ fontSize: '14px',
+ color: '#e2e8f0',
+ margin: '8px 0',
+ wordBreak: 'break-word' as const
};
const countStyle = {
- fontSize: '24px',
- fontWeight: '700' as const,
- color: '#34d399',
- margin: '8px 0',
+ fontSize: '24px',
+ fontWeight: '700' as const,
+ color: '#34d399',
+ margin: '8px 0'
};
const dividerStyle = {
- borderColor: 'rgba(148, 163, 184, 0.2)',
- margin: '4px 0',
+ borderColor: 'rgba(148, 163, 184, 0.2)',
+ margin: '4px 0'
};
const footerStyle = {
- fontSize: '13px',
- lineHeight: '20px',
- color: '#94a3b8',
- margin: '0',
+ fontSize: '13px',
+ lineHeight: '20px',
+ color: '#94a3b8',
+ margin: '0'
};
const imageListSectionStyle = {
- marginTop: '24px',
- backgroundColor: 'rgba(15, 23, 42, 0.3)',
- border: '1px solid rgba(148, 163, 184, 0.1)',
- padding: '16px',
- borderRadius: '8px',
+ marginTop: '24px',
+ backgroundColor: 'rgba(15, 23, 42, 0.3)',
+ border: '1px solid rgba(148, 163, 184, 0.1)',
+ padding: '16px',
+ borderRadius: '8px'
};
const imageListHeaderStyle = {
- fontSize: '14px',
- fontWeight: '600' as const,
- color: '#94a3b8',
- margin: '0 0 12px 0',
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#94a3b8',
+ margin: '0 0 12px 0'
};
const imageItemStyle = {
- fontSize: '13px',
- lineHeight: '20px',
- color: '#cbd5e1',
- margin: '4px 0',
- fontFamily: 'monospace',
+ fontSize: '13px',
+ lineHeight: '20px',
+ color: '#cbd5e1',
+ margin: '4px 0',
+ fontFamily: 'monospace'
};
BatchImageUpdatesEmail.TemplateProps = {
- ...sharedTemplateProps,
- updateCount: '{{.UpdateCount}}',
- checkTime: '{{.CheckTime}}',
- imageList: 'TEMPLATE_PLACEHOLDER', // This triggers the image list section to render
+ ...sharedTemplateProps,
+ updateCount: '{{.UpdateCount}}',
+ checkTime: '{{.CheckTime}}',
+ imageList: 'TEMPLATE_PLACEHOLDER' // This triggers the image list section to render
};
BatchImageUpdatesEmail.PreviewProps = {
- ...sharedPreviewProps,
- updateCount: 7,
- checkTime: '2025-10-27 15:30:00 UTC',
- imageList: [
- 'ghcr.io/linuxserver/plex:latest',
- 'postgres:16-alpine',
- 'redis:7.2-alpine',
- 'nginx:latest',
- 'traefik:v3.0',
- 'portainer/portainer-ce:latest',
- 'grafana/grafana:latest',
- ],
+ ...sharedPreviewProps,
+ updateCount: 7,
+ checkTime: '2025-10-27 15:30:00 UTC',
+ imageList: [
+ 'ghcr.io/linuxserver/plex:latest',
+ 'postgres:16-alpine',
+ 'redis:7.2-alpine',
+ 'nginx:latest',
+ 'traefik:v3.0',
+ 'portainer/portainer-ce:latest',
+ 'grafana/grafana:latest'
+ ]
};
diff --git a/email-templates/emails/container-update.tsx b/email-templates/emails/container-update.tsx
index 9a6775159..9b10fcef2 100644
--- a/email-templates/emails/container-update.tsx
+++ b/email-templates/emails/container-update.tsx
@@ -4,217 +4,220 @@ import CardHeader from '../components/card-header';
import { sharedPreviewProps, sharedTemplateProps } from '../props';
interface ContainerUpdateEmailProps {
- logoURL: string;
- appURL: string;
- environment: string;
- containerName: string;
- imageRef: string;
- oldDigest: string;
- newDigest: string;
- updateTime: string;
+ logoURL: string;
+ appURL: string;
+ environment: string;
+ containerName: string;
+ imageRef: string;
+ oldDigest: string;
+ newDigest: string;
+ updateTime: string;
}
export const ContainerUpdateEmail = ({
- logoURL,
- appURL,
- environment,
- containerName,
- imageRef,
- oldDigest,
- newDigest,
- updateTime,
+ logoURL,
+ appURL,
+ environment,
+ containerName,
+ imageRef,
+ oldDigest,
+ newDigest,
+ updateTime
}: ContainerUpdateEmailProps) => {
- const truncateDigest = (digest: string) => {
- if (digest.length > 19) {
- return digest.substring(0, 19) + '...';
- }
- return digest;
- };
-
- return (
- <BaseTemplate logoURL={logoURL} appURL={appURL}>
- <CardHeader title="Container Successfully Updated" />
-
- <Section style={{ marginTop: '24px' }}>
- <Text style={mainTextStyle}>Your container has been successfully updated with the latest image version.</Text>
- </Section>
-
- <Section style={infoSectionStyle}>
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Environment:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{environment}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Container:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{containerName}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Image:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{imageRef}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Status:</Text>
- </Column>
- <Column>
- <Text style={statusStyle}>✓ Updated Successfully</Text>
- </Column>
- </Row>
-
- {oldDigest && (
- <>
- <Hr style={dividerStyle} />
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Previous Version:</Text>
- </Column>
- <Column>
- <Text style={digestStyle}>{truncateDigest(oldDigest)}</Text>
- </Column>
- </Row>
- </>
- )}
-
- {newDigest && (
- <>
- <Hr style={dividerStyle} />
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Current Version:</Text>
- </Column>
- <Column>
- <Text style={digestStyle}>{truncateDigest(newDigest)}</Text>
- </Column>
- </Row>
- </>
- )}
-
- {updateTime && (
- <>
- <Hr style={dividerStyle} />
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Updated At:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{updateTime}</Text>
- </Column>
- </Row>
- </>
- )}
- </Section>
-
- <Section style={{ marginTop: '24px' }}>
- <Text style={footerStyle}>
- This is an automated notification from Arcane. Your container has been restarted with the new image version.
- </Text>
- </Section>
- </BaseTemplate>
- );
+ const truncateDigest = (digest: string) => {
+ if (digest.length > 19) {
+ return digest.substring(0, 19) + '...';
+ }
+ return digest;
+ };
+
+ return (
+ <BaseTemplate logoURL={logoURL} appURL={appURL}>
+ <CardHeader title="Container Successfully Updated" />
+
+ <Section style={{ marginTop: '24px' }}>
+ <Text style={mainTextStyle}>
+ Your container has been successfully updated with the latest image version.
+ </Text>
+ </Section>
+
+ <Section style={infoSectionStyle}>
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Environment:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{environment}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Container:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{containerName}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Image:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{imageRef}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Status:</Text>
+ </Column>
+ <Column>
+ <Text style={statusStyle}>✓ Updated Successfully</Text>
+ </Column>
+ </Row>
+
+ {oldDigest && (
+ <>
+ <Hr style={dividerStyle} />
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Previous Version:</Text>
+ </Column>
+ <Column>
+ <Text style={digestStyle}>{truncateDigest(oldDigest)}</Text>
+ </Column>
+ </Row>
+ </>
+ )}
+
+ {newDigest && (
+ <>
+ <Hr style={dividerStyle} />
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Current Version:</Text>
+ </Column>
+ <Column>
+ <Text style={digestStyle}>{truncateDigest(newDigest)}</Text>
+ </Column>
+ </Row>
+ </>
+ )}
+
+ {updateTime && (
+ <>
+ <Hr style={dividerStyle} />
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Updated At:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{updateTime}</Text>
+ </Column>
+ </Row>
+ </>
+ )}
+ </Section>
+
+ <Section style={{ marginTop: '24px' }}>
+ <Text style={footerStyle}>
+ This is an automated notification from Arcane. Your container has been restarted with the
+ new image version.
+ </Text>
+ </Section>
+ </BaseTemplate>
+ );
};
export default ContainerUpdateEmail;
const mainTextStyle = {
- fontSize: '16px',
- lineHeight: '24px',
- color: '#cbd5e1',
- margin: '0 0 16px 0',
+ fontSize: '16px',
+ lineHeight: '24px',
+ color: '#cbd5e1',
+ margin: '0 0 16px 0'
};
const infoSectionStyle = {
- marginTop: '20px',
- backgroundColor: 'rgba(15, 23, 42, 0.5)',
- border: '1px solid rgba(148, 163, 184, 0.1)',
- padding: '20px',
- borderRadius: '12px',
+ marginTop: '20px',
+ backgroundColor: 'rgba(15, 23, 42, 0.5)',
+ border: '1px solid rgba(148, 163, 184, 0.1)',
+ padding: '20px',
+ borderRadius: '12px'
};
const infoRowStyle = {
- marginBottom: '0',
+ marginBottom: '0'
};
const labelColumnStyle = {
- width: '140px',
- verticalAlign: 'top' as const,
- paddingRight: '12px',
+ width: '140px',
+ verticalAlign: 'top' as const,
+ paddingRight: '12px'
};
const labelStyle = {
- fontSize: '14px',
- fontWeight: '600' as const,
- color: '#94a3b8',
- margin: '8px 0',
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#94a3b8',
+ margin: '8px 0'
};
const valueStyle = {
- fontSize: '14px',
- color: '#e2e8f0',
- margin: '8px 0',
- wordBreak: 'break-word' as const,
+ fontSize: '14px',
+ color: '#e2e8f0',
+ margin: '8px 0',
+ wordBreak: 'break-word' as const
};
const digestStyle = {
- fontSize: '13px',
- color: '#e2e8f0',
- fontFamily: "'Courier New', Courier, monospace",
- margin: '8px 0',
+ fontSize: '13px',
+ color: '#e2e8f0',
+ fontFamily: "'Courier New', Courier, monospace",
+ margin: '8px 0'
};
const statusStyle = {
- fontSize: '14px',
- fontWeight: '600' as const,
- color: '#34d399',
- margin: '8px 0',
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#34d399',
+ margin: '8px 0'
};
const dividerStyle = {
- borderColor: 'rgba(148, 163, 184, 0.2)',
- margin: '4px 0',
+ borderColor: 'rgba(148, 163, 184, 0.2)',
+ margin: '4px 0'
};
const footerStyle = {
- fontSize: '13px',
- lineHeight: '20px',
- color: '#94a3b8',
- margin: '0',
+ fontSize: '13px',
+ lineHeight: '20px',
+ color: '#94a3b8',
+ margin: '0'
};
ContainerUpdateEmail.TemplateProps = {
- ...sharedTemplateProps,
- containerName: '{{.ContainerName}}',
- imageRef: '{{.ImageRef}}',
- oldDigest: '{{.OldDigest}}',
- newDigest: '{{.NewDigest}}',
- updateTime: '{{.UpdateTime}}',
+ ...sharedTemplateProps,
+ containerName: '{{.ContainerName}}',
+ imageRef: '{{.ImageRef}}',
+ oldDigest: '{{.OldDigest}}',
+ newDigest: '{{.NewDigest}}',
+ updateTime: '{{.UpdateTime}}'
};
ContainerUpdateEmail.PreviewProps = {
- ...sharedPreviewProps,
- containerName: 'my-app-container',
- imageRef: 'nginx:latest',
- oldDigest: 'sha256:abc123def456789012345678901234567890',
- newDigest: 'sha256:xyz789ghi012345678901234567890123456',
- updateTime: '2025-10-27 15:30:00 UTC',
+ ...sharedPreviewProps,
+ containerName: 'my-app-container',
+ imageRef: 'nginx:latest',
+ oldDigest: 'sha256:abc123def456789012345678901234567890',
+ newDigest: 'sha256:xyz789ghi012345678901234567890123456',
+ updateTime: '2025-10-27 15:30:00 UTC'
};
diff --git a/email-templates/emails/image-update.tsx b/email-templates/emails/image-update.tsx
index eb703a837..e2ce80479 100644
--- a/email-templates/emails/image-update.tsx
+++ b/email-templates/emails/image-update.tsx
@@ -4,238 +4,238 @@ import CardHeader from '../components/card-header';
import { sharedPreviewProps, sharedTemplateProps } from '../props';
interface ImageUpdateEmailProps {
- logoURL: string;
- appURL: string;
- environment: string;
- imageRef: string;
- hasUpdate: boolean;
- updateType: string;
- currentDigest: string;
- latestDigest: string;
- checkTime: string;
+ logoURL: string;
+ appURL: string;
+ environment: string;
+ imageRef: string;
+ hasUpdate: boolean;
+ updateType: string;
+ currentDigest: string;
+ latestDigest: string;
+ checkTime: string;
}
export const ImageUpdateEmail = ({
- logoURL,
- appURL,
- environment,
- imageRef,
- hasUpdate,
- updateType,
- currentDigest,
- latestDigest,
- checkTime,
+ logoURL,
+ appURL,
+ environment,
+ imageRef,
+ hasUpdate,
+ updateType,
+ currentDigest,
+ latestDigest,
+ checkTime
}: ImageUpdateEmailProps) => {
- const truncateDigest = (digest: string) => {
- if (digest.length > 19) {
- return digest.substring(0, 19) + '...';
- }
- return digest;
- };
-
- return (
- <BaseTemplate logoURL={logoURL} appURL={appURL}>
- <CardHeader title="Container Image Update" />
-
- <Section style={{ marginTop: '24px' }}>
- <Text style={mainTextStyle}>
- {hasUpdate
- ? `A new update has been detected for your container image.`
- : `Your container image has been checked for updates.`}
- </Text>
- </Section>
-
- <Section style={infoSectionStyle}>
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Environment:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{environment}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Image:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{imageRef}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Status:</Text>
- </Column>
- <Column>
- <Text style={hasUpdate ? statusUpdateStyle : statusNoUpdateStyle}>
- {hasUpdate ? '✓ Update Available' : 'Up to Date'}
- </Text>
- </Column>
- </Row>
-
- {updateType && (
- <>
- <Hr style={dividerStyle} />
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Update Type:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{updateType}</Text>
- </Column>
- </Row>
- </>
- )}
-
- {currentDigest && (
- <>
- <Hr style={dividerStyle} />
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Current Digest:</Text>
- </Column>
- <Column>
- <Text style={digestStyle}>{truncateDigest(currentDigest)}</Text>
- </Column>
- </Row>
- </>
- )}
-
- {latestDigest && (
- <>
- <Hr style={dividerStyle} />
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Latest Digest:</Text>
- </Column>
- <Column>
- <Text style={digestStyle}>{truncateDigest(latestDigest)}</Text>
- </Column>
- </Row>
- </>
- )}
-
- {checkTime && (
- <>
- <Hr style={dividerStyle} />
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Checked At:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{checkTime}</Text>
- </Column>
- </Row>
- </>
- )}
- </Section>
-
- <Section style={{ marginTop: '24px' }}>
- <Text style={footerStyle}>
- This is an automated notification from Arcane.
- {hasUpdate && ' Please review and update your container when ready.'}
- </Text>
- </Section>
- </BaseTemplate>
- );
+ const truncateDigest = (digest: string) => {
+ if (digest.length > 19) {
+ return digest.substring(0, 19) + '...';
+ }
+ return digest;
+ };
+
+ return (
+ <BaseTemplate logoURL={logoURL} appURL={appURL}>
+ <CardHeader title="Container Image Update" />
+
+ <Section style={{ marginTop: '24px' }}>
+ <Text style={mainTextStyle}>
+ {hasUpdate
+ ? `A new update has been detected for your container image.`
+ : `Your container image has been checked for updates.`}
+ </Text>
+ </Section>
+
+ <Section style={infoSectionStyle}>
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Environment:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{environment}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Image:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{imageRef}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Status:</Text>
+ </Column>
+ <Column>
+ <Text style={hasUpdate ? statusUpdateStyle : statusNoUpdateStyle}>
+ {hasUpdate ? '✓ Update Available' : 'Up to Date'}
+ </Text>
+ </Column>
+ </Row>
+
+ {updateType && (
+ <>
+ <Hr style={dividerStyle} />
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Update Type:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{updateType}</Text>
+ </Column>
+ </Row>
+ </>
+ )}
+
+ {currentDigest && (
+ <>
+ <Hr style={dividerStyle} />
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Current Digest:</Text>
+ </Column>
+ <Column>
+ <Text style={digestStyle}>{truncateDigest(currentDigest)}</Text>
+ </Column>
+ </Row>
+ </>
+ )}
+
+ {latestDigest && (
+ <>
+ <Hr style={dividerStyle} />
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Latest Digest:</Text>
+ </Column>
+ <Column>
+ <Text style={digestStyle}>{truncateDigest(latestDigest)}</Text>
+ </Column>
+ </Row>
+ </>
+ )}
+
+ {checkTime && (
+ <>
+ <Hr style={dividerStyle} />
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Checked At:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{checkTime}</Text>
+ </Column>
+ </Row>
+ </>
+ )}
+ </Section>
+
+ <Section style={{ marginTop: '24px' }}>
+ <Text style={footerStyle}>
+ This is an automated notification from Arcane.
+ {hasUpdate && ' Please review and update your container when ready.'}
+ </Text>
+ </Section>
+ </BaseTemplate>
+ );
};
export default ImageUpdateEmail;
const mainTextStyle = {
- fontSize: '16px',
- lineHeight: '24px',
- color: '#cbd5e1',
- margin: '0 0 16px 0',
+ fontSize: '16px',
+ lineHeight: '24px',
+ color: '#cbd5e1',
+ margin: '0 0 16px 0'
};
const infoSectionStyle = {
- marginTop: '20px',
- backgroundColor: 'rgba(15, 23, 42, 0.5)',
- border: '1px solid rgba(148, 163, 184, 0.1)',
- padding: '20px',
- borderRadius: '12px',
+ marginTop: '20px',
+ backgroundColor: 'rgba(15, 23, 42, 0.5)',
+ border: '1px solid rgba(148, 163, 184, 0.1)',
+ padding: '20px',
+ borderRadius: '12px'
};
const infoRowStyle = {
- marginBottom: '0',
+ marginBottom: '0'
};
const labelColumnStyle = {
- width: '140px',
- verticalAlign: 'top' as const,
- paddingRight: '12px',
+ width: '140px',
+ verticalAlign: 'top' as const,
+ paddingRight: '12px'
};
const labelStyle = {
- fontSize: '14px',
- fontWeight: '600' as const,
- color: '#94a3b8',
- margin: '8px 0',
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#94a3b8',
+ margin: '8px 0'
};
const valueStyle = {
- fontSize: '14px',
- color: '#e2e8f0',
- margin: '8px 0',
- wordBreak: 'break-word' as const,
+ fontSize: '14px',
+ color: '#e2e8f0',
+ margin: '8px 0',
+ wordBreak: 'break-word' as const
};
const digestStyle = {
- fontSize: '13px',
- color: '#e2e8f0',
- fontFamily: "'Courier New', Courier, monospace",
- margin: '8px 0',
+ fontSize: '13px',
+ color: '#e2e8f0',
+ fontFamily: "'Courier New', Courier, monospace",
+ margin: '8px 0'
};
const statusUpdateStyle = {
- fontSize: '14px',
- fontWeight: '600' as const,
- color: '#34d399',
- margin: '8px 0',
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#34d399',
+ margin: '8px 0'
};
const statusNoUpdateStyle = {
- fontSize: '14px',
- fontWeight: '600' as const,
- color: '#94a3b8',
- margin: '8px 0',
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#94a3b8',
+ margin: '8px 0'
};
const dividerStyle = {
- borderColor: 'rgba(148, 163, 184, 0.2)',
- margin: '4px 0',
+ borderColor: 'rgba(148, 163, 184, 0.2)',
+ margin: '4px 0'
};
const footerStyle = {
- fontSize: '13px',
- lineHeight: '20px',
- color: '#94a3b8',
- margin: '0',
+ fontSize: '13px',
+ lineHeight: '20px',
+ color: '#94a3b8',
+ margin: '0'
};
ImageUpdateEmail.TemplateProps = {
- ...sharedTemplateProps,
- imageRef: '{{.ImageRef}}',
- hasUpdate: '{{.HasUpdate}}',
- updateType: '{{.UpdateType}}',
- currentDigest: '{{.CurrentDigest}}',
- latestDigest: '{{.LatestDigest}}',
- checkTime: '{{.CheckTime}}',
+ ...sharedTemplateProps,
+ imageRef: '{{.ImageRef}}',
+ hasUpdate: '{{.HasUpdate}}',
+ updateType: '{{.UpdateType}}',
+ currentDigest: '{{.CurrentDigest}}',
+ latestDigest: '{{.LatestDigest}}',
+ checkTime: '{{.CheckTime}}'
};
ImageUpdateEmail.PreviewProps = {
- ...sharedPreviewProps,
- imageRef: 'nginx:latest',
- hasUpdate: true,
- updateType: 'digest',
- currentDigest: 'sha256:abc123def456789012345678901234567890',
- latestDigest: 'sha256:xyz789ghi012345678901234567890123456',
- checkTime: '2025-10-18 15:30:00 UTC',
+ ...sharedPreviewProps,
+ imageRef: 'nginx:latest',
+ hasUpdate: true,
+ updateType: 'digest',
+ currentDigest: 'sha256:abc123def456789012345678901234567890',
+ latestDigest: 'sha256:xyz789ghi012345678901234567890123456',
+ checkTime: '2025-10-18 15:30:00 UTC'
};
diff --git a/email-templates/emails/prune-report.tsx b/email-templates/emails/prune-report.tsx
index 62c084a2b..a221febe4 100644
--- a/email-templates/emails/prune-report.tsx
+++ b/email-templates/emails/prune-report.tsx
@@ -4,188 +4,188 @@ import CardHeader from '../components/card-header';
import { sharedPreviewProps, sharedTemplateProps } from '../props';
interface PruneReportEmailProps {
- logoURL: string;
- appURL: string;
- environment: string;
- totalSpaceReclaimed: string;
- containerSpaceReclaimed: string;
- imageSpaceReclaimed: string;
- volumeSpaceReclaimed: string;
- buildCacheSpaceReclaimed: string;
- time: string;
+ logoURL: string;
+ appURL: string;
+ environment: string;
+ totalSpaceReclaimed: string;
+ containerSpaceReclaimed: string;
+ imageSpaceReclaimed: string;
+ volumeSpaceReclaimed: string;
+ buildCacheSpaceReclaimed: string;
+ time: string;
}
export const PruneReportEmail = ({
- logoURL,
- appURL,
- environment,
- totalSpaceReclaimed,
- containerSpaceReclaimed,
- imageSpaceReclaimed,
- volumeSpaceReclaimed,
- buildCacheSpaceReclaimed,
- time,
+ logoURL,
+ appURL,
+ environment,
+ totalSpaceReclaimed,
+ containerSpaceReclaimed,
+ imageSpaceReclaimed,
+ volumeSpaceReclaimed,
+ buildCacheSpaceReclaimed,
+ time
}: PruneReportEmailProps) => {
- return (
- <BaseTemplate logoURL={logoURL} appURL={appURL}>
- <CardHeader title="System Prune Report" />
-
- <Section style={totalSectionStyle}>
- <Text style={totalLabelStyle}>Total Reclaimed</Text>
- <Text style={totalValueStyle}>{totalSpaceReclaimed}</Text>
- </Section>
-
- <Section style={breakdownSectionStyle}>
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Environment:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{environment}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Containers:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{containerSpaceReclaimed}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Images:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{imageSpaceReclaimed}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Volumes:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{volumeSpaceReclaimed}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Build Cache:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{buildCacheSpaceReclaimed}</Text>
- </Column>
- </Row>
- </Section>
-
- <Section style={{ marginTop: '20px' }}>
- <Text style={footerStyle}>Generated by Arcane at {time}</Text>
- </Section>
- </BaseTemplate>
- );
+ return (
+ <BaseTemplate logoURL={logoURL} appURL={appURL}>
+ <CardHeader title="System Prune Report" />
+
+ <Section style={totalSectionStyle}>
+ <Text style={totalLabelStyle}>Total Reclaimed</Text>
+ <Text style={totalValueStyle}>{totalSpaceReclaimed}</Text>
+ </Section>
+
+ <Section style={breakdownSectionStyle}>
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Environment:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{environment}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Containers:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{containerSpaceReclaimed}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Images:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{imageSpaceReclaimed}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Volumes:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{volumeSpaceReclaimed}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Build Cache:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{buildCacheSpaceReclaimed}</Text>
+ </Column>
+ </Row>
+ </Section>
+
+ <Section style={{ marginTop: '20px' }}>
+ <Text style={footerStyle}>Generated by Arcane at {time}</Text>
+ </Section>
+ </BaseTemplate>
+ );
};
export default PruneReportEmail;
const totalSectionStyle = {
- marginTop: '20px',
- textAlign: 'center' as const,
- backgroundColor: 'rgba(15, 23, 42, 0.5)',
- border: '1px solid rgba(148, 163, 184, 0.1)',
- padding: '20px',
- borderRadius: '12px',
+ marginTop: '20px',
+ textAlign: 'center' as const,
+ backgroundColor: 'rgba(15, 23, 42, 0.5)',
+ border: '1px solid rgba(148, 163, 184, 0.1)',
+ padding: '20px',
+ borderRadius: '12px'
};
const totalLabelStyle = {
- fontSize: '12px',
- lineHeight: '18px',
- letterSpacing: '0.08em',
- textTransform: 'uppercase' as const,
- color: '#94a3b8',
- margin: '0',
+ fontSize: '12px',
+ lineHeight: '18px',
+ letterSpacing: '0.08em',
+ textTransform: 'uppercase' as const,
+ color: '#94a3b8',
+ margin: '0'
};
const totalValueStyle = {
- fontSize: '30px',
- lineHeight: '36px',
- fontWeight: '700' as const,
- color: '#34d399',
- margin: '8px 0 0 0',
+ fontSize: '30px',
+ lineHeight: '36px',
+ fontWeight: '700' as const,
+ color: '#34d399',
+ margin: '8px 0 0 0'
};
const breakdownSectionStyle = {
- marginTop: '18px',
- backgroundColor: 'rgba(15, 23, 42, 0.5)',
- border: '1px solid rgba(148, 163, 184, 0.1)',
- padding: '20px',
- borderRadius: '12px',
+ marginTop: '18px',
+ backgroundColor: 'rgba(15, 23, 42, 0.5)',
+ border: '1px solid rgba(148, 163, 184, 0.1)',
+ padding: '20px',
+ borderRadius: '12px'
};
const infoRowStyle = {
- marginBottom: '0',
+ marginBottom: '0'
};
const labelColumnStyle = {
- width: '180px',
- verticalAlign: 'top' as const,
- paddingRight: '12px',
+ width: '180px',
+ verticalAlign: 'top' as const,
+ paddingRight: '12px'
};
const labelStyle = {
- fontSize: '14px',
- fontWeight: '600' as const,
- color: '#94a3b8',
- margin: '8px 0',
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#94a3b8',
+ margin: '8px 0'
};
const valueStyle = {
- fontSize: '14px',
- color: '#e2e8f0',
- margin: '8px 0',
- wordBreak: 'break-word' as const,
- fontFamily: 'monospace',
+ fontSize: '14px',
+ color: '#e2e8f0',
+ margin: '8px 0',
+ wordBreak: 'break-word' as const,
+ fontFamily: 'monospace'
};
const dividerStyle = {
- borderColor: 'rgba(148, 163, 184, 0.2)',
- margin: '4px 0',
+ borderColor: 'rgba(148, 163, 184, 0.2)',
+ margin: '4px 0'
};
const footerStyle = {
- fontSize: '12px',
- lineHeight: '18px',
- color: '#94a3b8',
- margin: '0',
+ fontSize: '12px',
+ lineHeight: '18px',
+ color: '#94a3b8',
+ margin: '0'
};
PruneReportEmail.TemplateProps = {
- ...sharedTemplateProps,
- totalSpaceReclaimed: '{{.TotalSpaceReclaimed}}',
- containerSpaceReclaimed: '{{.ContainerSpaceReclaimed}}',
- imageSpaceReclaimed: '{{.ImageSpaceReclaimed}}',
- volumeSpaceReclaimed: '{{.VolumeSpaceReclaimed}}',
- buildCacheSpaceReclaimed: '{{.BuildCacheSpaceReclaimed}}',
- time: '{{.Time}}',
+ ...sharedTemplateProps,
+ totalSpaceReclaimed: '{{.TotalSpaceReclaimed}}',
+ containerSpaceReclaimed: '{{.ContainerSpaceReclaimed}}',
+ imageSpaceReclaimed: '{{.ImageSpaceReclaimed}}',
+ volumeSpaceReclaimed: '{{.VolumeSpaceReclaimed}}',
+ buildCacheSpaceReclaimed: '{{.BuildCacheSpaceReclaimed}}',
+ time: '{{.Time}}'
};
PruneReportEmail.PreviewProps = {
- ...sharedPreviewProps,
- totalSpaceReclaimed: '3.4 GB',
- containerSpaceReclaimed: '480 MB',
- imageSpaceReclaimed: '2.1 GB',
- volumeSpaceReclaimed: '612 MB',
- buildCacheSpaceReclaimed: '228 MB',
- time: 'Tue, 10 Feb 2026 19:30:00 UTC',
+ ...sharedPreviewProps,
+ totalSpaceReclaimed: '3.4 GB',
+ containerSpaceReclaimed: '480 MB',
+ imageSpaceReclaimed: '2.1 GB',
+ volumeSpaceReclaimed: '612 MB',
+ buildCacheSpaceReclaimed: '228 MB',
+ time: 'Tue, 10 Feb 2026 19:30:00 UTC'
};
diff --git a/email-templates/emails/test.tsx b/email-templates/emails/test.tsx
index ef7efd732..9fe98ea65 100644
--- a/email-templates/emails/test.tsx
+++ b/email-templates/emails/test.tsx
@@ -1,78 +1,78 @@
-import { Column, Row, Section, Text } from "@react-email/components";
-import { BaseTemplate } from "../components/base-template";
-import CardHeader from "../components/card-header";
-import { sharedPreviewProps, sharedTemplateProps } from "../props";
+import { Column, Row, Section, Text } from '@react-email/components';
+import { BaseTemplate } from '../components/base-template';
+import CardHeader from '../components/card-header';
+import { sharedPreviewProps, sharedTemplateProps } from '../props';
interface TestEmailProps {
- logoURL: string;
- appURL: string;
- environment: string;
+ logoURL: string;
+ appURL: string;
+ environment: string;
}
export const TestEmail = ({ logoURL, appURL, environment }: TestEmailProps) => (
- <BaseTemplate logoURL={logoURL} appURL={appURL}>
- <CardHeader title="Test Email" />
- <Text style={textStyle}>Your email setup is working correctly!</Text>
+ <BaseTemplate logoURL={logoURL} appURL={appURL}>
+ <CardHeader title="Test Email" />
+ <Text style={textStyle}>Your email setup is working correctly!</Text>
- <Section style={infoSectionStyle}>
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Environment:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{environment}</Text>
- </Column>
- </Row>
- </Section>
- </BaseTemplate>
+ <Section style={infoSectionStyle}>
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Environment:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{environment}</Text>
+ </Column>
+ </Row>
+ </Section>
+ </BaseTemplate>
);
export default TestEmail;
const textStyle = {
- fontSize: "16px",
- lineHeight: "24px",
- color: "#cbd5e1",
- marginTop: "16px",
- marginBottom: "0",
+ fontSize: '16px',
+ lineHeight: '24px',
+ color: '#cbd5e1',
+ marginTop: '16px',
+ marginBottom: '0'
};
const infoSectionStyle = {
- marginTop: "20px",
- backgroundColor: "rgba(15, 23, 42, 0.5)",
- border: "1px solid rgba(148, 163, 184, 0.1)",
- padding: "20px",
- borderRadius: "12px",
+ marginTop: '20px',
+ backgroundColor: 'rgba(15, 23, 42, 0.5)',
+ border: '1px solid rgba(148, 163, 184, 0.1)',
+ padding: '20px',
+ borderRadius: '12px'
};
const infoRowStyle = {
- marginBottom: "0",
+ marginBottom: '0'
};
const labelColumnStyle = {
- width: "140px",
- verticalAlign: "top" as const,
- paddingRight: "12px",
+ width: '140px',
+ verticalAlign: 'top' as const,
+ paddingRight: '12px'
};
const labelStyle = {
- fontSize: "14px",
- fontWeight: "600" as const,
- color: "#94a3b8",
- margin: "8px 0",
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#94a3b8',
+ margin: '8px 0'
};
const valueStyle = {
- fontSize: "14px",
- color: "#e2e8f0",
- margin: "8px 0",
- wordBreak: "break-word" as const,
+ fontSize: '14px',
+ color: '#e2e8f0',
+ margin: '8px 0',
+ wordBreak: 'break-word' as const
};
TestEmail.TemplateProps = {
- ...sharedTemplateProps,
+ ...sharedTemplateProps
};
TestEmail.PreviewProps = {
- ...sharedPreviewProps,
+ ...sharedPreviewProps
};
diff --git a/email-templates/emails/vulnerability-summary.tsx b/email-templates/emails/vulnerability-summary.tsx
index afcced62d..d700bc0ca 100644
--- a/email-templates/emails/vulnerability-summary.tsx
+++ b/email-templates/emails/vulnerability-summary.tsx
@@ -4,171 +4,173 @@ import CardHeader from '../components/card-header';
import { sharedPreviewProps, sharedTemplateProps } from '../props';
interface VulnerabilitySummaryEmailProps {
- logoURL: string;
- appURL: string;
- environment: string;
- summaryLabel: string;
- overview: string;
- fixableCount: string;
- severityBreakdown: string;
- sampleCVEs?: string;
+ logoURL: string;
+ appURL: string;
+ environment: string;
+ summaryLabel: string;
+ overview: string;
+ fixableCount: string;
+ severityBreakdown: string;
+ sampleCVEs?: string;
}
export const VulnerabilitySummaryEmail = ({
- logoURL,
- appURL,
- environment,
- summaryLabel,
- overview,
- fixableCount,
- severityBreakdown,
- sampleCVEs,
+ logoURL,
+ appURL,
+ environment,
+ summaryLabel,
+ overview,
+ fixableCount,
+ severityBreakdown,
+ sampleCVEs
}: VulnerabilitySummaryEmailProps) => {
- return (
- <BaseTemplate logoURL={logoURL} appURL={appURL}>
- <CardHeader title="Daily Vulnerability Summary" />
-
- <Section style={{ marginTop: '16px' }}>
- <Text style={subTitleStyle}>{summaryLabel}</Text>
- </Section>
-
- <Section style={infoSectionStyle}>
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Environment:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{environment}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Overview:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{overview}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Fixable vulnerabilities:</Text>
- </Column>
- <Column>
- <Text style={fixedVersionStyle}>{fixableCount}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Severity breakdown:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{severityBreakdown}</Text>
- </Column>
- </Row>
-
- <Hr style={dividerStyle} />
-
- <Row style={infoRowStyle}>
- <Column style={labelColumnStyle}>
- <Text style={labelStyle}>Sample CVEs:</Text>
- </Column>
- <Column>
- <Text style={valueStyle}>{sampleCVEs}</Text>
- </Column>
- </Row>
- </Section>
-
- <Section style={{ marginTop: '24px' }}>
- <Text style={footerStyle}>Open Arcane to review full vulnerability details and remediation actions.</Text>
- </Section>
- </BaseTemplate>
- );
+ return (
+ <BaseTemplate logoURL={logoURL} appURL={appURL}>
+ <CardHeader title="Daily Vulnerability Summary" />
+
+ <Section style={{ marginTop: '16px' }}>
+ <Text style={subTitleStyle}>{summaryLabel}</Text>
+ </Section>
+
+ <Section style={infoSectionStyle}>
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Environment:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{environment}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Overview:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{overview}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Fixable vulnerabilities:</Text>
+ </Column>
+ <Column>
+ <Text style={fixedVersionStyle}>{fixableCount}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Severity breakdown:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{severityBreakdown}</Text>
+ </Column>
+ </Row>
+
+ <Hr style={dividerStyle} />
+
+ <Row style={infoRowStyle}>
+ <Column style={labelColumnStyle}>
+ <Text style={labelStyle}>Sample CVEs:</Text>
+ </Column>
+ <Column>
+ <Text style={valueStyle}>{sampleCVEs}</Text>
+ </Column>
+ </Row>
+ </Section>
+
+ <Section style={{ marginTop: '24px' }}>
+ <Text style={footerStyle}>
+ Open Arcane to review full vulnerability details and remediation actions.
+ </Text>
+ </Section>
+ </BaseTemplate>
+ );
};
export default VulnerabilitySummaryEmail;
const subTitleStyle = {
- fontSize: '14px',
- lineHeight: '22px',
- color: '#94a3b8',
- margin: '0',
+ fontSize: '14px',
+ lineHeight: '22px',
+ color: '#94a3b8',
+ margin: '0'
};
const infoSectionStyle = {
- marginTop: '20px',
- backgroundColor: 'rgba(15, 23, 42, 0.5)',
- border: '1px solid rgba(148, 163, 184, 0.1)',
- padding: '20px',
- borderRadius: '12px',
+ marginTop: '20px',
+ backgroundColor: 'rgba(15, 23, 42, 0.5)',
+ border: '1px solid rgba(148, 163, 184, 0.1)',
+ padding: '20px',
+ borderRadius: '12px'
};
const infoRowStyle = {
- marginBottom: '0',
+ marginBottom: '0'
};
const labelColumnStyle = {
- width: '170px',
- verticalAlign: 'top' as const,
- paddingRight: '12px',
+ width: '170px',
+ verticalAlign: 'top' as const,
+ paddingRight: '12px'
};
const labelStyle = {
- fontSize: '14px',
- fontWeight: '600' as const,
- color: '#94a3b8',
- margin: '8px 0',
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#94a3b8',
+ margin: '8px 0'
};
const valueStyle = {
- fontSize: '14px',
- color: '#e2e8f0',
- margin: '8px 0',
- wordBreak: 'break-word' as const,
+ fontSize: '14px',
+ color: '#e2e8f0',
+ margin: '8px 0',
+ wordBreak: 'break-word' as const
};
const fixedVersionStyle = {
- fontSize: '14px',
- fontWeight: '600' as const,
- color: '#34d399',
- margin: '8px 0',
- wordBreak: 'break-word' as const,
+ fontSize: '14px',
+ fontWeight: '600' as const,
+ color: '#34d399',
+ margin: '8px 0',
+ wordBreak: 'break-word' as const
};
const dividerStyle = {
- borderColor: 'rgba(148, 163, 184, 0.2)',
- margin: '4px 0',
+ borderColor: 'rgba(148, 163, 184, 0.2)',
+ margin: '4px 0'
};
const footerStyle = {
- fontSize: '13px',
- lineHeight: '20px',
- color: '#94a3b8',
- margin: '0',
+ fontSize: '13px',
+ lineHeight: '20px',
+ color: '#94a3b8',
+ margin: '0'
};
VulnerabilitySummaryEmail.TemplateProps = {
- ...sharedTemplateProps,
- summaryLabel: '{{.SummaryLabel}}',
- overview: '{{.Overview}}',
- fixableCount: '{{.FixableCount}}',
- severityBreakdown: '{{.SeverityBreakdown}}',
- sampleCVEs: '{{.SampleCVEs}}',
+ ...sharedTemplateProps,
+ summaryLabel: '{{.SummaryLabel}}',
+ overview: '{{.Overview}}',
+ fixableCount: '{{.FixableCount}}',
+ severityBreakdown: '{{.SeverityBreakdown}}',
+ sampleCVEs: '{{.SampleCVEs}}'
};
VulnerabilitySummaryEmail.PreviewProps = {
- ...sharedPreviewProps,
- summaryLabel: 'Daily Summary - 2026-02-10',
- overview: '12 image(s) scanned, 4 with fixable vulnerabilities',
- fixableCount: '19 fixable vulnerability record(s)',
- severityBreakdown: 'Critical:2 High:9 Medium:6 Low:2 Unknown:0',
- sampleCVEs: 'CVE-2025-1234, CVE-2025-5678, CVE-2026-0001',
+ ...sharedPreviewProps,
+ summaryLabel: 'Daily Summary - 2026-02-10',
+ overview: '12 image(s) scanned, 4 with fixable vulnerabilities',
+ fixableCount: '19 fixable vulnerability record(s)',
+ severityBreakdown: 'Critical:2 High:9 Medium:6 Low:2 Unknown:0',
+ sampleCVEs: 'CVE-2025-1234, CVE-2025-5678, CVE-2026-0001'
};
diff --git a/email-templates/package.json b/email-templates/package.json
index c9c3aeec7..2d379f3b1 100644
--- a/email-templates/package.json
+++ b/email-templates/package.json
@@ -19,6 +19,7 @@
"@types/node": "^25.5.0",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
+ "oxfmt": "^0.40.0",
"react-email": "5.2.9",
"tsx": "^4.21.0"
}
diff --git a/email-templates/props.ts b/email-templates/props.ts
index e1a51fe6b..f63f4558b 100644
--- a/email-templates/props.ts
+++ b/email-templates/props.ts
@@ -1,11 +1,12 @@
export const sharedPreviewProps = {
- logoURL: 'https://raw.githubusercontent.com/ofkm/arcane/main/backend/resources/images/logo-full.svg',
- appURL: 'http://localhost:3552',
- environment: 'Homelab Production',
+ logoURL:
+ 'https://raw.githubusercontent.com/ofkm/arcane/main/backend/resources/images/logo-full.svg',
+ appURL: 'http://localhost:3552',
+ environment: 'Homelab Production'
};
export const sharedTemplateProps = {
- logoURL: '{{.LogoURL}}',
- appURL: '{{.AppURL}}',
- environment: '{{.Environment}}',
+ logoURL: '{{.LogoURL}}',
+ appURL: '{{.AppURL}}',
+ environment: '{{.Environment}}'
};
diff --git a/package.json b/package.json
index 8130e60ad..befdc14e7 100644
--- a/package.json
+++ b/package.json
@@ -15,8 +15,14 @@
"prepare": "husky"
},
"lint-staged": {
- "*": [
- "sh -c 'just format all --check'"
+ "frontend/**/*": [
+ "sh -c 'just format frontend --check'"
+ ],
+ "{tests,email-templates}/**/*.{ts,tsx,js,jsx,mts,cts}": [
+ "sh -c 'just format js --check'"
+ ],
+ "{backend,cli,types}/**/*": [
+ "sh -c 'just format go --check'"
]
},
"devDependencies": {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 255b76ca1..e29327aeb 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -53,6 +53,9 @@ importers:
'@types/react-dom':
specifier: ^19.2.3
version: 19.2.3(@types/[email protected])
+ oxfmt:
+ specifier: ^0.40.0
+ version: 0.40.0
react-email:
specifier: 5.2.9
version: 5.2.9
@@ -255,6 +258,9 @@ importers:
'@types/node':
specifier: ^25.5.0
version: 25.5.0
+ oxfmt:
+ specifier: ^0.40.0
+ version: 0.40.0
packages:
@@ -1604,6 +1610,128 @@ packages:
cpu: [x64]
os: [win32]
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-S6zd5r1w/HmqR8t0CTnGjFTBLDq2QKORPwriCHxo4xFNuhmOTABGjPaNvCJJVnrKBLsohOeiDX3YqQfJPF+FXw==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm]
+ os: [android]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-/mbS9UUP/5Vbl2D6osIdcYiP0oie63LKMoTyGj5hyMCK/SFkl3EhtyRAfdjPvuvHC0SXdW6ePaTKkBSq1SNcIw==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [android]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-wRt8fRdfLiEhnRMBonlIbKrJWixoEmn6KCjKE9PElnrSDSXETGZfPb8ee+nQNTobXkCVvVLytp2o0obAsxl78Q==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [darwin]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-fzowhqbOE/NRy+AE5ob0+Y4X243WbWzDb00W+pKwD7d9tOqsAFbtWUwIyqqCoCLxj791m2xXIEeLH/3uz7zCCg==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [darwin]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-agZ9ITaqdBjcerRRFEHB8s0OyVcQW8F9ZxsszjxzeSthQ4fcN2MuOtQFWec1ed8/lDa50jSLHVE2/xPmTgtCfQ==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [freebsd]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-ZM2oQ47p28TP1DVIp7HL1QoMUgqlBFHey0ksHct7tMXoU5BqjNvPWw7888azzMt25lnyPODVuye1wvNbvVUFOA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm]
+ os: [linux]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-RBFPAxRAIsMisKM47Oe6Lwdv6agZYLz02CUhVCD1sOv5ajAcRMrnwCFBPWwGXpazToW2mjnZxFos8TuFjTU15A==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm]
+ os: [linux]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-Nb2XbQ+wV3W2jSIihXdPj7k83eOxeSgYP3N/SRXvQ6ZYPIk6Q86qEh5Gl/7OitX3bQoQrESqm1yMLvZV8/J7dA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-tGmWhLD/0YMotCdfezlT6tC/MJG/wKpo4vnQ3Cq+4eBk/BwNv7EmkD0VkD5F/dYkT3b8FNU01X2e8vvJuWoM1w==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-rVbFyM3e7YhkVnp0IVYjaSHfrBWcTRWb60LEcdNAJcE2mbhTpbqKufx0FrhWfoxOrW/+7UJonAOShoFFLigDqQ==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [ppc64]
+ os: [linux]
+ libc: [glibc]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-3ZqBw14JtWeEoLiioJcXSJz8RQyPE+3jLARnYM1HdPzZG4vk+Ua8CUupt2+d+vSAvMyaQBTN2dZK+kbBS/j5mA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [riscv64]
+ os: [linux]
+ libc: [glibc]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-JJ4PPSdcbGBjPvb+O7xYm2FmAsKCyuEMYhqatBAHMp/6TA6rVlf9Z/sYPa4/3Bommb+8nndm15SPFRHEPU5qFA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [riscv64]
+ os: [linux]
+ libc: [musl]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-Kp0zNJoX9Ik77wUya2tpBY3W9f40VUoMQLWVaob5SgCrblH/t2xr/9B2bWHfs0WCefuGmqXcB+t0Lq77sbBmZw==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [s390x]
+ os: [linux]
+ libc: [glibc]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-7YTCNzleWTaQTqNGUNQ66qVjpoV6DjbCOea+RnpMBly2bpzrI/uu7Rr+2zcgRfNxyjXaFTVQKaRKjqVdeUfeVA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-hWnSzJ0oegeOwfOEeejYXfBqmnRGHusgtHfCPzmvJvHTwy1s3Neo59UKc1CmpE3zxvrCzJoVHos0rr97GHMNPw==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-28sJC1lR4qtBJGzSRRbPnSW3GxU2+4YyQFE6rCmsUYqZ5XYH8jg0/w+CvEzQ8TuAQz5zLkcA25nFQGwoU0PT3Q==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [openharmony]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-cDkRnyT0dqwF5oIX1Cv59HKCeZQFbWWdUpXa3uvnHFT2iwYSSZspkhgjXjU6iDp5pFPaAEAe9FIbMoTgkTmKPg==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [arm64]
+ os: [win32]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-7rPemBJjqm5Gkv6ZRCPvK8lE6AqQ/2z31DRdWazyx2ZvaSgL7QGofHXHNouRpPvNsT9yxRNQJgigsWkc+0qg4w==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [ia32]
+ os: [win32]
+
+ '@oxfmt/[email protected]':
+ resolution: {integrity: sha512-/Zmj0yTYSvmha6TG1QnoLqVT7ZMRDqXvFXXBQpIjteEwx9qvUYMBH2xbiOFhDeMUJkGwC3D6fdKsFtaqUvkwNA==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ cpu: [x64]
+ os: [win32]
+
'@playwright/[email protected]':
resolution: {integrity: sha512-akea+6bHYBBfA9uQqSYmlJXn61cTa+jbO87xVLCWbTqbWadRVmhxlXATaOjOgcBaWU4ePo0wB41KMFv3o35IXA==}
engines: {node: '>=18'}
@@ -3337,6 +3465,11 @@ packages:
resolution: {integrity: sha512-qE/CIg/spwrTBFt5aKmwe3ifeDdLfA2NESN30E42X/lII5ClF8V7Wt6WIJhcGZjp0/Q+nQ+9vgxGk//xZNX2hg==}
+ resolution: {integrity: sha512-g0C3I7xUj4b4DcagevM9kgH6+pUHytikxUcn3/VUkvzTNaaXBeyZqb7IBsHwojeXm4mTBEC/aBjBTMVUkZwWUQ==}
+ engines: {node: ^20.19.0 || >=22.12.0}
+ hasBin: true
+
resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==}
engines: {node: '>=10'}
@@ -3868,6 +4001,10 @@ packages:
resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==}
engines: {node: '>=12.0.0'}
+ resolution: {integrity: sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==}
+ engines: {node: ^20.0.0 || >=22.0.0}
+
resolution: {integrity: sha512-ZjCZK0rppSBu7rjHYDYsEaMOIbbT+nWF57hKkv4IUmZWBNrBWBOjIElc0mKRgLM8bm7x/BBlof6t2gi/Oq/Asw==}
@@ -5112,6 +5249,63 @@ snapshots:
'@oxc-resolver/[email protected]':
optional: true
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
+ '@oxfmt/[email protected]':
+ optional: true
+
'@playwright/[email protected]':
dependencies:
playwright: 1.58.2
@@ -6863,6 +7057,30 @@ snapshots:
'@oxc-resolver/binding-win32-ia32-msvc': 11.19.1
'@oxc-resolver/binding-win32-x64-msvc': 11.19.1
+ dependencies:
+ tinypool: 2.1.0
+ optionalDependencies:
+ '@oxfmt/binding-android-arm-eabi': 0.40.0
+ '@oxfmt/binding-android-arm64': 0.40.0
+ '@oxfmt/binding-darwin-arm64': 0.40.0
+ '@oxfmt/binding-darwin-x64': 0.40.0
+ '@oxfmt/binding-freebsd-x64': 0.40.0
+ '@oxfmt/binding-linux-arm-gnueabihf': 0.40.0
+ '@oxfmt/binding-linux-arm-musleabihf': 0.40.0
+ '@oxfmt/binding-linux-arm64-gnu': 0.40.0
+ '@oxfmt/binding-linux-arm64-musl': 0.40.0
+ '@oxfmt/binding-linux-ppc64-gnu': 0.40.0
+ '@oxfmt/binding-linux-riscv64-gnu': 0.40.0
+ '@oxfmt/binding-linux-riscv64-musl': 0.40.0
+ '@oxfmt/binding-linux-s390x-gnu': 0.40.0
+ '@oxfmt/binding-linux-x64-gnu': 0.40.0
+ '@oxfmt/binding-linux-x64-musl': 0.40.0
+ '@oxfmt/binding-openharmony-arm64': 0.40.0
+ '@oxfmt/binding-win32-arm64-msvc': 0.40.0
+ '@oxfmt/binding-win32-ia32-msvc': 0.40.0
+ '@oxfmt/binding-win32-x64-msvc': 0.40.0
+
dependencies:
yocto-queue: 0.1.0
@@ -7426,6 +7644,8 @@ snapshots:
fdir: 6.5.0([email protected])
picomatch: 4.0.3
+
diff --git a/tests/.oxfmtrc.json b/tests/.oxfmtrc.json
new file mode 100644
index 000000000..9501a0894
--- /dev/null
+++ b/tests/.oxfmtrc.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "./node_modules/oxfmt/configuration_schema.json",
+ "useTabs": true,
+ "singleQuote": true,
+ "trailingComma": "none",
+ "printWidth": 100,
+ "sortPackageJson": true
+}
diff --git a/tests/package.json b/tests/package.json
index 86411d2b2..9d5e4be9e 100644
--- a/tests/package.json
+++ b/tests/package.json
@@ -7,6 +7,7 @@
},
"devDependencies": {
"@playwright/test": "^1.58.2",
- "@types/node": "^25.5.0"
+ "@types/node": "^25.5.0",
+ "oxfmt": "^0.40.0"
}
}
diff --git a/tests/playwright.config.ts b/tests/playwright.config.ts
index e8a03eeab..5fac5d790 100644
--- a/tests/playwright.config.ts
+++ b/tests/playwright.config.ts
@@ -3,38 +3,37 @@ import { defineConfig, devices } from '@playwright/test';
const baseURL = process.env.BASE_URL || 'http://localhost:3000';
export default defineConfig({
- testDir: '.',
- fullyParallel: true,
- forbidOnly: !!process.env.CI,
- retries: process.env.CI ? 2 : 0,
- workers: 1,
- globalSetup: './setup/global-setup',
- globalTeardown: './setup/global-teardown',
- reporter:
- process.env.CI ?
- [['html', { outputFolder: '.report' }], ['github']]
- : [['line'], ['html', { open: 'never', outputFolder: '.report' }]],
- use: {
- baseURL,
- trace: 'on-first-retry',
- video: 'retain-on-failure',
- },
- projects: [
- {
- name: 'auth-setup',
- testMatch: /setup\/auth\.setup\.ts/,
- },
- {
- name: 'gitops-setup',
- testMatch: /setup\/gitops\.setup\.ts/,
- use: { storageState: '.auth/login.json' },
- dependencies: ['auth-setup'],
- },
- {
- name: 'chromium',
- use: { ...devices['Desktop Chrome'], storageState: '.auth/login.json' },
- dependencies: ['auth-setup', 'gitops-setup'],
- testMatch: /spec\/.*\.spec\.ts/,
- },
- ],
+ testDir: '.',
+ fullyParallel: true,
+ forbidOnly: !!process.env.CI,
+ retries: process.env.CI ? 2 : 0,
+ workers: 1,
+ globalSetup: './setup/global-setup',
+ globalTeardown: './setup/global-teardown',
+ reporter: process.env.CI
+ ? [['html', { outputFolder: '.report' }], ['github']]
+ : [['line'], ['html', { open: 'never', outputFolder: '.report' }]],
+ use: {
+ baseURL,
+ trace: 'on-first-retry',
+ video: 'retain-on-failure'
+ },
+ projects: [
+ {
+ name: 'auth-setup',
+ testMatch: /setup\/auth\.setup\.ts/
+ },
+ {
+ name: 'gitops-setup',
+ testMatch: /setup\/gitops\.setup\.ts/,
+ use: { storageState: '.auth/login.json' },
+ dependencies: ['auth-setup']
+ },
+ {
+ name: 'chromium',
+ use: { ...devices['Desktop Chrome'], storageState: '.auth/login.json' },
+ dependencies: ['auth-setup', 'gitops-setup'],
+ testMatch: /spec\/.*\.spec\.ts/
+ }
+ ]
});
diff --git a/tests/setup/auth.setup.ts b/tests/setup/auth.setup.ts
index cc0ee71e0..0e9b40737 100644
--- a/tests/setup/auth.setup.ts
+++ b/tests/setup/auth.setup.ts
@@ -4,11 +4,11 @@ import authUtil from '../utils/auth.util';
const authFile = '.auth/login.json';
setup('authenticate', async ({ page }) => {
- await authUtil.login(page);
+ await authUtil.login(page);
- await page.waitForURL('/dashboard');
+ await page.waitForURL('/dashboard');
- await authUtil.changeDefaultPassword(page, 'test-password-123');
+ await authUtil.changeDefaultPassword(page, 'test-password-123');
- await page.context().storageState({ path: authFile });
+ await page.context().storageState({ path: authFile });
});
diff --git a/tests/setup/gitops.setup.ts b/tests/setup/gitops.setup.ts
index 4e9175193..2c1485d04 100644
--- a/tests/setup/gitops.setup.ts
+++ b/tests/setup/gitops.setup.ts
@@ -14,170 +14,172 @@ const GITOPS_COMPOSE_PATH = 'compose-test-repo/compose.yaml';
const GITOPS_SYNC_NAME = 'gitops-test-sync';
setup('create gitops sync in arcane', async ({ page }) => {
- console.log('Creating GitOps sync configuration in Arcane...');
-
- // Step 1: Create a Git Repository in Arcane pointing to GitHub
- await page.goto('/customize/git-repositories');
- await page.waitForLoadState('networkidle');
-
- // Check if test repo already exists
- const existingRepo = page.getByRole('cell', { name: GITOPS_REPO_NAME });
- if ((await existingRepo.count()) === 0) {
- console.log('Creating Git repository in Arcane...');
-
- // Click Add Repository button
- const addRepoButton = page.getByRole('button', { name: /Add.*Repository/i });
- await addRepoButton.click();
-
- // Wait for dialog
- const dialog = page.getByRole('dialog');
- await expect(dialog).toBeVisible();
-
- // Fill repository form - use specific labels to avoid ambiguity
- await dialog.getByRole('textbox', { name: /Repository Name/i }).fill(GITOPS_REPO_NAME);
- await dialog.getByRole('textbox', { name: /Repository URL/i }).fill(GITOPS_REPO_URL);
-
- // Select "None" for auth type (public repo) - click the auth type dropdown
- const authTrigger = dialog.locator('#authType');
- if ((await authTrigger.count()) > 0) {
- await authTrigger.click();
- await page.waitForTimeout(300);
- const noneOption = page.getByRole('option', { name: /None|No Auth/i });
- if ((await noneOption.count()) > 0) {
- await noneOption.click();
- } else {
- await page.keyboard.press('Escape');
- }
- }
-
- // Submit the form
- const submitButton = dialog.getByRole('button', { name: /Add Repository/i });
- await submitButton.click();
-
- // Wait for success or error
- await page.waitForTimeout(2000);
- const successToast = page.getByText(/created|success/i);
- if ((await successToast.count()) > 0) {
- console.log('Git repository created successfully in Arcane');
- } else {
- console.log('Repository may already exist or creation had issues, continuing...');
- }
- } else {
- console.log('Git repository already exists in Arcane');
- }
-
- // Step 2: Create GitOps Sync
- await page.goto('/environments/0/gitops');
- await page.waitForLoadState('networkidle');
-
- // Check if sync already exists
- const existingSync = page.getByRole('cell', { name: GITOPS_SYNC_NAME });
- if ((await existingSync.count()) === 0) {
- console.log('Creating GitOps sync...');
-
- // Click Add Sync button
- const addSyncButton = page.getByRole('button', { name: /Add.*Sync/i });
- await addSyncButton.click();
-
- // Wait for dialog
- const dialog = page.getByRole('dialog');
- await expect(dialog).toBeVisible();
-
- // Wait for dialog content to load
- await page.waitForTimeout(1000);
-
- // Fill sync form - Name field (use specific selector)
- const nameInput = dialog.getByRole('textbox', { name: /Sync Name/i });
- await nameInput.fill(GITOPS_SYNC_NAME);
-
- // Select repository from dropdown
- const repoTrigger = dialog.locator('#repository, [id*="repository"]').first();
- if ((await repoTrigger.count()) > 0) {
- await repoTrigger.click();
- await page.waitForTimeout(300);
- const repoOption = page.getByRole('option', { name: GITOPS_REPO_NAME });
- if ((await repoOption.count()) > 0) {
- await repoOption.click();
- }
- }
-
- // Wait for branches to load
- await page.waitForTimeout(2000);
-
- // Select or enter branch
- const branchTrigger = dialog.locator('#branch, [id*="branch"]').first();
- if ((await branchTrigger.count()) > 0) {
- const isSelect = (await branchTrigger.getAttribute('role')) === 'combobox';
- if (isSelect) {
- await branchTrigger.click();
- await page.waitForTimeout(300);
- const mainOption = page.getByRole('option', { name: new RegExp(GITOPS_REPO_BRANCH, 'i') });
- if ((await mainOption.count()) > 0) {
- await mainOption.click();
- } else {
- await page.keyboard.press('Escape');
- }
- }
- }
-
- // Enter compose path
- const composePathInput = dialog.getByPlaceholder(/docker-compose|compose/i);
- if ((await composePathInput.count()) > 0) {
- await composePathInput.fill(GITOPS_COMPOSE_PATH);
- }
-
- // Disable auto-sync for tests
- const autoSyncSwitch = dialog.getByRole('switch');
- if ((await autoSyncSwitch.count()) > 0) {
- const isChecked = await autoSyncSwitch.getAttribute('data-state');
- if (isChecked === 'checked') {
- await autoSyncSwitch.click();
- }
- }
-
- // Submit the form
- const submitButton = dialog.getByRole('button', { name: /Add.*Sync|Create/i }).filter({ hasNotText: /Cancel/ });
- await submitButton.click();
-
- // Wait for result
- await page.waitForTimeout(3000);
- console.log('GitOps sync configuration created');
- } else {
- console.log('GitOps sync already exists');
- }
-
- // Step 3: Trigger initial sync to create the managed project
- console.log('Triggering initial sync...');
- await page.reload();
- await page.waitForLoadState('networkidle');
-
- // Find the sync row and trigger sync
- const syncRow = page.locator('tr').filter({ hasText: GITOPS_SYNC_NAME });
- if ((await syncRow.count()) > 0) {
- // Look for sync button or menu
- const syncButton = syncRow.getByRole('button', { name: /Sync|Sync Now/i });
- const menuButton = syncRow.getByRole('button', { name: /menu|actions|Open menu/i });
-
- if ((await syncButton.count()) > 0) {
- await syncButton.click();
- } else if ((await menuButton.count()) > 0) {
- await menuButton.click();
- await page.waitForTimeout(300);
- const syncMenuItem = page.getByRole('menuitem', { name: /Sync/i });
- if ((await syncMenuItem.count()) > 0) {
- await syncMenuItem.click();
- }
- }
-
- // Wait for sync to complete
- await page.waitForTimeout(5000);
- console.log('Initial sync triggered');
- }
-
- // Verify project was created
- await page.goto('/projects');
- await page.waitForLoadState('networkidle');
- await page.waitForTimeout(2000);
-
- console.log('GitOps test setup complete!');
+ console.log('Creating GitOps sync configuration in Arcane...');
+
+ // Step 1: Create a Git Repository in Arcane pointing to GitHub
+ await page.goto('/customize/git-repositories');
+ await page.waitForLoadState('networkidle');
+
+ // Check if test repo already exists
+ const existingRepo = page.getByRole('cell', { name: GITOPS_REPO_NAME });
+ if ((await existingRepo.count()) === 0) {
+ console.log('Creating Git repository in Arcane...');
+
+ // Click Add Repository button
+ const addRepoButton = page.getByRole('button', { name: /Add.*Repository/i });
+ await addRepoButton.click();
+
+ // Wait for dialog
+ const dialog = page.getByRole('dialog');
+ await expect(dialog).toBeVisible();
+
+ // Fill repository form - use specific labels to avoid ambiguity
+ await dialog.getByRole('textbox', { name: /Repository Name/i }).fill(GITOPS_REPO_NAME);
+ await dialog.getByRole('textbox', { name: /Repository URL/i }).fill(GITOPS_REPO_URL);
+
+ // Select "None" for auth type (public repo) - click the auth type dropdown
+ const authTrigger = dialog.locator('#authType');
+ if ((await authTrigger.count()) > 0) {
+ await authTrigger.click();
+ await page.waitForTimeout(300);
+ const noneOption = page.getByRole('option', { name: /None|No Auth/i });
+ if ((await noneOption.count()) > 0) {
+ await noneOption.click();
+ } else {
+ await page.keyboard.press('Escape');
+ }
+ }
+
+ // Submit the form
+ const submitButton = dialog.getByRole('button', { name: /Add Repository/i });
+ await submitButton.click();
+
+ // Wait for success or error
+ await page.waitForTimeout(2000);
+ const successToast = page.getByText(/created|success/i);
+ if ((await successToast.count()) > 0) {
+ console.log('Git repository created successfully in Arcane');
+ } else {
+ console.log('Repository may already exist or creation had issues, continuing...');
+ }
+ } else {
+ console.log('Git repository already exists in Arcane');
+ }
+
+ // Step 2: Create GitOps Sync
+ await page.goto('/environments/0/gitops');
+ await page.waitForLoadState('networkidle');
+
+ // Check if sync already exists
+ const existingSync = page.getByRole('cell', { name: GITOPS_SYNC_NAME });
+ if ((await existingSync.count()) === 0) {
+ console.log('Creating GitOps sync...');
+
+ // Click Add Sync button
+ const addSyncButton = page.getByRole('button', { name: /Add.*Sync/i });
+ await addSyncButton.click();
+
+ // Wait for dialog
+ const dialog = page.getByRole('dialog');
+ await expect(dialog).toBeVisible();
+
+ // Wait for dialog content to load
+ await page.waitForTimeout(1000);
+
+ // Fill sync form - Name field (use specific selector)
+ const nameInput = dialog.getByRole('textbox', { name: /Sync Name/i });
+ await nameInput.fill(GITOPS_SYNC_NAME);
+
+ // Select repository from dropdown
+ const repoTrigger = dialog.locator('#repository, [id*="repository"]').first();
+ if ((await repoTrigger.count()) > 0) {
+ await repoTrigger.click();
+ await page.waitForTimeout(300);
+ const repoOption = page.getByRole('option', { name: GITOPS_REPO_NAME });
+ if ((await repoOption.count()) > 0) {
+ await repoOption.click();
+ }
+ }
+
+ // Wait for branches to load
+ await page.waitForTimeout(2000);
+
+ // Select or enter branch
+ const branchTrigger = dialog.locator('#branch, [id*="branch"]').first();
+ if ((await branchTrigger.count()) > 0) {
+ const isSelect = (await branchTrigger.getAttribute('role')) === 'combobox';
+ if (isSelect) {
+ await branchTrigger.click();
+ await page.waitForTimeout(300);
+ const mainOption = page.getByRole('option', { name: new RegExp(GITOPS_REPO_BRANCH, 'i') });
+ if ((await mainOption.count()) > 0) {
+ await mainOption.click();
+ } else {
+ await page.keyboard.press('Escape');
+ }
+ }
+ }
+
+ // Enter compose path
+ const composePathInput = dialog.getByPlaceholder(/docker-compose|compose/i);
+ if ((await composePathInput.count()) > 0) {
+ await composePathInput.fill(GITOPS_COMPOSE_PATH);
+ }
+
+ // Disable auto-sync for tests
+ const autoSyncSwitch = dialog.getByRole('switch');
+ if ((await autoSyncSwitch.count()) > 0) {
+ const isChecked = await autoSyncSwitch.getAttribute('data-state');
+ if (isChecked === 'checked') {
+ await autoSyncSwitch.click();
+ }
+ }
+
+ // Submit the form
+ const submitButton = dialog
+ .getByRole('button', { name: /Add.*Sync|Create/i })
+ .filter({ hasNotText: /Cancel/ });
+ await submitButton.click();
+
+ // Wait for result
+ await page.waitForTimeout(3000);
+ console.log('GitOps sync configuration created');
+ } else {
+ console.log('GitOps sync already exists');
+ }
+
+ // Step 3: Trigger initial sync to create the managed project
+ console.log('Triggering initial sync...');
+ await page.reload();
+ await page.waitForLoadState('networkidle');
+
+ // Find the sync row and trigger sync
+ const syncRow = page.locator('tr').filter({ hasText: GITOPS_SYNC_NAME });
+ if ((await syncRow.count()) > 0) {
+ // Look for sync button or menu
+ const syncButton = syncRow.getByRole('button', { name: /Sync|Sync Now/i });
+ const menuButton = syncRow.getByRole('button', { name: /menu|actions|Open menu/i });
+
+ if ((await syncButton.count()) > 0) {
+ await syncButton.click();
+ } else if ((await menuButton.count()) > 0) {
+ await menuButton.click();
+ await page.waitForTimeout(300);
+ const syncMenuItem = page.getByRole('menuitem', { name: /Sync/i });
+ if ((await syncMenuItem.count()) > 0) {
+ await syncMenuItem.click();
+ }
+ }
+
+ // Wait for sync to complete
+ await page.waitForTimeout(5000);
+ console.log('Initial sync triggered');
+ }
+
+ // Verify project was created
+ await page.goto('/projects');
+ await page.waitForLoadState('networkidle');
+ await page.waitForTimeout(2000);
+
+ console.log('GitOps test setup complete!');
});
diff --git a/tests/setup/global-setup.ts b/tests/setup/global-setup.ts
index 1cafc0fce..6cad033e1 100644
--- a/tests/setup/global-setup.ts
+++ b/tests/setup/global-setup.ts
@@ -7,51 +7,52 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
async function globalSetup() {
- console.log('\nStarting global setup...');
-
- const composeFile =
- process.env.COMPOSE_FILE ? path.resolve(__dirname, '..', process.env.COMPOSE_FILE) : path.resolve(__dirname, 'compose.yaml');
-
- try {
- console.log('Building and starting Docker containers...');
- execSync(`docker compose -f ${composeFile} up -d --build`, { stdio: 'inherit' });
- console.log('Docker containers are up.');
- } catch (error) {
- console.error('Failed to start Docker containers:', error);
- throw error;
- }
-
- // 2. Wait for the server to be ready
- const baseURL = process.env.BASE_URL || 'http://localhost:3000';
- console.log(`Waiting for server at ${baseURL}...`);
-
- const maxAttempts = 60;
- let attempts = 0;
- while (attempts < maxAttempts) {
- try {
- const response = await fetch(baseURL);
- if (response.ok) {
- console.log('Server is ready!');
- break;
- }
- } catch (e) {
- // Ignore connection errors
- }
- attempts++;
- await new Promise((resolve) => setTimeout(resolve, 2000));
- }
-
- if (attempts === maxAttempts) {
- throw new Error(`Server at ${baseURL} did not become ready in time.`);
- }
-
- // 3. Ensure the projects directory exists
- const projectsDir = path.resolve(__dirname, 'projects');
- if (!fs.existsSync(projectsDir)) {
- fs.mkdirSync(projectsDir, { recursive: true });
- }
-
- console.log('Global setup complete.\n');
+ console.log('\nStarting global setup...');
+
+ const composeFile = process.env.COMPOSE_FILE
+ ? path.resolve(__dirname, '..', process.env.COMPOSE_FILE)
+ : path.resolve(__dirname, 'compose.yaml');
+
+ try {
+ console.log('Building and starting Docker containers...');
+ execSync(`docker compose -f ${composeFile} up -d --build`, { stdio: 'inherit' });
+ console.log('Docker containers are up.');
+ } catch (error) {
+ console.error('Failed to start Docker containers:', error);
+ throw error;
+ }
+
+ // 2. Wait for the server to be ready
+ const baseURL = process.env.BASE_URL || 'http://localhost:3000';
+ console.log(`Waiting for server at ${baseURL}...`);
+
+ const maxAttempts = 60;
+ let attempts = 0;
+ while (attempts < maxAttempts) {
+ try {
+ const response = await fetch(baseURL);
+ if (response.ok) {
+ console.log('Server is ready!');
+ break;
+ }
+ } catch (e) {
+ // Ignore connection errors
+ }
+ attempts++;
+ await new Promise((resolve) => setTimeout(resolve, 2000));
+ }
+
+ if (attempts === maxAttempts) {
+ throw new Error(`Server at ${baseURL} did not become ready in time.`);
+ }
+
+ // 3. Ensure the projects directory exists
+ const projectsDir = path.resolve(__dirname, 'projects');
+ if (!fs.existsSync(projectsDir)) {
+ fs.mkdirSync(projectsDir, { recursive: true });
+ }
+
+ console.log('Global setup complete.\n');
}
export default globalSetup;
diff --git a/tests/setup/global-teardown.ts b/tests/setup/global-teardown.ts
index 84c11cb9c..ded867275 100644
--- a/tests/setup/global-teardown.ts
+++ b/tests/setup/global-teardown.ts
@@ -7,47 +7,48 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
async function globalTeardown() {
- console.log('\nStarting global teardown...');
-
- const composeFile =
- process.env.COMPOSE_FILE ? path.resolve(__dirname, '..', process.env.COMPOSE_FILE) : path.resolve(__dirname, 'compose.yaml');
- const projectsDir = path.resolve(__dirname, 'projects');
-
- // 1. Stop and remove Docker containers
- try {
- console.log('Stopping Docker containers...');
- execSync(`docker compose -f ${composeFile} down -v`, { stdio: 'inherit' });
- console.log('Docker containers stopped and volumes removed.');
- } catch (error) {
- console.error('Warning: Failed to stop Docker containers cleanly:', error);
- }
-
- // 2. Clean up test projects created on disk
- try {
- if (fs.existsSync(projectsDir)) {
- console.log('Cleaning up test projects...');
- const items = fs.readdirSync(projectsDir);
-
- for (const item of items) {
- const itemPath = path.join(projectsDir, item);
-
- // Keep .env.global and test-project-static if they exist, remove everything else that looks like a test project
- if (item === '.env.global' || item === 'test-project-static') continue;
-
- if (fs.lstatSync(itemPath).isDirectory()) {
- fs.rmSync(itemPath, { recursive: true, force: true });
- console.log(` - Removed directory: ${item}`);
- } else if (item.startsWith('test-project-')) {
- fs.unlinkSync(itemPath);
- console.log(` - Removed file: ${item}`);
- }
- }
- }
- } catch (error) {
- console.error('Warning: Failed to clean up projects directory:', error);
- }
-
- console.log('Global teardown complete.\n');
+ console.log('\nStarting global teardown...');
+
+ const composeFile = process.env.COMPOSE_FILE
+ ? path.resolve(__dirname, '..', process.env.COMPOSE_FILE)
+ : path.resolve(__dirname, 'compose.yaml');
+ const projectsDir = path.resolve(__dirname, 'projects');
+
+ // 1. Stop and remove Docker containers
+ try {
+ console.log('Stopping Docker containers...');
+ execSync(`docker compose -f ${composeFile} down -v`, { stdio: 'inherit' });
+ console.log('Docker containers stopped and volumes removed.');
+ } catch (error) {
+ console.error('Warning: Failed to stop Docker containers cleanly:', error);
+ }
+
+ // 2. Clean up test projects created on disk
+ try {
+ if (fs.existsSync(projectsDir)) {
+ console.log('Cleaning up test projects...');
+ const items = fs.readdirSync(projectsDir);
+
+ for (const item of items) {
+ const itemPath = path.join(projectsDir, item);
+
+ // Keep .env.global and test-project-static if they exist, remove everything else that looks like a test project
+ if (item === '.env.global' || item === 'test-project-static') continue;
+
+ if (fs.lstatSync(itemPath).isDirectory()) {
+ fs.rmSync(itemPath, { recursive: true, force: true });
+ console.log(` - Removed directory: ${item}`);
+ } else if (item.startsWith('test-project-')) {
+ fs.unlinkSync(itemPath);
+ console.log(` - Removed file: ${item}`);
+ }
+ }
+ }
+ } catch (error) {
+ console.error('Warning: Failed to clean up projects directory:', error);
+ }
+
+ console.log('Global teardown complete.\n');
}
export default globalTeardown;
diff --git a/tests/spec/api-keys.spec.ts b/tests/spec/api-keys.spec.ts
index b9e89edc7..a1123c79f 100644
--- a/tests/spec/api-keys.spec.ts
+++ b/tests/spec/api-keys.spec.ts
@@ -4,196 +4,200 @@ import { createTestApiKeys, deleteTestApiKeys } from '../utils/playwright.util';
const API_KEYS_ROUTE = '/settings/api-keys';
async function navigateToApiKeys(page: Page) {
- await page.goto(API_KEYS_ROUTE);
- await page.waitForLoadState('networkidle');
+ await page.goto(API_KEYS_ROUTE);
+ await page.waitForLoadState('networkidle');
}
test.describe('API Keys Page', () => {
- // Create test API keys before tests that need existing data
- test.beforeAll(async () => {
- await createTestApiKeys(3);
- });
+ // Create test API keys before tests that need existing data
+ test.beforeAll(async () => {
+ await createTestApiKeys(3);
+ });
- // Clean up test API keys after all tests
- test.afterAll(async () => {
- await deleteTestApiKeys();
- });
+ // Clean up test API keys after all tests
+ test.afterAll(async () => {
+ await deleteTestApiKeys();
+ });
- test('should display the API keys page title and description', async ({ page }) => {
- await navigateToApiKeys(page);
- await expect(page.getByRole('heading', { name: 'API Keys', level: 1 })).toBeVisible();
- await expect(page.getByText('Manage API keys for programmatic access to Arcane').first()).toBeVisible();
- });
+ test('should display the API keys page title and description', async ({ page }) => {
+ await navigateToApiKeys(page);
+ await expect(page.getByRole('heading', { name: 'API Keys', level: 1 })).toBeVisible();
+ await expect(
+ page.getByText('Manage API keys for programmatic access to Arcane').first()
+ ).toBeVisible();
+ });
- test('should open Create API Key sheet', async ({ page }) => {
- await navigateToApiKeys(page);
+ test('should open Create API Key sheet', async ({ page }) => {
+ await navigateToApiKeys(page);
- await page.getByRole('button', { name: 'Create API Key' }).click();
- await expect(page.getByRole('dialog')).toBeVisible();
- await expect(page.getByText('Create API Key').first()).toBeVisible();
- });
+ await page.getByRole('button', { name: 'Create API Key' }).click();
+ await expect(page.getByRole('dialog')).toBeVisible();
+ await expect(page.getByText('Create API Key').first()).toBeVisible();
+ });
- test('should validate required fields when creating API key', async ({ page }) => {
- await navigateToApiKeys(page);
+ test('should validate required fields when creating API key', async ({ page }) => {
+ await navigateToApiKeys(page);
- await page.getByRole('button', { name: 'Create API Key' }).click();
- const dialog = page.getByRole('dialog');
- await expect(dialog).toBeVisible();
+ await page.getByRole('button', { name: 'Create API Key' }).click();
+ const dialog = page.getByRole('dialog');
+ await expect(dialog).toBeVisible();
- // Try to submit without filling required name field
- await dialog.getByRole('button', { name: /Create API Key/i }).click();
+ // Try to submit without filling required name field
+ await dialog.getByRole('button', { name: /Create API Key/i }).click();
- // Should show validation error for name field
- await expect(dialog.getByText(/is required/i)).toBeVisible();
- });
+ // Should show validation error for name field
+ await expect(dialog.getByText(/is required/i)).toBeVisible();
+ });
- test('should create a new API key and show the key dialog', async ({ page }) => {
- await navigateToApiKeys(page);
+ test('should create a new API key and show the key dialog', async ({ page }) => {
+ await navigateToApiKeys(page);
- await page.getByRole('button', { name: 'Create API Key' }).click();
- const createDialog = page.getByRole('dialog');
- await expect(createDialog).toBeVisible();
+ await page.getByRole('button', { name: 'Create API Key' }).click();
+ const createDialog = page.getByRole('dialog');
+ await expect(createDialog).toBeVisible();
- const apiKeyName = `test-key-${Date.now()}`;
+ const apiKeyName = `test-key-${Date.now()}`;
- // Fill in the name field
- await createDialog.getByLabel(/Name/i).fill(apiKeyName);
+ // Fill in the name field
+ await createDialog.getByLabel(/Name/i).fill(apiKeyName);
- // Optionally fill description
- const descInput = createDialog.getByLabel(/Description/i);
- if (await descInput.count()) {
- await descInput.fill('E2E test API key');
- }
+ // Optionally fill description
+ const descInput = createDialog.getByLabel(/Description/i);
+ if (await descInput.count()) {
+ await descInput.fill('E2E test API key');
+ }
- // Submit the form
- await createDialog.getByRole('button', { name: /Create API Key/i }).click();
+ // Submit the form
+ await createDialog.getByRole('button', { name: /Create API Key/i }).click();
- // Should show success toast
- await expect(page.locator('li[data-sonner-toast][data-type="success"]').first()).toBeVisible({ timeout: 10000 });
+ // Should show success toast
+ await expect(page.locator('li[data-sonner-toast][data-type="success"]').first()).toBeVisible({
+ timeout: 10000
+ });
- // Should show the API key reveal dialog
- await expect(page.getByText('API Key Created')).toBeVisible();
- await expect(page.getByText(/Copy your API key now/i)).toBeVisible();
+ // Should show the API key reveal dialog
+ await expect(page.getByText('API Key Created')).toBeVisible();
+ await expect(page.getByText(/Copy your API key now/i)).toBeVisible();
- // The key should be visible in a code/snippet element
- await expect(page.locator('code, [data-snippet]').first()).toBeVisible();
+ // The key should be visible in a code/snippet element
+ await expect(page.locator('code, [data-snippet]').first()).toBeVisible();
- // Close the dialog
- await page.getByRole('button', { name: 'Done' }).click();
+ // Close the dialog
+ await page.getByRole('button', { name: 'Done' }).click();
- // The new key should appear in the table
- await expect(page.locator(`tr:has-text("${apiKeyName}")`)).toBeVisible();
- });
+ // The new key should appear in the table
+ await expect(page.locator(`tr:has-text("${apiKeyName}")`)).toBeVisible();
+ });
- test('should open edit dialog from row actions', async ({ page }) => {
- await navigateToApiKeys(page);
+ test('should open edit dialog from row actions', async ({ page }) => {
+ await navigateToApiKeys(page);
- const firstRow = page.locator('tbody tr').first();
- await expect(firstRow).toBeVisible();
+ const firstRow = page.locator('tbody tr').first();
+ await expect(firstRow).toBeVisible();
- await firstRow.getByRole('button', { name: 'Open menu' }).click();
- await page.getByRole('menuitem', { name: 'Edit' }).click();
+ await firstRow.getByRole('button', { name: 'Open menu' }).click();
+ await page.getByRole('menuitem', { name: 'Edit' }).click();
- await expect(page.getByRole('dialog')).toBeVisible();
- await expect(page.getByText('Edit API Key')).toBeVisible();
+ await expect(page.getByRole('dialog')).toBeVisible();
+ await expect(page.getByText('Edit API Key')).toBeVisible();
- // Close the dialog
- await page.keyboard.press('Escape');
- });
+ // Close the dialog
+ await page.keyboard.press('Escape');
+ });
- test('should open delete confirmation dialog from row actions', async ({ page }) => {
- await navigateToApiKeys(page);
+ test('should open delete confirmation dialog from row actions', async ({ page }) => {
+ await navigateToApiKeys(page);
- const firstRow = page.locator('tbody tr').first();
- await expect(firstRow).toBeVisible();
+ const firstRow = page.locator('tbody tr').first();
+ await expect(firstRow).toBeVisible();
- await firstRow.getByRole('button', { name: 'Open menu' }).click();
- await page.getByRole('menuitem', { name: 'Delete' }).click();
+ await firstRow.getByRole('button', { name: 'Open menu' }).click();
+ await page.getByRole('menuitem', { name: 'Delete' }).click();
- // Should show confirmation dialog
- await expect(page.getByText(/Delete API Key/i)).toBeVisible();
- await expect(page.getByText(/Are you sure/i)).toBeVisible();
+ // Should show confirmation dialog
+ await expect(page.getByText(/Delete API Key/i)).toBeVisible();
+ await expect(page.getByText(/Are you sure/i)).toBeVisible();
- // Cancel the deletion
- await page.getByRole('button', { name: 'Cancel' }).click();
- });
+ // Cancel the deletion
+ await page.getByRole('button', { name: 'Cancel' }).click();
+ });
- test('should delete an API key', async ({ page }) => {
- // First create a key to delete
- await navigateToApiKeys(page);
+ test('should delete an API key', async ({ page }) => {
+ // First create a key to delete
+ await navigateToApiKeys(page);
- await page.getByRole('button', { name: 'Create API Key' }).click();
- const createDialog = page.getByRole('dialog');
+ await page.getByRole('button', { name: 'Create API Key' }).click();
+ const createDialog = page.getByRole('dialog');
- const apiKeyName = `delete-test-${Date.now()}`;
- await createDialog.getByLabel(/Name/i).fill(apiKeyName);
- await createDialog.getByRole('button', { name: /Create API Key/i }).click();
+ const apiKeyName = `delete-test-${Date.now()}`;
+ await createDialog.getByLabel(/Name/i).fill(apiKeyName);
+ await createDialog.getByRole('button', { name: /Create API Key/i }).click();
- // Wait for creation success and close reveal dialog
- await expect(page.getByText('API Key Created')).toBeVisible({ timeout: 10000 });
- await page.getByRole('button', { name: 'Done' }).click();
+ // Wait for creation success and close reveal dialog
+ await expect(page.getByText('API Key Created')).toBeVisible({ timeout: 10000 });
+ await page.getByRole('button', { name: 'Done' }).click();
- // Wait for toasts to clear
- await page.waitForTimeout(1000);
+ // Wait for toasts to clear
+ await page.waitForTimeout(1000);
- // Now delete the key
- const keyRow = page.locator(`tr:has-text("${apiKeyName}")`);
- await expect(keyRow).toBeVisible();
+ // Now delete the key
+ const keyRow = page.locator(`tr:has-text("${apiKeyName}")`);
+ await expect(keyRow).toBeVisible();
- await keyRow.getByRole('button', { name: 'Open menu' }).click();
- await page.getByRole('menuitem', { name: 'Delete' }).click();
+ await keyRow.getByRole('button', { name: 'Open menu' }).click();
+ await page.getByRole('menuitem', { name: 'Delete' }).click();
- // Confirm deletion
- await expect(page.getByText(/Delete API Key/i)).toBeVisible();
- await page.getByRole('button', { name: 'Delete' }).click();
+ // Confirm deletion
+ await expect(page.getByText(/Delete API Key/i)).toBeVisible();
+ await page.getByRole('button', { name: 'Delete' }).click();
- // Should show success toast for deletion
- await expect(page.getByText(/deleted successfully/i)).toBeVisible({ timeout: 10000 });
+ // Should show success toast for deletion
+ await expect(page.getByText(/deleted successfully/i)).toBeVisible({ timeout: 10000 });
- // Key should no longer be in the table
- await expect(keyRow).toBeHidden();
- });
+ // Key should no longer be in the table
+ await expect(keyRow).toBeHidden();
+ });
- test('should select multiple API keys and show bulk delete option', async ({ page }) => {
- await navigateToApiKeys(page);
+ test('should select multiple API keys and show bulk delete option', async ({ page }) => {
+ await navigateToApiKeys(page);
- // Select first two checkboxes
- const checkboxes = page.locator('tbody tr input[type="checkbox"]');
- const checkboxCount = await checkboxes.count();
+ // Select first two checkboxes
+ const checkboxes = page.locator('tbody tr input[type="checkbox"]');
+ const checkboxCount = await checkboxes.count();
- if (checkboxCount < 2) {
- test.skip(true, 'Need at least 2 API keys for bulk selection test');
- return;
- }
+ if (checkboxCount < 2) {
+ test.skip(true, 'Need at least 2 API keys for bulk selection test');
+ return;
+ }
- await checkboxes.nth(0).check();
- await checkboxes.nth(1).check();
+ await checkboxes.nth(0).check();
+ await checkboxes.nth(1).check();
- // Remove Selected button should appear
- const removeSelectedBtn = page.getByRole('button', { name: /Remove Selected/i });
- await expect(removeSelectedBtn).toBeVisible();
+ // Remove Selected button should appear
+ const removeSelectedBtn = page.getByRole('button', { name: /Remove Selected/i });
+ await expect(removeSelectedBtn).toBeVisible();
- // Click it to open confirmation
- await removeSelectedBtn.click();
+ // Click it to open confirmation
+ await removeSelectedBtn.click();
- // Should show bulk delete confirmation
- await expect(page.getByText(/Delete.*API Key/i)).toBeVisible();
+ // Should show bulk delete confirmation
+ await expect(page.getByText(/Delete.*API Key/i)).toBeVisible();
- // Cancel
- await page.getByRole('button', { name: 'Cancel' }).click();
- });
+ // Cancel
+ await page.getByRole('button', { name: 'Cancel' }).click();
+ });
- test('should display correct status badges for active keys', async ({ page }) => {
- await navigateToApiKeys(page);
+ test('should display correct status badges for active keys', async ({ page }) => {
+ await navigateToApiKeys(page);
- // Check if Active badge is visible
- await expect(page.locator('text="Active"').first()).toBeVisible();
- });
+ // Check if Active badge is visible
+ await expect(page.locator('text="Active"').first()).toBeVisible();
+ });
- test('should display "Never" for keys without expiration', async ({ page }) => {
- await navigateToApiKeys(page);
+ test('should display "Never" for keys without expiration', async ({ page }) => {
+ await navigateToApiKeys(page);
- // Test keys created without expiration should show "Never"
- await expect(page.locator('text="Never"').first()).toBeVisible();
- });
+ // Test keys created without expiration should show "Never"
+ await expect(page.locator('text="Never"').first()).toBeVisible();
+ });
});
diff --git a/tests/spec/builds.spec.ts b/tests/spec/builds.spec.ts
index 1a321993b..398e399e6 100644
--- a/tests/spec/builds.spec.ts
+++ b/tests/spec/builds.spec.ts
@@ -1,425 +1,457 @@
-import { test, expect, type Locator, type Page } from "@playwright/test";
+import { test, expect, type Locator, type Page } from '@playwright/test';
const ROUTES = {
- page: "/images/builds",
+ page: '/images/builds'
};
const STREAM_SUCCESS =
- '{"type":"build","phase":"begin","service":"manual","status":"build started"}\n' +
- '{"type":"build","phase":"complete","service":"manual","status":"build complete"}\n';
+ '{"type":"build","phase":"begin","service":"manual","status":"build started"}\n' +
+ '{"type":"build","phase":"complete","service":"manual","status":"build complete"}\n';
const FIELD_LABELS = {
- cacheTo: "Cache To",
- entitlements: "Entitlements",
- network: "Network",
- isolation: "Isolation",
- shmSize: "Shm Size (bytes)",
- ulimits: "Ulimits",
- extraHosts: "Extra Hosts",
+ cacheTo: 'Cache To',
+ entitlements: 'Entitlements',
+ network: 'Network',
+ isolation: 'Isolation',
+ shmSize: 'Shm Size (bytes)',
+ ulimits: 'Ulimits',
+ extraHosts: 'Extra Hosts'
};
async function navigateToBuildWorkspace(page: Page) {
- await page.goto(ROUTES.page);
- await page.waitForLoadState("networkidle");
- await expect(page.getByRole("heading", { level: 1, name: /Build Workspace/i })).toBeVisible();
+ await page.goto(ROUTES.page);
+ await page.waitForLoadState('networkidle');
+ await expect(page.getByRole('heading', { level: 1, name: /Build Workspace/i })).toBeVisible();
}
async function ensureSwitchState(toggle: Locator, desired: boolean) {
- const current = (await toggle.getAttribute("aria-checked")) === "true";
- if (current !== desired) {
- await toggle.click();
- }
+ const current = (await toggle.getAttribute('aria-checked')) === 'true';
+ if (current !== desired) {
+ await toggle.click();
+ }
}
async function setRequiredBuildInputs(page: Page, tags = `e2e/build:${Date.now()}`) {
- const tagsInput = page.locator("#image-tags");
- await expect(tagsInput).toBeVisible();
- await tagsInput.fill(tags);
+ const tagsInput = page.locator('#image-tags');
+ await expect(tagsInput).toBeVisible();
+ await tagsInput.fill(tags);
}
-async function switchContextMode(page: Page, mode: "Workspace" | "Remote Git"): Promise<void> {
- await page.getByRole("button", { name: mode, exact: true }).first().click();
+async function switchContextMode(page: Page, mode: 'Workspace' | 'Remote Git'): Promise<void> {
+ await page.getByRole('button', { name: mode, exact: true }).first().click();
}
async function openAdvancedBuildOptions(page: Page) {
- const dockerfileInput = page.locator("#dockerfile");
- const alreadyVisible = await dockerfileInput.isVisible().catch(() => false);
- if (alreadyVisible) {
- return;
- }
-
- await page.getByRole("button", { name: /Advanced/i }).first().click();
- await expect(dockerfileInput).toBeVisible();
+ const dockerfileInput = page.locator('#dockerfile');
+ const alreadyVisible = await dockerfileInput.isVisible().catch(() => false);
+ if (alreadyVisible) {
+ return;
+ }
+
+ await page
+ .getByRole('button', { name: /Advanced/i })
+ .first()
+ .click();
+ await expect(dockerfileInput).toBeVisible();
}
-async function selectBuildProvider(page: Page, provider: "local" | "depot") {
- const providerTrigger = page.locator('[data-slot="select-trigger"]').first();
- await expect(providerTrigger).toBeVisible();
- await providerTrigger.click();
-
- const providerLabel = provider === "depot" ? "Depot" : "Local Docker";
- await page.locator('[data-slot="select-item"]').filter({ hasText: providerLabel }).first().click();
+async function selectBuildProvider(page: Page, provider: 'local' | 'depot') {
+ const providerTrigger = page.locator('[data-slot="select-trigger"]').first();
+ await expect(providerTrigger).toBeVisible();
+ await providerTrigger.click();
+
+ const providerLabel = provider === 'depot' ? 'Depot' : 'Local Docker';
+ await page
+ .locator('[data-slot="select-item"]')
+ .filter({ hasText: providerLabel })
+ .first()
+ .click();
}
function getToastTitle(page: Page) {
- return page.locator("li[data-sonner-toast] div[data-title]");
+ return page.locator('li[data-sonner-toast] div[data-title]');
}
function getBuildButton(page: Page) {
- return page.getByRole("button", { name: "Build", exact: true }).first();
+ return page.getByRole('button', { name: 'Build', exact: true }).first();
}
-function upsertSettingEntry(settings: Array<{ key: string; value: unknown }>, key: string, value: unknown) {
- const existing = settings.find((entry) => entry.key === key);
- if (existing) {
- existing.value = value;
- return;
- }
- settings.push({ key, value });
+function upsertSettingEntry(
+ settings: Array<{ key: string; value: unknown }>,
+ key: string,
+ value: unknown
+) {
+ const existing = settings.find((entry) => entry.key === key);
+ if (existing) {
+ existing.value = value;
+ return;
+ }
+ settings.push({ key, value });
}
function injectDepotSettings(payload: unknown): unknown {
- if (Array.isArray(payload)) {
- const settings = payload.map((entry) => ({ ...(entry as { key: string; value: unknown }) }));
- upsertSettingEntry(settings, "depotProjectId", "e2e-depot-project");
- upsertSettingEntry(settings, "depotToken", "e2e-depot-token");
- upsertSettingEntry(settings, "depotConfigured", "true");
- return settings;
- }
-
- if (payload && typeof payload === "object") {
- const maybeSettingsObject = payload as Record<string, unknown>;
- if (Array.isArray(maybeSettingsObject.settings)) {
- const settings = maybeSettingsObject.settings.map((entry) => ({ ...(entry as { key: string; value: unknown }) }));
- upsertSettingEntry(settings, "depotProjectId", "e2e-depot-project");
- upsertSettingEntry(settings, "depotToken", "e2e-depot-token");
- upsertSettingEntry(settings, "depotConfigured", "true");
- return { ...maybeSettingsObject, settings };
- }
-
- return {
- ...maybeSettingsObject,
- depotProjectId: "e2e-depot-project",
- depotToken: "e2e-depot-token",
- depotConfigured: true,
- };
- }
-
- return {
- depotProjectId: "e2e-depot-project",
- depotToken: "e2e-depot-token",
- depotConfigured: true,
- };
+ if (Array.isArray(payload)) {
+ const settings = payload.map((entry) => ({ ...(entry as { key: string; value: unknown }) }));
+ upsertSettingEntry(settings, 'depotProjectId', 'e2e-depot-project');
+ upsertSettingEntry(settings, 'depotToken', 'e2e-depot-token');
+ upsertSettingEntry(settings, 'depotConfigured', 'true');
+ return settings;
+ }
+
+ if (payload && typeof payload === 'object') {
+ const maybeSettingsObject = payload as Record<string, unknown>;
+ if (Array.isArray(maybeSettingsObject.settings)) {
+ const settings = maybeSettingsObject.settings.map((entry) => ({
+ ...(entry as { key: string; value: unknown })
+ }));
+ upsertSettingEntry(settings, 'depotProjectId', 'e2e-depot-project');
+ upsertSettingEntry(settings, 'depotToken', 'e2e-depot-token');
+ upsertSettingEntry(settings, 'depotConfigured', 'true');
+ return { ...maybeSettingsObject, settings };
+ }
+
+ return {
+ ...maybeSettingsObject,
+ depotProjectId: 'e2e-depot-project',
+ depotToken: 'e2e-depot-token',
+ depotConfigured: true
+ };
+ }
+
+ return {
+ depotProjectId: 'e2e-depot-project',
+ depotToken: 'e2e-depot-token',
+ depotConfigured: true
+ };
}
async function mockDepotConfiguredSettings(page: Page) {
- await page.route("**/api/environments/0/settings", async (route) => {
- if (route.request().method() !== "GET") {
- await route.continue();
- return;
- }
-
- const upstream = await route.fetch();
- const original = await upstream.json().catch(() => ({}));
- const patched = injectDepotSettings(original);
-
- await route.fulfill({
- status: upstream.status(),
- headers: {
- ...upstream.headers(),
- "content-type": "application/json",
- },
- body: JSON.stringify(patched),
- });
- });
+ await page.route('**/api/environments/0/settings', async (route) => {
+ if (route.request().method() !== 'GET') {
+ await route.continue();
+ return;
+ }
+
+ const upstream = await route.fetch();
+ const original = await upstream.json().catch(() => ({}));
+ const patched = injectDepotSettings(original);
+
+ await route.fulfill({
+ status: upstream.status(),
+ headers: {
+ ...upstream.headers(),
+ 'content-type': 'application/json'
+ },
+ body: JSON.stringify(patched)
+ });
+ });
}
-test.describe("Build workspace provider flows", () => {
- test("submits remote git build context from the dedicated context mode", async ({ page }) => {
- await navigateToBuildWorkspace(page);
- await switchContextMode(page, "Remote Git");
- await page.locator("#remote-context-url").fill("https://github.com/getarcaneapp/arcane.git#main:docker/app");
- await setRequiredBuildInputs(page, `e2e/remote:${Date.now()}`);
-
- let buildPayload: Record<string, unknown> | null = null;
- await page.route("**/api/environments/*/images/build", async (route) => {
- buildPayload = route.request().postDataJSON() as Record<string, unknown>;
- await route.fulfill({
- status: 200,
- contentType: "application/x-ndjson",
- body: STREAM_SUCCESS,
- });
- });
-
- await getBuildButton(page).click();
- await expect.poll(() => buildPayload, { timeout: 10000 }).not.toBeNull();
-
- expect(buildPayload?.contextDir).toBe("https://github.com/getarcaneapp/arcane.git#main:docker/app");
- });
-
- test("submits local provider build payload from UI controls", async ({ page }) => {
- await navigateToBuildWorkspace(page);
- await setRequiredBuildInputs(page);
-
- const pushSwitch = page.locator("#build-push");
- const loadSwitch = page.locator("#build-load");
-
- await expect(pushSwitch).toBeVisible();
- await expect(loadSwitch).toBeVisible();
-
- await ensureSwitchState(pushSwitch, true);
- await ensureSwitchState(loadSwitch, true);
-
- let buildPayload: Record<string, unknown> | null = null;
-
- await page.route("**/api/environments/*/images/build", async (route) => {
- buildPayload = route.request().postDataJSON() as Record<string, unknown>;
- await route.fulfill({
- status: 200,
- contentType: "application/x-ndjson",
- body: STREAM_SUCCESS,
- });
- });
-
- await page.getByRole("button", { name: "Build", exact: true }).first().click();
-
- await expect.poll(() => buildPayload, { timeout: 10000 }).not.toBeNull();
-
- expect(buildPayload?.provider).toBe("local");
- expect(buildPayload?.push).toBe(true);
- expect(buildPayload?.load).toBe(true);
-
- await expect(page.getByText("Build completed").first()).toBeVisible();
- });
-
- test("uses provider selector via UI and enforces depot push/load behavior", async ({ page }) => {
- await mockDepotConfiguredSettings(page);
- await navigateToBuildWorkspace(page);
- await setRequiredBuildInputs(page);
-
- await selectBuildProvider(page, "depot");
-
- const loadSwitch = page.locator("#build-load");
- await expect(loadSwitch).toBeDisabled();
-
- let buildPayload: Record<string, unknown> | null = null;
-
- await page.route("**/api/environments/*/images/build", async (route) => {
- buildPayload = route.request().postDataJSON() as Record<string, unknown>;
- await route.fulfill({
- status: 200,
- contentType: "application/x-ndjson",
- body: STREAM_SUCCESS,
- });
- });
-
- await page.getByRole("button", { name: "Build", exact: true }).first().click();
-
- await expect.poll(() => buildPayload, { timeout: 10000 }).not.toBeNull();
-
- expect(buildPayload?.provider).toBe("depot");
- expect(buildPayload?.push).toBe(true);
- expect(buildPayload?.load).toBe(false);
- });
-
- test("maps advanced local build options from UI into build request payload", async ({ page }) => {
- await navigateToBuildWorkspace(page);
- await setRequiredBuildInputs(page, `e2e/local-advanced:${Date.now()}`);
- await openAdvancedBuildOptions(page);
-
- await page.locator("#dockerfile").fill("Dockerfile.prod");
- await page.locator("#target").fill("builder");
- await page.locator("#platforms").fill("linux/amd64");
- await page.locator("#build-args").fill("FOO=bar\nHTTP_PROXY=http://proxy.local");
- await page.locator("#labels").fill("com.example.team=arcane\ncom.example.env=e2e");
- await page.locator("#cache-from").fill("myorg/myimage:cache,myorg/other:latest");
- await page.getByLabel(FIELD_LABELS.network).fill("host");
- await page.getByLabel(FIELD_LABELS.isolation).fill("process");
- await page.getByLabel(FIELD_LABELS.shmSize).fill("1048576");
- await page.getByLabel(FIELD_LABELS.ulimits).fill("nofile=1024:2048\nnproc=512:1024");
- await page.getByLabel(FIELD_LABELS.extraHosts).fill("registry.local=10.0.0.5\nmirror.local=10.0.0.6");
-
- await ensureSwitchState(page.locator("#no-cache"), true);
- await ensureSwitchState(page.locator("#pull-base-images"), true);
- await ensureSwitchState(page.locator("#build-push"), false);
- await ensureSwitchState(page.locator("#build-load"), true);
-
- let buildPayload: Record<string, unknown> | null = null;
- await page.route("**/api/environments/*/images/build", async (route) => {
- buildPayload = route.request().postDataJSON() as Record<string, unknown>;
- await route.fulfill({
- status: 200,
- contentType: "application/x-ndjson",
- body: STREAM_SUCCESS,
- });
- });
-
- await getBuildButton(page).click();
- await expect.poll(() => buildPayload, { timeout: 10000 }).not.toBeNull();
-
- expect(buildPayload).toMatchObject({
- dockerfile: "Dockerfile.prod",
- target: "builder",
- buildArgs: {
- FOO: "bar",
- HTTP_PROXY: "http://proxy.local",
- },
- labels: {
- "com.example.team": "arcane",
- "com.example.env": "e2e",
- },
- cacheFrom: ["myorg/myimage:cache", "myorg/other:latest"],
- cacheTo: [],
- network: "host",
- isolation: "process",
- shmSize: 1048576,
- ulimits: {
- nofile: "1024:2048",
- nproc: "512:1024",
- },
- entitlements: [],
- privileged: false,
- extraHosts: ["registry.local=10.0.0.5", "mirror.local=10.0.0.6"],
- platforms: ["linux/amd64"],
- noCache: true,
- pull: true,
- provider: "local",
- push: false,
- load: true,
- });
- });
-
- test("maps depot-supported advanced options and forces push/load in payload", async ({ page }) => {
- await mockDepotConfiguredSettings(page);
- await navigateToBuildWorkspace(page);
- await setRequiredBuildInputs(page, `e2e/depot-advanced:${Date.now()}`);
- await openAdvancedBuildOptions(page);
- await selectBuildProvider(page, "depot");
-
- await expect(page.locator("#build-load")).toBeDisabled();
- await page.getByLabel(FIELD_LABELS.cacheTo).fill("type=registry,ref=myorg/myimage:cache\ntype=inline");
- await page.getByLabel(FIELD_LABELS.entitlements).fill("network.host,security.insecure");
- await page.locator("#platforms").fill("linux/amd64, linux/arm64");
- await ensureSwitchState(page.locator("#privileged-build"), true);
- await ensureSwitchState(page.locator("#build-push"), false);
-
- let buildPayload: Record<string, unknown> | null = null;
- await page.route("**/api/environments/*/images/build", async (route) => {
- buildPayload = route.request().postDataJSON() as Record<string, unknown>;
- await route.fulfill({
- status: 200,
- contentType: "application/x-ndjson",
- body: STREAM_SUCCESS,
- });
- });
-
- await getBuildButton(page).click();
- await expect.poll(() => buildPayload, { timeout: 10000 }).not.toBeNull();
-
- expect(buildPayload).toMatchObject({
- cacheTo: ["type=registry", "ref=myorg/myimage:cache", "type=inline"],
- entitlements: ["network.host", "security.insecure"],
- privileged: true,
- platforms: ["linux/amd64", "linux/arm64"],
- provider: "depot",
- push: true,
- load: false,
- });
- });
-
- test("blocks local provider submission when unsupported local options are configured", async ({ page }) => {
- await navigateToBuildWorkspace(page);
- await setRequiredBuildInputs(page, `e2e/local-unsupported:${Date.now()}`);
- await openAdvancedBuildOptions(page);
-
- await page.getByLabel(FIELD_LABELS.cacheTo).evaluate((el) => {
- (el as HTMLTextAreaElement).disabled = false;
- });
- await page.getByLabel(FIELD_LABELS.entitlements).evaluate((el) => {
- (el as HTMLTextAreaElement).disabled = false;
- });
- await page.locator("#privileged-build").evaluate((el) => {
- const button = el as HTMLButtonElement;
- button.disabled = false;
- button.removeAttribute("disabled");
- button.removeAttribute("data-disabled");
- button.setAttribute("aria-disabled", "false");
- });
-
- await page.getByLabel(FIELD_LABELS.cacheTo).fill("type=registry,ref=myorg/myimage:cache");
- await page.getByLabel(FIELD_LABELS.entitlements).fill("network.host");
- await page.locator("#platforms").fill("linux/amd64, linux/arm64");
- await ensureSwitchState(page.locator("#privileged-build"), true);
-
- let buildRequests = 0;
- await page.route("**/api/environments/*/images/build", async (route) => {
- buildRequests += 1;
- await route.abort();
- });
-
- await getBuildButton(page).click();
- const localUnsupportedToast = getToastTitle(page).filter({
- hasText: /Unsupported build options for provider local:/,
- });
- await expect(localUnsupportedToast.first()).toBeVisible();
- const localUnsupportedText = await localUnsupportedToast.first().innerText();
- expect(localUnsupportedText).toContain("cacheTo");
- expect(localUnsupportedText).toContain("entitlements");
- expect(localUnsupportedText).toContain("platforms");
- await page.waitForTimeout(300);
- expect(buildRequests).toBe(0);
- });
-
- test("blocks depot provider submission when local-only values exist before switching provider", async ({ page }) => {
- await mockDepotConfiguredSettings(page);
- await navigateToBuildWorkspace(page);
- await setRequiredBuildInputs(page, `e2e/depot-unsupported:${Date.now()}`);
- await openAdvancedBuildOptions(page);
-
- await page.getByLabel(FIELD_LABELS.network).fill("host");
- await page.getByLabel(FIELD_LABELS.isolation).fill("process");
- await page.getByLabel(FIELD_LABELS.shmSize).fill("1024");
- await page.getByLabel(FIELD_LABELS.ulimits).fill("nofile=1024:2048");
- await page.getByLabel(FIELD_LABELS.extraHosts).fill("registry.local=10.0.0.5");
-
- await selectBuildProvider(page, "depot");
-
- let buildRequests = 0;
- await page.route("**/api/environments/*/images/build", async (route) => {
- buildRequests += 1;
- await route.abort();
- });
-
- await getBuildButton(page).click();
- await expect(getToastTitle(page).filter({ hasText: "Unsupported build options for provider depot: extraHosts, isolation, network, shmSize, ulimits" })).toBeVisible();
- await page.waitForTimeout(300);
- expect(buildRequests).toBe(0);
- });
-
- test("toggles provider-specific advanced field disabled states in the UI", async ({ page }) => {
- await mockDepotConfiguredSettings(page);
- await navigateToBuildWorkspace(page);
- await setRequiredBuildInputs(page, `e2e/provider-ui:${Date.now()}`);
- await openAdvancedBuildOptions(page);
-
- await expect(page.getByLabel(FIELD_LABELS.cacheTo)).toBeDisabled();
- await expect(page.getByLabel(FIELD_LABELS.entitlements)).toBeDisabled();
- await expect(page.locator("#privileged-build")).toBeDisabled();
- await expect(page.getByLabel(FIELD_LABELS.network)).toBeEnabled();
- await expect(page.getByLabel(FIELD_LABELS.isolation)).toBeEnabled();
- await expect(page.getByLabel(FIELD_LABELS.shmSize)).toBeEnabled();
- await expect(page.getByLabel(FIELD_LABELS.ulimits)).toBeEnabled();
- await expect(page.getByLabel(FIELD_LABELS.extraHosts)).toBeEnabled();
-
- await selectBuildProvider(page, "depot");
-
- await expect(page.getByLabel(FIELD_LABELS.cacheTo)).toBeEnabled();
- await expect(page.getByLabel(FIELD_LABELS.entitlements)).toBeEnabled();
- await expect(page.locator("#privileged-build")).toBeEnabled();
- await expect(page.getByLabel(FIELD_LABELS.network)).toBeDisabled();
- await expect(page.getByLabel(FIELD_LABELS.isolation)).toBeDisabled();
- await expect(page.getByLabel(FIELD_LABELS.shmSize)).toBeDisabled();
- await expect(page.getByLabel(FIELD_LABELS.ulimits)).toBeDisabled();
- await expect(page.getByLabel(FIELD_LABELS.extraHosts)).toBeDisabled();
- });
+test.describe('Build workspace provider flows', () => {
+ test('submits remote git build context from the dedicated context mode', async ({ page }) => {
+ await navigateToBuildWorkspace(page);
+ await switchContextMode(page, 'Remote Git');
+ await page
+ .locator('#remote-context-url')
+ .fill('https://github.com/getarcaneapp/arcane.git#main:docker/app');
+ await setRequiredBuildInputs(page, `e2e/remote:${Date.now()}`);
+
+ let buildPayload: Record<string, unknown> | null = null;
+ await page.route('**/api/environments/*/images/build', async (route) => {
+ buildPayload = route.request().postDataJSON() as Record<string, unknown>;
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/x-ndjson',
+ body: STREAM_SUCCESS
+ });
+ });
+
+ await getBuildButton(page).click();
+ await expect.poll(() => buildPayload, { timeout: 10000 }).not.toBeNull();
+
+ expect(buildPayload?.contextDir).toBe(
+ 'https://github.com/getarcaneapp/arcane.git#main:docker/app'
+ );
+ });
+
+ test('submits local provider build payload from UI controls', async ({ page }) => {
+ await navigateToBuildWorkspace(page);
+ await setRequiredBuildInputs(page);
+
+ const pushSwitch = page.locator('#build-push');
+ const loadSwitch = page.locator('#build-load');
+
+ await expect(pushSwitch).toBeVisible();
+ await expect(loadSwitch).toBeVisible();
+
+ await ensureSwitchState(pushSwitch, true);
+ await ensureSwitchState(loadSwitch, true);
+
+ let buildPayload: Record<string, unknown> | null = null;
+
+ await page.route('**/api/environments/*/images/build', async (route) => {
+ buildPayload = route.request().postDataJSON() as Record<string, unknown>;
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/x-ndjson',
+ body: STREAM_SUCCESS
+ });
+ });
+
+ await page.getByRole('button', { name: 'Build', exact: true }).first().click();
+
+ await expect.poll(() => buildPayload, { timeout: 10000 }).not.toBeNull();
+
+ expect(buildPayload?.provider).toBe('local');
+ expect(buildPayload?.push).toBe(true);
+ expect(buildPayload?.load).toBe(true);
+
+ await expect(page.getByText('Build completed').first()).toBeVisible();
+ });
+
+ test('uses provider selector via UI and enforces depot push/load behavior', async ({ page }) => {
+ await mockDepotConfiguredSettings(page);
+ await navigateToBuildWorkspace(page);
+ await setRequiredBuildInputs(page);
+
+ await selectBuildProvider(page, 'depot');
+
+ const loadSwitch = page.locator('#build-load');
+ await expect(loadSwitch).toBeDisabled();
+
+ let buildPayload: Record<string, unknown> | null = null;
+
+ await page.route('**/api/environments/*/images/build', async (route) => {
+ buildPayload = route.request().postDataJSON() as Record<string, unknown>;
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/x-ndjson',
+ body: STREAM_SUCCESS
+ });
+ });
+
+ await page.getByRole('button', { name: 'Build', exact: true }).first().click();
+
+ await expect.poll(() => buildPayload, { timeout: 10000 }).not.toBeNull();
+
+ expect(buildPayload?.provider).toBe('depot');
+ expect(buildPayload?.push).toBe(true);
+ expect(buildPayload?.load).toBe(false);
+ });
+
+ test('maps advanced local build options from UI into build request payload', async ({ page }) => {
+ await navigateToBuildWorkspace(page);
+ await setRequiredBuildInputs(page, `e2e/local-advanced:${Date.now()}`);
+ await openAdvancedBuildOptions(page);
+
+ await page.locator('#dockerfile').fill('Dockerfile.prod');
+ await page.locator('#target').fill('builder');
+ await page.locator('#platforms').fill('linux/amd64');
+ await page.locator('#build-args').fill('FOO=bar\nHTTP_PROXY=http://proxy.local');
+ await page.locator('#labels').fill('com.example.team=arcane\ncom.example.env=e2e');
+ await page.locator('#cache-from').fill('myorg/myimage:cache,myorg/other:latest');
+ await page.getByLabel(FIELD_LABELS.network).fill('host');
+ await page.getByLabel(FIELD_LABELS.isolation).fill('process');
+ await page.getByLabel(FIELD_LABELS.shmSize).fill('1048576');
+ await page.getByLabel(FIELD_LABELS.ulimits).fill('nofile=1024:2048\nnproc=512:1024');
+ await page
+ .getByLabel(FIELD_LABELS.extraHosts)
+ .fill('registry.local=10.0.0.5\nmirror.local=10.0.0.6');
+
+ await ensureSwitchState(page.locator('#no-cache'), true);
+ await ensureSwitchState(page.locator('#pull-base-images'), true);
+ await ensureSwitchState(page.locator('#build-push'), false);
+ await ensureSwitchState(page.locator('#build-load'), true);
+
+ let buildPayload: Record<string, unknown> | null = null;
+ await page.route('**/api/environments/*/images/build', async (route) => {
+ buildPayload = route.request().postDataJSON() as Record<string, unknown>;
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/x-ndjson',
+ body: STREAM_SUCCESS
+ });
+ });
+
+ await getBuildButton(page).click();
+ await expect.poll(() => buildPayload, { timeout: 10000 }).not.toBeNull();
+
+ expect(buildPayload).toMatchObject({
+ dockerfile: 'Dockerfile.prod',
+ target: 'builder',
+ buildArgs: {
+ FOO: 'bar',
+ HTTP_PROXY: 'http://proxy.local'
+ },
+ labels: {
+ 'com.example.team': 'arcane',
+ 'com.example.env': 'e2e'
+ },
+ cacheFrom: ['myorg/myimage:cache', 'myorg/other:latest'],
+ cacheTo: [],
+ network: 'host',
+ isolation: 'process',
+ shmSize: 1048576,
+ ulimits: {
+ nofile: '1024:2048',
+ nproc: '512:1024'
+ },
+ entitlements: [],
+ privileged: false,
+ extraHosts: ['registry.local=10.0.0.5', 'mirror.local=10.0.0.6'],
+ platforms: ['linux/amd64'],
+ noCache: true,
+ pull: true,
+ provider: 'local',
+ push: false,
+ load: true
+ });
+ });
+
+ test('maps depot-supported advanced options and forces push/load in payload', async ({
+ page
+ }) => {
+ await mockDepotConfiguredSettings(page);
+ await navigateToBuildWorkspace(page);
+ await setRequiredBuildInputs(page, `e2e/depot-advanced:${Date.now()}`);
+ await openAdvancedBuildOptions(page);
+ await selectBuildProvider(page, 'depot');
+
+ await expect(page.locator('#build-load')).toBeDisabled();
+ await page
+ .getByLabel(FIELD_LABELS.cacheTo)
+ .fill('type=registry,ref=myorg/myimage:cache\ntype=inline');
+ await page.getByLabel(FIELD_LABELS.entitlements).fill('network.host,security.insecure');
+ await page.locator('#platforms').fill('linux/amd64, linux/arm64');
+ await ensureSwitchState(page.locator('#privileged-build'), true);
+ await ensureSwitchState(page.locator('#build-push'), false);
+
+ let buildPayload: Record<string, unknown> | null = null;
+ await page.route('**/api/environments/*/images/build', async (route) => {
+ buildPayload = route.request().postDataJSON() as Record<string, unknown>;
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/x-ndjson',
+ body: STREAM_SUCCESS
+ });
+ });
+
+ await getBuildButton(page).click();
+ await expect.poll(() => buildPayload, { timeout: 10000 }).not.toBeNull();
+
+ expect(buildPayload).toMatchObject({
+ cacheTo: ['type=registry', 'ref=myorg/myimage:cache', 'type=inline'],
+ entitlements: ['network.host', 'security.insecure'],
+ privileged: true,
+ platforms: ['linux/amd64', 'linux/arm64'],
+ provider: 'depot',
+ push: true,
+ load: false
+ });
+ });
+
+ test('blocks local provider submission when unsupported local options are configured', async ({
+ page
+ }) => {
+ await navigateToBuildWorkspace(page);
+ await setRequiredBuildInputs(page, `e2e/local-unsupported:${Date.now()}`);
+ await openAdvancedBuildOptions(page);
+
+ await page.getByLabel(FIELD_LABELS.cacheTo).evaluate((el) => {
+ (el as HTMLTextAreaElement).disabled = false;
+ });
+ await page.getByLabel(FIELD_LABELS.entitlements).evaluate((el) => {
+ (el as HTMLTextAreaElement).disabled = false;
+ });
+ await page.locator('#privileged-build').evaluate((el) => {
+ const button = el as HTMLButtonElement;
+ button.disabled = false;
+ button.removeAttribute('disabled');
+ button.removeAttribute('data-disabled');
+ button.setAttribute('aria-disabled', 'false');
+ });
+
+ await page.getByLabel(FIELD_LABELS.cacheTo).fill('type=registry,ref=myorg/myimage:cache');
+ await page.getByLabel(FIELD_LABELS.entitlements).fill('network.host');
+ await page.locator('#platforms').fill('linux/amd64, linux/arm64');
+ await ensureSwitchState(page.locator('#privileged-build'), true);
+
+ let buildRequests = 0;
+ await page.route('**/api/environments/*/images/build', async (route) => {
+ buildRequests += 1;
+ await route.abort();
+ });
+
+ await getBuildButton(page).click();
+ const localUnsupportedToast = getToastTitle(page).filter({
+ hasText: /Unsupported build options for provider local:/
+ });
+ await expect(localUnsupportedToast.first()).toBeVisible();
+ const localUnsupportedText = await localUnsupportedToast.first().innerText();
+ expect(localUnsupportedText).toContain('cacheTo');
+ expect(localUnsupportedText).toContain('entitlements');
+ expect(localUnsupportedText).toContain('platforms');
+ await page.waitForTimeout(300);
+ expect(buildRequests).toBe(0);
+ });
+
+ test('blocks depot provider submission when local-only values exist before switching provider', async ({
+ page
+ }) => {
+ await mockDepotConfiguredSettings(page);
+ await navigateToBuildWorkspace(page);
+ await setRequiredBuildInputs(page, `e2e/depot-unsupported:${Date.now()}`);
+ await openAdvancedBuildOptions(page);
+
+ await page.getByLabel(FIELD_LABELS.network).fill('host');
+ await page.getByLabel(FIELD_LABELS.isolation).fill('process');
+ await page.getByLabel(FIELD_LABELS.shmSize).fill('1024');
+ await page.getByLabel(FIELD_LABELS.ulimits).fill('nofile=1024:2048');
+ await page.getByLabel(FIELD_LABELS.extraHosts).fill('registry.local=10.0.0.5');
+
+ await selectBuildProvider(page, 'depot');
+
+ let buildRequests = 0;
+ await page.route('**/api/environments/*/images/build', async (route) => {
+ buildRequests += 1;
+ await route.abort();
+ });
+
+ await getBuildButton(page).click();
+ await expect(
+ getToastTitle(page).filter({
+ hasText:
+ 'Unsupported build options for provider depot: extraHosts, isolation, network, shmSize, ulimits'
+ })
+ ).toBeVisible();
+ await page.waitForTimeout(300);
+ expect(buildRequests).toBe(0);
+ });
+
+ test('toggles provider-specific advanced field disabled states in the UI', async ({ page }) => {
+ await mockDepotConfiguredSettings(page);
+ await navigateToBuildWorkspace(page);
+ await setRequiredBuildInputs(page, `e2e/provider-ui:${Date.now()}`);
+ await openAdvancedBuildOptions(page);
+
+ await expect(page.getByLabel(FIELD_LABELS.cacheTo)).toBeDisabled();
+ await expect(page.getByLabel(FIELD_LABELS.entitlements)).toBeDisabled();
+ await expect(page.locator('#privileged-build')).toBeDisabled();
+ await expect(page.getByLabel(FIELD_LABELS.network)).toBeEnabled();
+ await expect(page.getByLabel(FIELD_LABELS.isolation)).toBeEnabled();
+ await expect(page.getByLabel(FIELD_LABELS.shmSize)).toBeEnabled();
+ await expect(page.getByLabel(FIELD_LABELS.ulimits)).toBeEnabled();
+ await expect(page.getByLabel(FIELD_LABELS.extraHosts)).toBeEnabled();
+
+ await selectBuildProvider(page, 'depot');
+
+ await expect(page.getByLabel(FIELD_LABELS.cacheTo)).toBeEnabled();
+ await expect(page.getByLabel(FIELD_LABELS.entitlements)).toBeEnabled();
+ await expect(page.locator('#privileged-build')).toBeEnabled();
+ await expect(page.getByLabel(FIELD_LABELS.network)).toBeDisabled();
+ await expect(page.getByLabel(FIELD_LABELS.isolation)).toBeDisabled();
+ await expect(page.getByLabel(FIELD_LABELS.shmSize)).toBeDisabled();
+ await expect(page.getByLabel(FIELD_LABELS.ulimits)).toBeDisabled();
+ await expect(page.getByLabel(FIELD_LABELS.extraHosts)).toBeDisabled();
+ });
});
diff --git a/tests/spec/container-grouped-pagination.spec.ts b/tests/spec/container-grouped-pagination.spec.ts
index cccdb2570..429b4b110 100644
--- a/tests/spec/container-grouped-pagination.spec.ts
+++ b/tests/spec/container-grouped-pagination.spec.ts
@@ -1,171 +1,185 @@
-import { expect, test } from "@playwright/test";
+import { expect, test } from '@playwright/test';
type MockContainer = {
- id: string;
- names: string[];
- image: string;
- imageId: string;
- command: string;
- created: number;
- labels: Record<string, string>;
- state: string;
- status: string;
- ports: [];
- hostConfig: { networkMode: string };
- networkSettings: { networks: Record<string, unknown> };
- mounts: [];
+ id: string;
+ names: string[];
+ image: string;
+ imageId: string;
+ command: string;
+ created: number;
+ labels: Record<string, string>;
+ state: string;
+ status: string;
+ ports: [];
+ hostConfig: { networkMode: string };
+ networkSettings: { networks: Record<string, unknown> };
+ mounts: [];
};
-function createContainer(id: string, name: string, project: string, created: number): MockContainer {
- return {
- id,
- names: [`/${name}`],
- image: `${project || "misc"}:latest`,
- imageId: `image-${id}`,
- command: "",
- created,
- labels: project ? { "com.docker.compose.project": project } : {},
- state: "running",
- status: "Up 5 minutes",
- ports: [],
- hostConfig: { networkMode: "default" },
- networkSettings: { networks: {} },
- mounts: [],
- };
+function createContainer(
+ id: string,
+ name: string,
+ project: string,
+ created: number
+): MockContainer {
+ return {
+ id,
+ names: [`/${name}`],
+ image: `${project || 'misc'}:latest`,
+ imageId: `image-${id}`,
+ command: '',
+ created,
+ labels: project ? { 'com.docker.compose.project': project } : {},
+ state: 'running',
+ status: 'Up 5 minutes',
+ ports: [],
+ hostConfig: { networkMode: 'default' },
+ networkSettings: { networks: {} },
+ mounts: []
+ };
}
function buildContainersResponse(containers: MockContainer[], start: number, limit: number) {
- const safeLimit = limit > 0 ? limit : containers.length;
- const pageItems = limit === -1 ? containers : containers.slice(start, start + safeLimit);
- const currentPage = limit > 0 ? Math.floor(start / safeLimit) + 1 : 1;
- const totalPages = limit > 0 ? Math.max(1, Math.ceil(containers.length / safeLimit)) : 1;
- const itemsPerPage = limit === -1 ? containers.length : safeLimit;
-
- return {
- success: true,
- data: pageItems,
- counts: {
- runningContainers: containers.length,
- stoppedContainers: 0,
- totalContainers: containers.length,
- },
- pagination: {
- totalPages,
- totalItems: containers.length,
- currentPage,
- itemsPerPage,
- grandTotalItems: containers.length,
- },
- };
+ const safeLimit = limit > 0 ? limit : containers.length;
+ const pageItems = limit === -1 ? containers : containers.slice(start, start + safeLimit);
+ const currentPage = limit > 0 ? Math.floor(start / safeLimit) + 1 : 1;
+ const totalPages = limit > 0 ? Math.max(1, Math.ceil(containers.length / safeLimit)) : 1;
+ const itemsPerPage = limit === -1 ? containers.length : safeLimit;
+
+ return {
+ success: true,
+ data: pageItems,
+ counts: {
+ runningContainers: containers.length,
+ stoppedContainers: 0,
+ totalContainers: containers.length
+ },
+ pagination: {
+ totalPages,
+ totalItems: containers.length,
+ currentPage,
+ itemsPerPage,
+ grandTotalItems: containers.length
+ }
+ };
}
-test("grouped containers do not split the same project across pages", async ({ page, context }) => {
- await page.addInitScript(() => {
- localStorage.removeItem("arcane-container-table");
- localStorage.setItem("container-groups-collapsed", JSON.stringify({ immich: false }));
- localStorage.removeItem("collapsible-cards-expanded");
- });
-
- let groupedMockPayload:
- | {
- groups: Array<{ groupName: string; items: MockContainer[] }>;
- }
- | undefined;
-
- const otherContainers = Array.from({ length: 18 }, (_, index) => {
- const project = `other-${index + 1}`;
- return createContainer(`other-${index + 1}`, `${project}-service`, project, 1_000 - index);
- });
-
- const immichContainers = [
- createContainer("immich-1", "immich-server", "immich", 900),
- createContainer("immich-2", "immich-machine-learning", "immich", 899),
- createContainer("immich-3", "immich-redis", "immich", 898),
- createContainer("immich-4", "immich-postgres", "immich", 897),
- ];
-
- const allContainers = [...otherContainers, ...immichContainers];
-
- await context.route("**/containers**", async (route) => {
- if (route.request().method() !== "GET") {
- await route.continue();
- return;
- }
-
- const url = new URL(route.request().url());
- if (!/^\/api\/environments\/[^/]+\/containers$/.test(url.pathname)) {
- await route.continue();
- return;
- }
-
- const start = Number(url.searchParams.get("start") ?? "0");
- const limit = Number(url.searchParams.get("limit") ?? "20");
- const groupBy = url.searchParams.get("groupBy");
-
- if (groupBy === "project") {
- groupedMockPayload = {
- groups: [
- {
- groupName: "immich",
- items: immichContainers,
- },
- ...otherContainers.slice(0, 18).map((container, index) => ({
- groupName: `other-${index + 1}`,
- items: [container],
- })),
- ],
- };
-
- await route.fulfill({
- status: 200,
- contentType: "application/json",
- body: JSON.stringify({
- success: true,
- data: [...immichContainers, ...otherContainers.slice(0, 18)],
- groups: groupedMockPayload.groups,
- counts: {
- runningContainers: allContainers.length,
- stoppedContainers: 0,
- totalContainers: allContainers.length,
- },
- pagination: {
- totalPages: 1,
- totalItems: allContainers.length,
- currentPage: 1,
- itemsPerPage: 20,
- grandTotalItems: allContainers.length,
- },
- }),
- });
- return;
- }
-
- await route.fulfill({
- status: 200,
- contentType: "application/json",
- body: JSON.stringify(buildContainersResponse(allContainers, start, limit)),
- });
- });
-
- await page.goto("/containers");
- await page.waitForLoadState("networkidle");
-
- await page.setViewportSize({ width: 1440, height: 900 });
-
- await page.getByRole("button", { name: "View" }).click();
- await page.getByRole("menuitemcheckbox", { name: "Group by Project" }).click();
- await page.keyboard.press("Escape");
-
- await expect.poll(() => groupedMockPayload?.groups.find((group) => group.groupName === "immich")?.items.length ?? 0).toBe(4);
-
- const immichGroupRow = page.locator("table tbody tr").filter({ has: page.getByText("immich", { exact: true }) });
-
- await expect(immichGroupRow).toHaveCount(1);
- await expect(immichGroupRow).toContainText("immich");
- await expect(immichGroupRow).toContainText("(4)");
-
- await expect(page.getByRole("link", { name: "immich-server", exact: true })).toBeVisible();
- await expect(page.getByRole("link", { name: "immich-machine-learning", exact: true })).toBeVisible();
- await expect(page.getByRole("link", { name: "immich-redis", exact: true })).toBeVisible();
- await expect(page.getByRole("link", { name: "immich-postgres", exact: true })).toBeVisible();
+test('grouped containers do not split the same project across pages', async ({ page, context }) => {
+ await page.addInitScript(() => {
+ localStorage.removeItem('arcane-container-table');
+ localStorage.setItem('container-groups-collapsed', JSON.stringify({ immich: false }));
+ localStorage.removeItem('collapsible-cards-expanded');
+ });
+
+ let groupedMockPayload:
+ | {
+ groups: Array<{ groupName: string; items: MockContainer[] }>;
+ }
+ | undefined;
+
+ const otherContainers = Array.from({ length: 18 }, (_, index) => {
+ const project = `other-${index + 1}`;
+ return createContainer(`other-${index + 1}`, `${project}-service`, project, 1_000 - index);
+ });
+
+ const immichContainers = [
+ createContainer('immich-1', 'immich-server', 'immich', 900),
+ createContainer('immich-2', 'immich-machine-learning', 'immich', 899),
+ createContainer('immich-3', 'immich-redis', 'immich', 898),
+ createContainer('immich-4', 'immich-postgres', 'immich', 897)
+ ];
+
+ const allContainers = [...otherContainers, ...immichContainers];
+
+ await context.route('**/containers**', async (route) => {
+ if (route.request().method() !== 'GET') {
+ await route.continue();
+ return;
+ }
+
+ const url = new URL(route.request().url());
+ if (!/^\/api\/environments\/[^/]+\/containers$/.test(url.pathname)) {
+ await route.continue();
+ return;
+ }
+
+ const start = Number(url.searchParams.get('start') ?? '0');
+ const limit = Number(url.searchParams.get('limit') ?? '20');
+ const groupBy = url.searchParams.get('groupBy');
+
+ if (groupBy === 'project') {
+ groupedMockPayload = {
+ groups: [
+ {
+ groupName: 'immich',
+ items: immichContainers
+ },
+ ...otherContainers.slice(0, 18).map((container, index) => ({
+ groupName: `other-${index + 1}`,
+ items: [container]
+ }))
+ ]
+ };
+
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ success: true,
+ data: [...immichContainers, ...otherContainers.slice(0, 18)],
+ groups: groupedMockPayload.groups,
+ counts: {
+ runningContainers: allContainers.length,
+ stoppedContainers: 0,
+ totalContainers: allContainers.length
+ },
+ pagination: {
+ totalPages: 1,
+ totalItems: allContainers.length,
+ currentPage: 1,
+ itemsPerPage: 20,
+ grandTotalItems: allContainers.length
+ }
+ })
+ });
+ return;
+ }
+
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify(buildContainersResponse(allContainers, start, limit))
+ });
+ });
+
+ await page.goto('/containers');
+ await page.waitForLoadState('networkidle');
+
+ await page.setViewportSize({ width: 1440, height: 900 });
+
+ await page.getByRole('button', { name: 'View' }).click();
+ await page.getByRole('menuitemcheckbox', { name: 'Group by Project' }).click();
+ await page.keyboard.press('Escape');
+
+ await expect
+ .poll(
+ () =>
+ groupedMockPayload?.groups.find((group) => group.groupName === 'immich')?.items.length ?? 0
+ )
+ .toBe(4);
+
+ const immichGroupRow = page
+ .locator('table tbody tr')
+ .filter({ has: page.getByText('immich', { exact: true }) });
+
+ await expect(immichGroupRow).toHaveCount(1);
+ await expect(immichGroupRow).toContainText('immich');
+ await expect(immichGroupRow).toContainText('(4)');
+
+ await expect(page.getByRole('link', { name: 'immich-server', exact: true })).toBeVisible();
+ await expect(
+ page.getByRole('link', { name: 'immich-machine-learning', exact: true })
+ ).toBeVisible();
+ await expect(page.getByRole('link', { name: 'immich-redis', exact: true })).toBeVisible();
+ await expect(page.getByRole('link', { name: 'immich-postgres', exact: true })).toBeVisible();
});
diff --git a/tests/spec/containers.spec.ts b/tests/spec/containers.spec.ts
index 4f7b7c2c3..fb9a464ed 100644
--- a/tests/spec/containers.spec.ts
+++ b/tests/spec/containers.spec.ts
@@ -5,98 +5,110 @@ import { ContainerSummary } from 'types/containers.type';
const CONTAINERS_ROUTE = '/containers';
async function navigateToContainers(page: Page) {
- await page.goto(CONTAINERS_ROUTE);
- await page.waitForLoadState('networkidle');
+ await page.goto(CONTAINERS_ROUTE);
+ await page.waitForLoadState('networkidle');
}
let containersData: Paginated<ContainerSummary> = { data: [], pagination: { totalItems: 0 } };
test.beforeEach(async ({ page }) => {
- await navigateToContainers(page);
- containersData = await fetchContainersWithRetry(page);
+ await navigateToContainers(page);
+ containersData = await fetchContainersWithRetry(page);
});
test.describe('Containers Page', () => {
- test('should display the containers page title and description', async ({ page }) => {
- await navigateToContainers(page);
- await expect(page.getByRole('heading', { name: 'Containers', level: 1 })).toBeVisible();
- await expect(page.getByText('View and Manage your Containers').first()).toBeVisible();
- });
-
- test('should display stat cards with correct counts', async ({ page }) => {
- await navigateToContainers(page);
-
- const total = containersData.pagination?.totalItems ?? containersData.data.length;
- const running = containersData.data.filter((c) => c.state === 'running').length;
- const stopped = containersData.data.filter((c) => c.state !== 'running').length;
-
- await expect(page.getByText(`${total} Total`)).toBeVisible();
- await expect(page.getByText(`${running} Running`, { exact: true })).toBeVisible();
- await expect(page.getByText(`${stopped} Stopped`)).toBeVisible();
- });
-
- test('should display the container table with columns', async ({ page }) => {
- await navigateToContainers(page);
- await expect(page.locator('table')).toBeVisible();
- await expect(page.getByRole('button', { name: 'Name' })).toBeVisible();
- await expect(page.getByRole('button', { name: 'ID' })).toBeVisible();
- await expect(page.getByRole('button', { name: 'Image', exact: true })).toBeVisible();
- await expect(page.getByRole('button', { name: 'State' })).toBeVisible();
- await expect(page.getByRole('button', { name: 'Created' })).toBeVisible();
- });
-
- test('should navigate to container details on Inspect', async ({ page }) => {
- test.skip(containersData.data.length === 0, 'No containers available');
- await navigateToContainers(page);
-
- const firstRow = page.locator('tbody tr').first();
- await firstRow.getByRole('button', { name: 'Open menu' }).click();
- await page.getByRole('menuitem', { name: 'Inspect', exact: true }).click();
-
- await expect(page).toHaveURL(/\/containers\/.+/);
- await expect(page.getByRole('heading', { name: 'Container Details', level: 2 }).first()).toBeVisible();
- });
-
- test('should show correct actions based on container state (without changing state)', async ({ page }) => {
- const running = containersData.data.find((c) => c.state === 'running');
- const stopped = containersData.data.find((c) => c.state !== 'running');
-
- await navigateToContainers(page);
-
- if (running) {
- const row = page.locator(`tr:has(a[href="/containers/${running.id}"])`);
- await row.getByRole('button', { name: 'Open menu' }).click();
- await expect(page.getByRole('menuitem', { name: 'Restart', exact: true })).toBeVisible();
- await expect(page.getByRole('menuitem', { name: 'Stop', exact: true })).toBeVisible();
- await page.keyboard.press('Escape');
- } else {
- test.info().annotations.push({ type: 'note', description: 'No running container to validate actions' });
- }
-
- if (stopped) {
- const row = page.locator(`tr:has(a[href="/containers/${stopped.id}"])`);
- await row.getByRole('button', { name: 'Open menu' }).click();
- await expect(page.getByRole('menuitem', { name: 'Start', exact: true })).toBeVisible();
- await page.keyboard.press('Escape');
- } else {
- test.info().annotations.push({ type: 'note', description: 'No stopped container to validate actions' });
- }
- });
-
- test('should open the Remove dialog from row actions and allow cancel', async ({ page }) => {
- test.skip(containersData.data.length === 0, 'No containers available');
- const any = containersData.data[0];
-
- await navigateToContainers(page);
-
- const row = page.locator(`tr:has(a[href="/containers/${any.id}"])`);
- await row.getByRole('button', { name: 'Open menu' }).click();
- await page.getByRole('menuitem', { name: 'Remove', exact: true }).click();
-
- const dialog = page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Confirm Container Removal")');
- await expect(dialog).toBeVisible();
-
- await page.getByRole('button', { name: 'Cancel' }).click();
- await expect(dialog).toBeHidden();
- });
+ test('should display the containers page title and description', async ({ page }) => {
+ await navigateToContainers(page);
+ await expect(page.getByRole('heading', { name: 'Containers', level: 1 })).toBeVisible();
+ await expect(page.getByText('View and Manage your Containers').first()).toBeVisible();
+ });
+
+ test('should display stat cards with correct counts', async ({ page }) => {
+ await navigateToContainers(page);
+
+ const total = containersData.pagination?.totalItems ?? containersData.data.length;
+ const running = containersData.data.filter((c) => c.state === 'running').length;
+ const stopped = containersData.data.filter((c) => c.state !== 'running').length;
+
+ await expect(page.getByText(`${total} Total`)).toBeVisible();
+ await expect(page.getByText(`${running} Running`, { exact: true })).toBeVisible();
+ await expect(page.getByText(`${stopped} Stopped`)).toBeVisible();
+ });
+
+ test('should display the container table with columns', async ({ page }) => {
+ await navigateToContainers(page);
+ await expect(page.locator('table')).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Name' })).toBeVisible();
+ await expect(page.getByRole('button', { name: 'ID' })).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Image', exact: true })).toBeVisible();
+ await expect(page.getByRole('button', { name: 'State' })).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Created' })).toBeVisible();
+ });
+
+ test('should navigate to container details on Inspect', async ({ page }) => {
+ test.skip(containersData.data.length === 0, 'No containers available');
+ await navigateToContainers(page);
+
+ const firstRow = page.locator('tbody tr').first();
+ await firstRow.getByRole('button', { name: 'Open menu' }).click();
+ await page.getByRole('menuitem', { name: 'Inspect', exact: true }).click();
+
+ await expect(page).toHaveURL(/\/containers\/.+/);
+ await expect(
+ page.getByRole('heading', { name: 'Container Details', level: 2 }).first()
+ ).toBeVisible();
+ });
+
+ test('should show correct actions based on container state (without changing state)', async ({
+ page
+ }) => {
+ const running = containersData.data.find((c) => c.state === 'running');
+ const stopped = containersData.data.find((c) => c.state !== 'running');
+
+ await navigateToContainers(page);
+
+ if (running) {
+ const row = page.locator(`tr:has(a[href="/containers/${running.id}"])`);
+ await row.getByRole('button', { name: 'Open menu' }).click();
+ await expect(page.getByRole('menuitem', { name: 'Restart', exact: true })).toBeVisible();
+ await expect(page.getByRole('menuitem', { name: 'Stop', exact: true })).toBeVisible();
+ await page.keyboard.press('Escape');
+ } else {
+ test.info().annotations.push({
+ type: 'note',
+ description: 'No running container to validate actions'
+ });
+ }
+
+ if (stopped) {
+ const row = page.locator(`tr:has(a[href="/containers/${stopped.id}"])`);
+ await row.getByRole('button', { name: 'Open menu' }).click();
+ await expect(page.getByRole('menuitem', { name: 'Start', exact: true })).toBeVisible();
+ await page.keyboard.press('Escape');
+ } else {
+ test.info().annotations.push({
+ type: 'note',
+ description: 'No stopped container to validate actions'
+ });
+ }
+ });
+
+ test('should open the Remove dialog from row actions and allow cancel', async ({ page }) => {
+ test.skip(containersData.data.length === 0, 'No containers available');
+ const any = containersData.data[0];
+
+ await navigateToContainers(page);
+
+ const row = page.locator(`tr:has(a[href="/containers/${any.id}"])`);
+ await row.getByRole('button', { name: 'Open menu' }).click();
+ await page.getByRole('menuitem', { name: 'Remove', exact: true }).click();
+
+ const dialog = page.locator(
+ 'div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Confirm Container Removal")'
+ );
+ await expect(dialog).toBeVisible();
+
+ await page.getByRole('button', { name: 'Cancel' }).click();
+ await expect(dialog).toBeHidden();
+ });
});
diff --git a/tests/spec/converter.spec.ts b/tests/spec/converter.spec.ts
index b3d7ae5ea..0fd52b49d 100644
--- a/tests/spec/converter.spec.ts
+++ b/tests/spec/converter.spec.ts
@@ -1,111 +1,112 @@
-import { test, expect, type Page } from "@playwright/test";
+import { test, expect, type Page } from '@playwright/test';
type ConvertResponse = {
- success: boolean;
- dockerCompose: string;
- envVars: string;
- serviceName: string;
+ success: boolean;
+ dockerCompose: string;
+ envVars: string;
+ serviceName: string;
};
const ROUTES = {
- page: "/projects/new",
- apiConvert: "/api/environments/0/system/convert",
+ page: '/projects/new',
+ apiConvert: '/api/environments/0/system/convert'
};
const SELECTORS = {
- convertButton: (name = "Convert to Compose") => ({ name }),
- textareaPlaceholder: "docker run -d --name my-app -p 8080:80 nginx:alpine",
- exampleButtonName: /docker run -d --name nginx/,
- successToast: "Docker run command converted successfully!",
- exampleCommandExpected: "docker run -d --name nginx -p 8080:80 -v nginx_data:/usr/share/nginx/html nginx:alpine",
- removeNewline: (s: string) => s.replace(/\r\n/g, "\n"),
+ convertButton: (name = 'Convert to Compose') => ({ name }),
+ textareaPlaceholder: 'docker run -d --name my-app -p 8080:80 nginx:alpine',
+ exampleButtonName: /docker run -d --name nginx/,
+ successToast: 'Docker run command converted successfully!',
+ exampleCommandExpected:
+ 'docker run -d --name nginx -p 8080:80 -v nginx_data:/usr/share/nginx/html nginx:alpine',
+ removeNewline: (s: string) => s.replace(/\r\n/g, '\n')
};
async function openConvertFromDockerRun(page: Page) {
- // Wait for the page to be fully loaded
- await page.waitForLoadState("networkidle");
-
- // Split-button chevron trigger on /projects/new. (Trigger is rendered via child snippet,
- // so data-slot="dropdown-menu-trigger" may not be present on the final button element.)
- let dropdownTrigger = page.locator("button.rounded-l-none.px-2").first();
- if ((await dropdownTrigger.count()) === 0) {
- // Fallback for markup changes: use the old icon-only heuristic
- dropdownTrigger = page.locator("button:has(svg)").filter({ hasText: "" }).last();
- }
-
- await expect(dropdownTrigger).toBeVisible();
- await dropdownTrigger.click();
-
- // Prefer text match, but keep positional fallback for non-English locales.
- const menuItems = page.locator('[data-slot="dropdown-menu-item"], [role="menuitem"]');
- await expect(menuItems.first()).toBeVisible();
-
- const convertItemByText = menuItems.filter({ hasText: /Convert from Docker Run/i }).first();
- if (await convertItemByText.count()) {
- await convertItemByText.click();
- } else {
- // Item order in this menu is: template, converter, git repo, separator, ...
- await menuItems.nth(1).click();
- }
-
- // Ensure converter dialog is open before interacting with inputs
- await expect(page.getByRole("button", SELECTORS.convertButton())).toBeVisible();
+ // Wait for the page to be fully loaded
+ await page.waitForLoadState('networkidle');
+
+ // Split-button chevron trigger on /projects/new. (Trigger is rendered via child snippet,
+ // so data-slot="dropdown-menu-trigger" may not be present on the final button element.)
+ let dropdownTrigger = page.locator('button.rounded-l-none.px-2').first();
+ if ((await dropdownTrigger.count()) === 0) {
+ // Fallback for markup changes: use the old icon-only heuristic
+ dropdownTrigger = page.locator('button:has(svg)').filter({ hasText: '' }).last();
+ }
+
+ await expect(dropdownTrigger).toBeVisible();
+ await dropdownTrigger.click();
+
+ // Prefer text match, but keep positional fallback for non-English locales.
+ const menuItems = page.locator('[data-slot="dropdown-menu-item"], [role="menuitem"]');
+ await expect(menuItems.first()).toBeVisible();
+
+ const convertItemByText = menuItems.filter({ hasText: /Convert from Docker Run/i }).first();
+ if (await convertItemByText.count()) {
+ await convertItemByText.click();
+ } else {
+ // Item order in this menu is: template, converter, git repo, separator, ...
+ await menuItems.nth(1).click();
+ }
+
+ // Ensure converter dialog is open before interacting with inputs
+ await expect(page.getByRole('button', SELECTORS.convertButton())).toBeVisible();
}
async function setupMockConvert(page: Page, payload: ConvertResponse) {
- await page.route(ROUTES.apiConvert, async (route) => {
- await route.fulfill({
- status: 200,
- contentType: "application/json",
- body: JSON.stringify(payload),
- });
- });
+ await page.route(ROUTES.apiConvert, async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify(payload)
+ });
+ });
}
-test.describe("Docker Run to Compose Converter", () => {
- test.beforeEach(async ({ page }) => {
- await page.goto(ROUTES.page);
- await page.waitForLoadState("networkidle");
- });
+test.describe('Docker Run to Compose Converter', () => {
+ test.beforeEach(async ({ page }) => {
+ await page.goto(ROUTES.page);
+ await page.waitForLoadState('networkidle');
+ });
- test("should convert simple docker run command", async ({ page }) => {
- await openConvertFromDockerRun(page);
+ test('should convert simple docker run command', async ({ page }) => {
+ await openConvertFromDockerRun(page);
- const dockerCommand = "docker run -d --name nginx -p 8080:80 nginx:alpine";
- await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill(dockerCommand);
+ const dockerCommand = 'docker run -d --name nginx -p 8080:80 nginx:alpine';
+ await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill(dockerCommand);
- await setupMockConvert(page, {
- success: true,
- dockerCompose: `services:
+ await setupMockConvert(page, {
+ success: true,
+ dockerCompose: `services:
nginx:
image: nginx:alpine
container_name: nginx
ports:
- 8080:80`,
- envVars: "",
- serviceName: "nginx",
- });
+ envVars: '',
+ serviceName: 'nginx'
+ });
- await page.getByRole("button", SELECTORS.convertButton()).click();
+ await page.getByRole('button', SELECTORS.convertButton()).click();
- await expect(page.getByText(SELECTORS.successToast)).toBeVisible();
+ await expect(page.getByText(SELECTORS.successToast)).toBeVisible();
- await expect(page.getByRole("button", { name: "nginx", exact: true })).toBeVisible();
+ await expect(page.getByRole('button', { name: 'nginx', exact: true })).toBeVisible();
- await expect(page.getByPlaceholder(SELECTORS.textareaPlaceholder)).toHaveValue("");
- });
+ await expect(page.getByPlaceholder(SELECTORS.textareaPlaceholder)).toHaveValue('');
+ });
- test("should convert docker run command with environment variables", async ({ page }) => {
- await openConvertFromDockerRun(page);
- await page.waitForTimeout(300);
+ test('should convert docker run command with environment variables', async ({ page }) => {
+ await openConvertFromDockerRun(page);
+ await page.waitForTimeout(300);
- const dockerCommand =
- "docker run -d --name postgres -e POSTGRES_DB=mydb -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass postgres:15";
- await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill(dockerCommand);
+ const dockerCommand =
+ 'docker run -d --name postgres -e POSTGRES_DB=mydb -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass postgres:15';
+ await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill(dockerCommand);
- await setupMockConvert(page, {
- success: true,
- dockerCompose: `services:
+ await setupMockConvert(page, {
+ success: true,
+ dockerCompose: `services:
postgres:
image: postgres:15
container_name: postgres
@@ -113,58 +114,62 @@ test.describe("Docker Run to Compose Converter", () => {
- POSTGRES_DB=mydb
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass`,
- envVars: "POSTGRES_DB=mydb\nPOSTGRES_USER=user\nPOSTGRES_PASSWORD=pass",
- serviceName: "postgres",
- });
+ envVars: 'POSTGRES_DB=mydb\nPOSTGRES_USER=user\nPOSTGRES_PASSWORD=pass',
+ serviceName: 'postgres'
+ });
- await page.getByRole("button", SELECTORS.convertButton()).click();
+ await page.getByRole('button', SELECTORS.convertButton()).click();
- await expect(page.getByText(SELECTORS.successToast)).toBeVisible();
+ await expect(page.getByText(SELECTORS.successToast)).toBeVisible();
- await expect(page.getByRole("button", { name: "postgres", exact: true })).toBeVisible();
- });
+ await expect(page.getByRole('button', { name: 'postgres', exact: true })).toBeVisible();
+ });
- test("should use example commands", async ({ page }) => {
- await openConvertFromDockerRun(page);
- await page.waitForTimeout(300);
+ test('should use example commands', async ({ page }) => {
+ await openConvertFromDockerRun(page);
+ await page.waitForTimeout(300);
- await page.getByRole("button", { name: SELECTORS.exampleButtonName }).first().click();
+ await page.getByRole('button', { name: SELECTORS.exampleButtonName }).first().click();
- await expect(page.getByPlaceholder(SELECTORS.textareaPlaceholder)).toHaveValue(SELECTORS.exampleCommandExpected);
- });
+ await expect(page.getByPlaceholder(SELECTORS.textareaPlaceholder)).toHaveValue(
+ SELECTORS.exampleCommandExpected
+ );
+ });
- test("should disable convert button when no command is entered", async ({ page }) => {
- await openConvertFromDockerRun(page);
- await page.waitForTimeout(300);
+ test('should disable convert button when no command is entered', async ({ page }) => {
+ await openConvertFromDockerRun(page);
+ await page.waitForTimeout(300);
- const convertBtn = page.getByRole("button", SELECTORS.convertButton());
+ const convertBtn = page.getByRole('button', SELECTORS.convertButton());
- await expect(convertBtn).toBeDisabled();
+ await expect(convertBtn).toBeDisabled();
- await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill("docker run nginx");
- await expect(convertBtn).toBeEnabled();
+ await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill('docker run nginx');
+ await expect(convertBtn).toBeEnabled();
- await page.getByPlaceholder(SELECTORS.textareaPlaceholder).clear();
- await expect(convertBtn).toBeDisabled();
- });
+ await page.getByPlaceholder(SELECTORS.textareaPlaceholder).clear();
+ await expect(convertBtn).toBeDisabled();
+ });
- test("should populate stack name only when empty", async ({ page }) => {
- await openConvertFromDockerRun(page);
- await page.waitForTimeout(300);
+ test('should populate stack name only when empty', async ({ page }) => {
+ await openConvertFromDockerRun(page);
+ await page.waitForTimeout(300);
- await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill("docker run --name redis redis:alpine");
+ await page
+ .getByPlaceholder(SELECTORS.textareaPlaceholder)
+ .fill('docker run --name redis redis:alpine');
- await setupMockConvert(page, {
- success: true,
- dockerCompose: "services:\n redis:\n image: redis:alpine",
- envVars: "",
- serviceName: "redis",
- });
+ await setupMockConvert(page, {
+ success: true,
+ dockerCompose: 'services:\n redis:\n image: redis:alpine',
+ envVars: '',
+ serviceName: 'redis'
+ });
- await page.getByRole("button", SELECTORS.convertButton()).click();
+ await page.getByRole('button', SELECTORS.convertButton()).click();
- await expect(page.getByText(SELECTORS.successToast)).toBeVisible();
+ await expect(page.getByText(SELECTORS.successToast)).toBeVisible();
- await expect(page.getByRole("button", { name: "redis", exact: true })).toBeVisible();
- });
+ await expect(page.getByRole('button', { name: 'redis', exact: true })).toBeVisible();
+ });
});
diff --git a/tests/spec/dashboard-system-stats.spec.ts b/tests/spec/dashboard-system-stats.spec.ts
index c81a6ddc0..484dccae8 100644
--- a/tests/spec/dashboard-system-stats.spec.ts
+++ b/tests/spec/dashboard-system-stats.spec.ts
@@ -1,110 +1,116 @@
import { test, expect, type Page } from '@playwright/test';
const mockedStats = {
- cpuUsage: 12.3,
- memoryUsage: 512 * 1024 * 1024,
- memoryTotal: 1024 * 1024 * 1024,
- diskUsage: 256 * 1024 * 1024,
- diskTotal: 1024 * 1024 * 1024,
- cpuCount: 7,
- architecture: 'amd64',
- platform: 'linux',
- hostname: 'edge-client',
- gpuCount: 0,
- gpus: [],
+ cpuUsage: 12.3,
+ memoryUsage: 512 * 1024 * 1024,
+ memoryTotal: 1024 * 1024 * 1024,
+ diskUsage: 256 * 1024 * 1024,
+ diskTotal: 1024 * 1024 * 1024,
+ cpuCount: 7,
+ architecture: 'amd64',
+ platform: 'linux',
+ hostname: 'edge-client',
+ gpuCount: 0,
+ gpus: []
};
async function mockDashboardStatsWebSocket(page: Page) {
- await page.addInitScript((statsPayload) => {
- const browserWindow = globalThis as typeof globalThis & {
- WebSocket: any;
- EventTarget: any;
- Event: any;
- MessageEvent: any;
- CloseEvent: any;
- };
- const NativeWebSocket = browserWindow.WebSocket;
- const statsPathPattern = /\/api\/environments\/[^/]+\/ws\/system\/stats(?:\?.*)?$/;
+ await page.addInitScript((statsPayload) => {
+ const browserWindow = globalThis as typeof globalThis & {
+ WebSocket: any;
+ EventTarget: any;
+ Event: any;
+ MessageEvent: any;
+ CloseEvent: any;
+ };
+ const NativeWebSocket = browserWindow.WebSocket;
+ const statsPathPattern = /\/api\/environments\/[^/]+\/ws\/system\/stats(?:\?.*)?$/;
- class MockStatsWebSocket extends browserWindow.EventTarget {
- static CONNECTING = 0;
- static OPEN = 1;
- static CLOSING = 2;
- static CLOSED = 3;
+ class MockStatsWebSocket extends browserWindow.EventTarget {
+ static CONNECTING = 0;
+ static OPEN = 1;
+ static CLOSING = 2;
+ static CLOSED = 3;
- url: string;
- readyState = MockStatsWebSocket.CONNECTING;
- bufferedAmount = 0;
- extensions = '';
- protocol = '';
- binaryType = 'blob';
- onopen: ((event: unknown) => void) | null = null;
- onmessage: ((event: unknown) => void) | null = null;
- onerror: ((event: unknown) => void) | null = null;
- onclose: ((event: unknown) => void) | null = null;
+ url: string;
+ readyState = MockStatsWebSocket.CONNECTING;
+ bufferedAmount = 0;
+ extensions = '';
+ protocol = '';
+ binaryType = 'blob';
+ onopen: ((event: unknown) => void) | null = null;
+ onmessage: ((event: unknown) => void) | null = null;
+ onerror: ((event: unknown) => void) | null = null;
+ onclose: ((event: unknown) => void) | null = null;
- constructor(url: string | URL) {
- super();
- this.url = String(url);
+ constructor(url: string | URL) {
+ super();
+ this.url = String(url);
- queueMicrotask(() => {
- if (this.readyState !== MockStatsWebSocket.CONNECTING) return;
- this.readyState = MockStatsWebSocket.OPEN;
- const openEvent = new browserWindow.Event('open');
- this.dispatchEvent(openEvent);
- this.onopen?.(openEvent);
+ queueMicrotask(() => {
+ if (this.readyState !== MockStatsWebSocket.CONNECTING) return;
+ this.readyState = MockStatsWebSocket.OPEN;
+ const openEvent = new browserWindow.Event('open');
+ this.dispatchEvent(openEvent);
+ this.onopen?.(openEvent);
- const messageEvent = new browserWindow.MessageEvent('message', {
- data: JSON.stringify(statsPayload),
- });
- this.dispatchEvent(messageEvent);
- this.onmessage?.(messageEvent);
- });
- }
+ const messageEvent = new browserWindow.MessageEvent('message', {
+ data: JSON.stringify(statsPayload)
+ });
+ this.dispatchEvent(messageEvent);
+ this.onmessage?.(messageEvent);
+ });
+ }
- send(_data?: string | ArrayBufferLike | Blob | ArrayBufferView) {}
+ send(_data?: string | ArrayBufferLike | Blob | ArrayBufferView) {}
- close(code = 1000, reason = '') {
- if (this.readyState === MockStatsWebSocket.CLOSED) return;
- this.readyState = MockStatsWebSocket.CLOSED;
- const closeEvent = new browserWindow.CloseEvent('close', { code, reason, wasClean: true });
- this.dispatchEvent(closeEvent);
- this.onclose?.(closeEvent);
- }
- }
+ close(code = 1000, reason = '') {
+ if (this.readyState === MockStatsWebSocket.CLOSED) return;
+ this.readyState = MockStatsWebSocket.CLOSED;
+ const closeEvent = new browserWindow.CloseEvent('close', { code, reason, wasClean: true });
+ this.dispatchEvent(closeEvent);
+ this.onclose?.(closeEvent);
+ }
+ }
- const PatchedWebSocket = function (this: unknown, url: string | URL, protocols?: string | string[]) {
- const urlString = String(url);
- if (statsPathPattern.test(urlString)) {
- return new MockStatsWebSocket(urlString);
- }
- return protocols === undefined ? new NativeWebSocket(url) : new NativeWebSocket(url, protocols);
- } as unknown as typeof WebSocket;
+ const PatchedWebSocket = function (
+ this: unknown,
+ url: string | URL,
+ protocols?: string | string[]
+ ) {
+ const urlString = String(url);
+ if (statsPathPattern.test(urlString)) {
+ return new MockStatsWebSocket(urlString);
+ }
+ return protocols === undefined
+ ? new NativeWebSocket(url)
+ : new NativeWebSocket(url, protocols);
+ } as unknown as typeof WebSocket;
- Object.defineProperties(PatchedWebSocket, {
- CONNECTING: { value: NativeWebSocket.CONNECTING },
- OPEN: { value: NativeWebSocket.OPEN },
- CLOSING: { value: NativeWebSocket.CLOSING },
- CLOSED: { value: NativeWebSocket.CLOSED },
- });
- PatchedWebSocket.prototype = NativeWebSocket.prototype;
+ Object.defineProperties(PatchedWebSocket, {
+ CONNECTING: { value: NativeWebSocket.CONNECTING },
+ OPEN: { value: NativeWebSocket.OPEN },
+ CLOSING: { value: NativeWebSocket.CLOSING },
+ CLOSED: { value: NativeWebSocket.CLOSED }
+ });
+ PatchedWebSocket.prototype = NativeWebSocket.prototype;
- browserWindow.WebSocket = PatchedWebSocket;
- }, mockedStats);
+ browserWindow.WebSocket = PatchedWebSocket;
+ }, mockedStats);
}
test.describe('Dashboard system stats websocket', () => {
- test('renders metrics from the system stats websocket stream', async ({ page }) => {
- await mockDashboardStatsWebSocket(page);
+ test('renders metrics from the system stats websocket stream', async ({ page }) => {
+ await mockDashboardStatsWebSocket(page);
- await page.goto('/dashboard');
- await page.waitForLoadState('networkidle');
+ await page.goto('/dashboard');
+ await page.waitForLoadState('networkidle');
- await expect(page.getByText('12.3%', { exact: true })).toBeVisible();
- await expect(page.getByText('50.0%', { exact: true })).toBeVisible();
- await expect(page.getByText('25.0%', { exact: true })).toBeVisible();
- await expect(page.getByText('7 CPUs', { exact: true })).toBeVisible();
- await expect(page.getByText('512 MB / 1 GB', { exact: true })).toBeVisible();
- await expect(page.getByText('256 MB / 1 GB', { exact: true })).toBeVisible();
- });
+ await expect(page.getByText('12.3%', { exact: true })).toBeVisible();
+ await expect(page.getByText('50.0%', { exact: true })).toBeVisible();
+ await expect(page.getByText('25.0%', { exact: true })).toBeVisible();
+ await expect(page.getByText('7 CPUs', { exact: true })).toBeVisible();
+ await expect(page.getByText('512 MB / 1 GB', { exact: true })).toBeVisible();
+ await expect(page.getByText('256 MB / 1 GB', { exact: true })).toBeVisible();
+ });
});
diff --git a/tests/spec/edge-agent.spec.ts b/tests/spec/edge-agent.spec.ts
index 1714678dc..06f2974f9 100644
--- a/tests/spec/edge-agent.spec.ts
+++ b/tests/spec/edge-agent.spec.ts
@@ -1,140 +1,147 @@
import { test, expect, type Page } from '@playwright/test';
const ROUTES = {
- environments: '/environments',
+ environments: '/environments'
};
async function openNewEnvironmentSheet(page: Page) {
- await page.goto(ROUTES.environments);
- await page.waitForLoadState('networkidle');
+ await page.goto(ROUTES.environments);
+ await page.waitForLoadState('networkidle');
- const addButton = page.getByRole('button', { name: 'Add Environment', exact: true });
- await expect(addButton).toBeVisible();
- await addButton.click();
+ const addButton = page.getByRole('button', { name: 'Add Environment', exact: true });
+ await expect(addButton).toBeVisible();
+ await addButton.click();
- await expect(page.getByText('Create New Agent Environment')).toBeVisible();
+ await expect(page.getByText('Create New Agent Environment')).toBeVisible();
}
async function switchToEdgeMode(page: Page) {
- await page.getByRole('tab', { name: 'Edge', exact: true }).click();
- await expect(page.getByText('Agent connects outbound to the manager.')).toBeVisible();
+ await page.getByRole('tab', { name: 'Edge', exact: true }).click();
+ await expect(page.getByText('Agent connects outbound to the manager.')).toBeVisible();
}
test.describe('Edge Agent Environment', () => {
- test('should display the edge agent form', async ({ page }) => {
- await openNewEnvironmentSheet(page);
-
- await switchToEdgeMode(page);
-
- await expect(page.getByPlaceholder('Remote Docker Host')).toBeVisible();
- await expect(page.getByRole('button', { name: 'Generate Agent Configuration', exact: true })).toBeVisible();
- });
-
- test('should switch between direct and edge connection modes', async ({ page }) => {
- await openNewEnvironmentSheet(page);
-
- await expect(page.locator('#new-agent-api-url')).toBeVisible();
- await expect(page.getByPlaceholder('Remote Docker Host')).toBeHidden();
-
- await switchToEdgeMode(page);
- await expect(page.locator('#new-agent-api-url')).toBeHidden();
- await expect(page.getByPlaceholder('Remote Docker Host')).toBeVisible();
-
- await page.getByRole('tab', { name: 'Direct', exact: true }).click();
- await expect(page.locator('#new-agent-api-url')).toBeVisible();
- await expect(page.getByPlaceholder('Remote Docker Host')).toBeHidden();
- });
-
- test('should validate required fields for edge and direct modes', async ({ page }) => {
- await openNewEnvironmentSheet(page);
- let createRequests = 0;
-
- await page.route('**/api/environments', async (route) => {
- if (route.request().method() === 'POST') {
- createRequests += 1;
- }
- await route.continue();
- });
-
- // Direct mode: missing name and URL
- await page.getByRole('button', { name: 'Generate Agent Configuration', exact: true }).click();
- await expect.poll(() => createRequests).toBe(0);
-
- // Edge mode: missing name
- await switchToEdgeMode(page);
- await page.getByRole('button', { name: 'Generate Agent Configuration', exact: true }).click();
- await expect.poll(() => createRequests).toBe(0);
- });
-
- test('should create an edge agent environment and show deployment snippets', async ({ page }) => {
- const environmentName = `edge-agent-${Date.now().toString().slice(-6)}`;
- let createdEnvironmentId: string | null = null;
-
- await page.route('**/api/environments', async (route) => {
- if (route.request().method() === 'POST') {
- const response = await route.fetch();
- const body = await response.text();
- try {
- const parsed = JSON.parse(body);
- createdEnvironmentId = parsed?.data?.id ?? parsed?.id ?? null;
- } catch {
- createdEnvironmentId = createdEnvironmentId ?? null;
- }
-
- await route.fulfill({
- status: response.status(),
- headers: response.headers(),
- body,
- });
- return;
- }
-
- await route.continue();
- });
-
- try {
- await openNewEnvironmentSheet(page);
- await switchToEdgeMode(page);
-
- await page.getByPlaceholder('Remote Docker Host').fill(environmentName);
- const submitButton = page.getByRole('button', { name: 'Generate Agent Configuration', exact: true });
- await submitButton.click();
-
- const sheetTitle = page.locator('[data-slot="sheet-title"]');
- await expect(sheetTitle).toContainText(/Environment Created/i);
- await expect(page.getByText('Edge agent - connects outbound to manager', { exact: true })).toBeVisible();
- await expect(page.getByText('API Key', { exact: true })).toBeVisible();
- await expect(page.getByText('Docker Run Command', { exact: true })).toBeVisible();
- await expect(page.getByText('Docker Compose', { exact: true })).toBeVisible();
-
- const snippetBlocks = page.locator('pre code').filter({ hasText: 'EDGE_AGENT=true' });
- await expect(snippetBlocks.first()).toBeVisible();
-
- const dockerRunSnippet = snippetBlocks.first();
- await expect(dockerRunSnippet).toContainText('arcane-edge-agent');
- await expect(dockerRunSnippet).not.toContainText('-p 3553:3553');
-
- await page.getByRole('button', { name: 'Done', exact: true }).click();
-
- await expect(page.getByRole('button', { name: environmentName, exact: true })).toBeVisible();
- const environmentRow = page.locator('tr').filter({
- has: page.getByRole('button', { name: environmentName, exact: true }),
- });
- await expect(environmentRow.getByText('edge://edge-agent-').first()).toBeVisible();
- await expect(environmentRow.getByText('Edge', { exact: true })).toBeVisible();
-
- await page.getByRole('button', { name: environmentName, exact: true }).click();
- if (createdEnvironmentId) {
- await expect(page).toHaveURL(new RegExp(`/environments/${createdEnvironmentId}`));
- }
-
- await expect(page.locator('#api-url')).toHaveValue(/edge:\/\/edge-agent-/);
- await expect(page.getByText('Edge', { exact: true }).first()).toBeVisible();
- await expect(page.getByText('Live Tunnel', { exact: true })).toBeVisible();
- } finally {
- if (createdEnvironmentId) {
- await page.request.delete(`/api/environments/${createdEnvironmentId}`);
- }
- }
- });
+ test('should display the edge agent form', async ({ page }) => {
+ await openNewEnvironmentSheet(page);
+
+ await switchToEdgeMode(page);
+
+ await expect(page.getByPlaceholder('Remote Docker Host')).toBeVisible();
+ await expect(
+ page.getByRole('button', { name: 'Generate Agent Configuration', exact: true })
+ ).toBeVisible();
+ });
+
+ test('should switch between direct and edge connection modes', async ({ page }) => {
+ await openNewEnvironmentSheet(page);
+
+ await expect(page.locator('#new-agent-api-url')).toBeVisible();
+ await expect(page.getByPlaceholder('Remote Docker Host')).toBeHidden();
+
+ await switchToEdgeMode(page);
+ await expect(page.locator('#new-agent-api-url')).toBeHidden();
+ await expect(page.getByPlaceholder('Remote Docker Host')).toBeVisible();
+
+ await page.getByRole('tab', { name: 'Direct', exact: true }).click();
+ await expect(page.locator('#new-agent-api-url')).toBeVisible();
+ await expect(page.getByPlaceholder('Remote Docker Host')).toBeHidden();
+ });
+
+ test('should validate required fields for edge and direct modes', async ({ page }) => {
+ await openNewEnvironmentSheet(page);
+ let createRequests = 0;
+
+ await page.route('**/api/environments', async (route) => {
+ if (route.request().method() === 'POST') {
+ createRequests += 1;
+ }
+ await route.continue();
+ });
+
+ // Direct mode: missing name and URL
+ await page.getByRole('button', { name: 'Generate Agent Configuration', exact: true }).click();
+ await expect.poll(() => createRequests).toBe(0);
+
+ // Edge mode: missing name
+ await switchToEdgeMode(page);
+ await page.getByRole('button', { name: 'Generate Agent Configuration', exact: true }).click();
+ await expect.poll(() => createRequests).toBe(0);
+ });
+
+ test('should create an edge agent environment and show deployment snippets', async ({ page }) => {
+ const environmentName = `edge-agent-${Date.now().toString().slice(-6)}`;
+ let createdEnvironmentId: string | null = null;
+
+ await page.route('**/api/environments', async (route) => {
+ if (route.request().method() === 'POST') {
+ const response = await route.fetch();
+ const body = await response.text();
+ try {
+ const parsed = JSON.parse(body);
+ createdEnvironmentId = parsed?.data?.id ?? parsed?.id ?? null;
+ } catch {
+ createdEnvironmentId = createdEnvironmentId ?? null;
+ }
+
+ await route.fulfill({
+ status: response.status(),
+ headers: response.headers(),
+ body
+ });
+ return;
+ }
+
+ await route.continue();
+ });
+
+ try {
+ await openNewEnvironmentSheet(page);
+ await switchToEdgeMode(page);
+
+ await page.getByPlaceholder('Remote Docker Host').fill(environmentName);
+ const submitButton = page.getByRole('button', {
+ name: 'Generate Agent Configuration',
+ exact: true
+ });
+ await submitButton.click();
+
+ const sheetTitle = page.locator('[data-slot="sheet-title"]');
+ await expect(sheetTitle).toContainText(/Environment Created/i);
+ await expect(
+ page.getByText('Edge agent - connects outbound to manager', { exact: true })
+ ).toBeVisible();
+ await expect(page.getByText('API Key', { exact: true })).toBeVisible();
+ await expect(page.getByText('Docker Run Command', { exact: true })).toBeVisible();
+ await expect(page.getByText('Docker Compose', { exact: true })).toBeVisible();
+
+ const snippetBlocks = page.locator('pre code').filter({ hasText: 'EDGE_AGENT=true' });
+ await expect(snippetBlocks.first()).toBeVisible();
+
+ const dockerRunSnippet = snippetBlocks.first();
+ await expect(dockerRunSnippet).toContainText('arcane-edge-agent');
+ await expect(dockerRunSnippet).not.toContainText('-p 3553:3553');
+
+ await page.getByRole('button', { name: 'Done', exact: true }).click();
+
+ await expect(page.getByRole('button', { name: environmentName, exact: true })).toBeVisible();
+ const environmentRow = page.locator('tr').filter({
+ has: page.getByRole('button', { name: environmentName, exact: true })
+ });
+ await expect(environmentRow.getByText('edge://edge-agent-').first()).toBeVisible();
+ await expect(environmentRow.getByText('Edge', { exact: true })).toBeVisible();
+
+ await page.getByRole('button', { name: environmentName, exact: true }).click();
+ if (createdEnvironmentId) {
+ await expect(page).toHaveURL(new RegExp(`/environments/${createdEnvironmentId}`));
+ }
+
+ await expect(page.locator('#api-url')).toHaveValue(/edge:\/\/edge-agent-/);
+ await expect(page.getByText('Edge', { exact: true }).first()).toBeVisible();
+ await expect(page.getByText('Live Tunnel', { exact: true })).toBeVisible();
+ } finally {
+ if (createdEnvironmentId) {
+ await page.request.delete(`/api/environments/${createdEnvironmentId}`);
+ }
+ }
+ });
});
diff --git a/tests/spec/environment-settings.spec.ts b/tests/spec/environment-settings.spec.ts
index aa1e8fd25..07a380b89 100644
--- a/tests/spec/environment-settings.spec.ts
+++ b/tests/spec/environment-settings.spec.ts
@@ -3,187 +3,192 @@ import { test, expect, type Locator, type Page } from '@playwright/test';
const LOCAL_ENV_ID = '0';
async function openEnvironment(page: Page, environmentId: string) {
- await page.goto(`/environments/${environmentId}`);
- await page.waitForLoadState('networkidle');
- await expect(page.locator('#env-name')).toBeVisible();
- await expect(page.getByRole('button', { name: 'Save', exact: true }).first()).toBeVisible();
+ await page.goto(`/environments/${environmentId}`);
+ await page.waitForLoadState('networkidle');
+ await expect(page.locator('#env-name')).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Save', exact: true }).first()).toBeVisible();
}
async function createDirectEnvironmentViaUI(page: Page, environmentName: string) {
- await page.goto('/environments');
- await page.waitForLoadState('networkidle');
+ await page.goto('/environments');
+ await page.waitForLoadState('networkidle');
- await page.getByRole('button', { name: 'Add Environment', exact: true }).click();
- await expect(page.getByText('Create New Agent Environment')).toBeVisible();
+ await page.getByRole('button', { name: 'Add Environment', exact: true }).click();
+ await expect(page.getByText('Create New Agent Environment')).toBeVisible();
- await page.locator('input#name:visible').first().fill(environmentName);
- await page.locator('#new-agent-api-url').fill('localhost:3552');
- await page.getByRole('button', { name: 'Generate Agent Configuration', exact: true }).click();
+ await page.locator('input#name:visible').first().fill(environmentName);
+ await page.locator('#new-agent-api-url').fill('localhost:3552');
+ await page.getByRole('button', { name: 'Generate Agent Configuration', exact: true }).click();
- await expect(page.locator('[data-slot="sheet-title"]')).toContainText(/Environment Created/i);
- await page.getByRole('button', { name: 'Done', exact: true }).click();
- await expect(page.getByRole('button', { name: environmentName, exact: true })).toBeVisible();
+ await expect(page.locator('[data-slot="sheet-title"]')).toContainText(/Environment Created/i);
+ await page.getByRole('button', { name: 'Done', exact: true }).click();
+ await expect(page.getByRole('button', { name: environmentName, exact: true })).toBeVisible();
}
async function deleteEnvironmentViaUI(page: Page, environmentName: string) {
- await page.goto('/environments');
- await page.waitForLoadState('networkidle');
+ await page.goto('/environments');
+ await page.waitForLoadState('networkidle');
- const envRow = page.locator('tr').filter({
- has: page.getByRole('button', { name: environmentName, exact: true }),
- });
+ const envRow = page.locator('tr').filter({
+ has: page.getByRole('button', { name: environmentName, exact: true })
+ });
- if ((await envRow.count()) === 0) {
- return;
- }
+ if ((await envRow.count()) === 0) {
+ return;
+ }
- await envRow.getByRole('button', { name: /open menu/i }).click();
- await page.getByRole('menuitem', { name: 'Delete', exact: true }).click();
- await page.getByRole('button', { name: 'Remove', exact: true }).click();
- await expect(page.getByRole('button', { name: environmentName, exact: true })).toHaveCount(0);
+ await envRow.getByRole('button', { name: /open menu/i }).click();
+ await page.getByRole('menuitem', { name: 'Delete', exact: true }).click();
+ await page.getByRole('button', { name: 'Remove', exact: true }).click();
+ await expect(page.getByRole('button', { name: environmentName, exact: true })).toHaveCount(0);
}
async function openLocalEnvironment(page: Page) {
- await openEnvironment(page, LOCAL_ENV_ID);
+ await openEnvironment(page, LOCAL_ENV_ID);
}
async function saveAndWaitForPut(page: Page, expectedPath: string) {
- const saveButton = page.getByRole('button', { name: 'Save', exact: true }).first();
- await expect(saveButton).toBeEnabled();
-
- const responsePromise = page.waitForResponse((response) => {
- const request = response.request();
- if (request.method() !== 'PUT') return false;
- const url = new URL(response.url());
- return url.pathname === expectedPath;
- });
-
- await saveButton.click();
- const response = await responsePromise;
- expect(response.ok(), `Expected successful PUT to ${expectedPath}`).toBeTruthy();
- await expect(saveButton).toBeDisabled({ timeout: 10000 });
+ const saveButton = page.getByRole('button', { name: 'Save', exact: true }).first();
+ await expect(saveButton).toBeEnabled();
+
+ const responsePromise = page.waitForResponse((response) => {
+ const request = response.request();
+ if (request.method() !== 'PUT') return false;
+ const url = new URL(response.url());
+ return url.pathname === expectedPath;
+ });
+
+ await saveButton.click();
+ const response = await responsePromise;
+ expect(response.ok(), `Expected successful PUT to ${expectedPath}`).toBeTruthy();
+ await expect(saveButton).toBeDisabled({ timeout: 10000 });
}
async function selectSettingOption(page: Page, trigger: Locator, optionText: string) {
- await expect(trigger).toBeVisible();
- await trigger.click();
- const option = page.locator('[data-slot="select-item"]').filter({ hasText: optionText }).first();
- await expect(option).toBeVisible();
- await option.click();
+ await expect(trigger).toBeVisible();
+ await trigger.click();
+ const option = page.locator('[data-slot="select-item"]').filter({ hasText: optionText }).first();
+ await expect(option).toBeVisible();
+ await option.click();
}
test.describe('Environment Settings UI', () => {
- test.describe.configure({ mode: 'serial' });
-
- test('should update and save environment details', async ({ page }) => {
- const envName = `settings-ui-${Date.now().toString().slice(-5)}`;
- const updatedName = `${envName}-updated`;
-
- try {
- await createDirectEnvironmentViaUI(page, envName);
- await page.getByRole('button', { name: envName, exact: true }).click();
- await expect(page).toHaveURL(/\/environments\/[^/]+$/);
-
- const environmentId = new URL(page.url()).pathname.split('/').pop()!;
- const nameInput = page.locator('#env-name');
- await nameInput.fill(updatedName);
- await saveAndWaitForPut(page, `/api/environments/${environmentId}`);
-
- await page.reload();
- await expect(page.locator('#env-name')).toHaveValue(updatedName);
- } finally {
- await deleteEnvironmentViaUI(page, updatedName);
- await deleteEnvironmentViaUI(page, envName);
- }
- });
-
- test('should update and save general environment settings', async ({ page }) => {
- await openLocalEnvironment(page);
- await page.getByRole('tab', { name: 'General', exact: true }).click();
-
- const baseServerUrlInput = page.locator('#base-server-url');
- await expect(baseServerUrlInput).toBeVisible();
-
- const originalBaseServerUrl = await baseServerUrlInput.inputValue();
- const updatedBaseServerUrl =
- originalBaseServerUrl.endsWith('/e2e') ? `${originalBaseServerUrl}-2` : `${originalBaseServerUrl}/e2e`;
-
- try {
- await baseServerUrlInput.fill(updatedBaseServerUrl);
- await expect(baseServerUrlInput).toHaveValue(updatedBaseServerUrl);
- await saveAndWaitForPut(page, `/api/environments/${LOCAL_ENV_ID}/settings`);
-
- await page.reload();
- await page.getByRole('tab', { name: 'General', exact: true }).click();
- await expect(page.locator('#base-server-url')).toHaveValue(updatedBaseServerUrl, {
- timeout: 15000,
- });
- } finally {
- if (!page.isClosed()) {
- await page.getByRole('tab', { name: 'General', exact: true }).click();
- const currentValue = await page.locator('#base-server-url').inputValue();
- if (currentValue !== originalBaseServerUrl) {
- await page.locator('#base-server-url').fill(originalBaseServerUrl);
- await saveAndWaitForPut(page, `/api/environments/${LOCAL_ENV_ID}/settings`);
- }
- }
- }
- });
-
- test('should reset unsaved environment detail changes', async ({ page }) => {
- await openLocalEnvironment(page);
-
- const nameInput = page.locator('#env-name');
- const originalName = await nameInput.inputValue();
- await nameInput.fill(`${originalName}-pending`);
-
- const saveButton = page.getByRole('button', { name: 'Save', exact: true }).first();
- const resetButton = page.getByRole('button', { name: 'Reset', exact: true }).first();
-
- await expect(saveButton).toBeEnabled();
- await expect(resetButton).toBeVisible();
- await resetButton.click();
-
- await expect(nameInput).toHaveValue(originalName);
- await expect(saveButton).toBeDisabled();
- });
-
- test('should update and save the default deploy pull policy in Docker settings', async ({ page }) => {
- await openLocalEnvironment(page);
-
- const dockerTab = page.getByRole('tab', { name: /Docker/i }).first();
- await dockerTab.click();
- const pullPolicyTrigger = page.locator('#defaultDeployPullPolicy');
- await expect(pullPolicyTrigger).toBeVisible();
-
- const originalValue = (await pullPolicyTrigger.textContent())?.trim() || 'Missing';
- const updatedValue = originalValue.includes('Always') ? 'Never' : 'Always';
-
- try {
- await selectSettingOption(page, pullPolicyTrigger, updatedValue);
- await expect(pullPolicyTrigger).toContainText(updatedValue);
- await saveAndWaitForPut(page, `/api/environments/${LOCAL_ENV_ID}/settings`);
-
- await page.reload();
- await page
- .getByRole('tab', { name: /Docker/i })
- .first()
- .click();
- await expect(page.locator('#defaultDeployPullPolicy')).toContainText(updatedValue, {
- timeout: 15000,
- });
- } finally {
- if (!page.isClosed()) {
- await page
- .getByRole('tab', { name: /Docker/i })
- .first()
- .click();
- const currentValue = ((await page.locator('#defaultDeployPullPolicy').textContent()) || '').trim();
- if (!currentValue.includes(originalValue)) {
- await selectSettingOption(page, page.locator('#defaultDeployPullPolicy'), originalValue);
- await saveAndWaitForPut(page, `/api/environments/${LOCAL_ENV_ID}/settings`);
- }
- }
- }
- });
+ test.describe.configure({ mode: 'serial' });
+
+ test('should update and save environment details', async ({ page }) => {
+ const envName = `settings-ui-${Date.now().toString().slice(-5)}`;
+ const updatedName = `${envName}-updated`;
+
+ try {
+ await createDirectEnvironmentViaUI(page, envName);
+ await page.getByRole('button', { name: envName, exact: true }).click();
+ await expect(page).toHaveURL(/\/environments\/[^/]+$/);
+
+ const environmentId = new URL(page.url()).pathname.split('/').pop()!;
+ const nameInput = page.locator('#env-name');
+ await nameInput.fill(updatedName);
+ await saveAndWaitForPut(page, `/api/environments/${environmentId}`);
+
+ await page.reload();
+ await expect(page.locator('#env-name')).toHaveValue(updatedName);
+ } finally {
+ await deleteEnvironmentViaUI(page, updatedName);
+ await deleteEnvironmentViaUI(page, envName);
+ }
+ });
+
+ test('should update and save general environment settings', async ({ page }) => {
+ await openLocalEnvironment(page);
+ await page.getByRole('tab', { name: 'General', exact: true }).click();
+
+ const baseServerUrlInput = page.locator('#base-server-url');
+ await expect(baseServerUrlInput).toBeVisible();
+
+ const originalBaseServerUrl = await baseServerUrlInput.inputValue();
+ const updatedBaseServerUrl = originalBaseServerUrl.endsWith('/e2e')
+ ? `${originalBaseServerUrl}-2`
+ : `${originalBaseServerUrl}/e2e`;
+
+ try {
+ await baseServerUrlInput.fill(updatedBaseServerUrl);
+ await expect(baseServerUrlInput).toHaveValue(updatedBaseServerUrl);
+ await saveAndWaitForPut(page, `/api/environments/${LOCAL_ENV_ID}/settings`);
+
+ await page.reload();
+ await page.getByRole('tab', { name: 'General', exact: true }).click();
+ await expect(page.locator('#base-server-url')).toHaveValue(updatedBaseServerUrl, {
+ timeout: 15000
+ });
+ } finally {
+ if (!page.isClosed()) {
+ await page.getByRole('tab', { name: 'General', exact: true }).click();
+ const currentValue = await page.locator('#base-server-url').inputValue();
+ if (currentValue !== originalBaseServerUrl) {
+ await page.locator('#base-server-url').fill(originalBaseServerUrl);
+ await saveAndWaitForPut(page, `/api/environments/${LOCAL_ENV_ID}/settings`);
+ }
+ }
+ }
+ });
+
+ test('should reset unsaved environment detail changes', async ({ page }) => {
+ await openLocalEnvironment(page);
+
+ const nameInput = page.locator('#env-name');
+ const originalName = await nameInput.inputValue();
+ await nameInput.fill(`${originalName}-pending`);
+
+ const saveButton = page.getByRole('button', { name: 'Save', exact: true }).first();
+ const resetButton = page.getByRole('button', { name: 'Reset', exact: true }).first();
+
+ await expect(saveButton).toBeEnabled();
+ await expect(resetButton).toBeVisible();
+ await resetButton.click();
+
+ await expect(nameInput).toHaveValue(originalName);
+ await expect(saveButton).toBeDisabled();
+ });
+
+ test('should update and save the default deploy pull policy in Docker settings', async ({
+ page
+ }) => {
+ await openLocalEnvironment(page);
+
+ const dockerTab = page.getByRole('tab', { name: /Docker/i }).first();
+ await dockerTab.click();
+ const pullPolicyTrigger = page.locator('#defaultDeployPullPolicy');
+ await expect(pullPolicyTrigger).toBeVisible();
+
+ const originalValue = (await pullPolicyTrigger.textContent())?.trim() || 'Missing';
+ const updatedValue = originalValue.includes('Always') ? 'Never' : 'Always';
+
+ try {
+ await selectSettingOption(page, pullPolicyTrigger, updatedValue);
+ await expect(pullPolicyTrigger).toContainText(updatedValue);
+ await saveAndWaitForPut(page, `/api/environments/${LOCAL_ENV_ID}/settings`);
+
+ await page.reload();
+ await page
+ .getByRole('tab', { name: /Docker/i })
+ .first()
+ .click();
+ await expect(page.locator('#defaultDeployPullPolicy')).toContainText(updatedValue, {
+ timeout: 15000
+ });
+ } finally {
+ if (!page.isClosed()) {
+ await page
+ .getByRole('tab', { name: /Docker/i })
+ .first()
+ .click();
+ const currentValue = (
+ (await page.locator('#defaultDeployPullPolicy').textContent()) || ''
+ ).trim();
+ if (!currentValue.includes(originalValue)) {
+ await selectSettingOption(page, page.locator('#defaultDeployPullPolicy'), originalValue);
+ await saveAndWaitForPut(page, `/api/environments/${LOCAL_ENV_ID}/settings`);
+ }
+ }
+ }
+ });
});
diff --git a/tests/spec/image-updates.spec.ts b/tests/spec/image-updates.spec.ts
index b46cd8de4..16d486311 100644
--- a/tests/spec/image-updates.spec.ts
+++ b/tests/spec/image-updates.spec.ts
@@ -1,368 +1,376 @@
-import { test, expect, type Page } from "@playwright/test";
-import { fetchImagesWithRetry } from "../utils/fetch.util";
+import { test, expect, type Page } from '@playwright/test';
+import { fetchImagesWithRetry } from '../utils/fetch.util';
const ROUTES = {
- page: "/images",
- apiImageUpdatesCheckBatch: "/api/environments/0/image-updates/check-batch",
- apiImageUpdatesCheckAll: "/api/environments/0/image-updates/check-all",
- apiImageUpdatesSummary: "/api/environments/0/image-updates/summary",
+ page: '/images',
+ apiImageUpdatesCheckBatch: '/api/environments/0/image-updates/check-batch',
+ apiImageUpdatesCheckAll: '/api/environments/0/image-updates/check-all',
+ apiImageUpdatesSummary: '/api/environments/0/image-updates/summary'
};
interface BatchUpdateResponse {
- success: boolean;
- data: Record<
- string,
- {
- hasUpdate: boolean;
- updateType: string;
- currentVersion?: string;
- latestVersion?: string;
- currentDigest?: string;
- latestDigest?: string;
- checkTime: string;
- responseTimeMs: number;
- error?: string;
- authMethod?: string;
- authUsername?: string;
- authRegistry?: string;
- usedCredential?: boolean;
- }
- >;
+ success: boolean;
+ data: Record<
+ string,
+ {
+ hasUpdate: boolean;
+ updateType: string;
+ currentVersion?: string;
+ latestVersion?: string;
+ currentDigest?: string;
+ latestDigest?: string;
+ checkTime: string;
+ responseTimeMs: number;
+ error?: string;
+ authMethod?: string;
+ authUsername?: string;
+ authRegistry?: string;
+ usedCredential?: boolean;
+ }
+ >;
}
interface UpdateSummary {
- success: boolean;
- data: {
- totalImages: number;
- imagesWithUpdates: number;
- digestUpdates: number;
- errorsCount: number;
- };
+ success: boolean;
+ data: {
+ totalImages: number;
+ imagesWithUpdates: number;
+ digestUpdates: number;
+ errorsCount: number;
+ };
}
async function navigateToImages(page: Page) {
- await page.goto(ROUTES.page);
- await page.waitForLoadState("networkidle");
+ await page.goto(ROUTES.page);
+ await page.waitForLoadState('networkidle');
}
async function fetchImagesTotal(page: Page, updatesFilter?: string): Promise<number> {
- const params = new URLSearchParams({ start: "0", limit: "1" });
- if (updatesFilter) {
- params.set("updates", updatesFilter);
- }
+ const params = new URLSearchParams({ start: '0', limit: '1' });
+ if (updatesFilter) {
+ params.set('updates', updatesFilter);
+ }
- const res = await page.request.get(`/api/environments/0/images?${params.toString()}`);
- expect(res.status()).toBe(200);
+ const res = await page.request.get(`/api/environments/0/images?${params.toString()}`);
+ expect(res.status()).toBe(200);
- const body = await res.json().catch(() => null as any);
- const totalItems = Number(body?.pagination?.totalItems ?? 0);
- return Number.isFinite(totalItems) ? totalItems : 0;
+ const body = await res.json().catch(() => null as any);
+ const totalItems = Number(body?.pagination?.totalItems ?? 0);
+ return Number.isFinite(totalItems) ? totalItems : 0;
}
let realImages: any[] = [];
test.beforeEach(async ({ page }) => {
- await navigateToImages(page);
-
- try {
- const images = await fetchImagesWithRetry(page);
- realImages = Array.isArray(images) ? images : [];
- } catch {
- realImages = [];
- }
+ await navigateToImages(page);
+
+ try {
+ const images = await fetchImagesWithRetry(page);
+ realImages = Array.isArray(images) ? images : [];
+ } catch {
+ realImages = [];
+ }
});
-test.describe("Image Update UI - Check All Updates Button", () => {
- test("should display the Check Updates button on images page", async ({ page }) => {
- await navigateToImages(page);
+test.describe('Image Update UI - Check All Updates Button', () => {
+ test('should display the Check Updates button on images page', async ({ page }) => {
+ await navigateToImages(page);
- // Find the Check Updates button - it might be directly visible or in a menu
- let checkUpdatesButton = page.getByRole("button", { name: "Check Updates" });
- const isDirectlyVisible = await checkUpdatesButton.isVisible().catch(() => false);
+ // Find the Check Updates button - it might be directly visible or in a menu
+ let checkUpdatesButton = page.getByRole('button', { name: 'Check Updates' });
+ const isDirectlyVisible = await checkUpdatesButton.isVisible().catch(() => false);
- if (!isDirectlyVisible) {
- // Try to find and click the overflow menu trigger
- const menuTrigger = page.getByRole("button", { name: "More actions" });
- await menuTrigger.click();
- checkUpdatesButton = page.getByRole("menuitem", { name: "Check Updates" });
- }
+ if (!isDirectlyVisible) {
+ // Try to find and click the overflow menu trigger
+ const menuTrigger = page.getByRole('button', { name: 'More actions' });
+ await menuTrigger.click();
+ checkUpdatesButton = page.getByRole('menuitem', { name: 'Check Updates' });
+ }
- await expect(checkUpdatesButton).toBeVisible();
- });
+ await expect(checkUpdatesButton).toBeVisible();
+ });
- test("should trigger bulk update check when clicking Check Updates button", async ({ page }) => {
- await navigateToImages(page);
+ test('should trigger bulk update check when clicking Check Updates button', async ({ page }) => {
+ await navigateToImages(page);
- // Find the Check Updates button - it might be directly visible or in a menu
- let checkUpdatesButton = page.getByRole("button", { name: "Check Updates" });
- const isDirectlyVisible = await checkUpdatesButton.isVisible().catch(() => false);
+ // Find the Check Updates button - it might be directly visible or in a menu
+ let checkUpdatesButton = page.getByRole('button', { name: 'Check Updates' });
+ const isDirectlyVisible = await checkUpdatesButton.isVisible().catch(() => false);
- if (!isDirectlyVisible) {
- // Try to find and click the overflow menu trigger
- const menuTrigger = page.getByRole("button", { name: "More actions" });
- await menuTrigger.click();
- checkUpdatesButton = page.getByRole("menuitem", { name: "Check Updates" });
- }
+ if (!isDirectlyVisible) {
+ // Try to find and click the overflow menu trigger
+ const menuTrigger = page.getByRole('button', { name: 'More actions' });
+ await menuTrigger.click();
+ checkUpdatesButton = page.getByRole('menuitem', { name: 'Check Updates' });
+ }
- await expect(checkUpdatesButton).toBeVisible();
+ await expect(checkUpdatesButton).toBeVisible();
- await checkUpdatesButton.click();
+ await checkUpdatesButton.click();
- if (isDirectlyVisible) {
- // If it's a direct button, it should show a loading state
- await expect(checkUpdatesButton).toContainText(/checking/i, { timeout: 10000 });
- }
+ if (isDirectlyVisible) {
+ // If it's a direct button, it should show a loading state
+ await expect(checkUpdatesButton).toContainText(/checking/i, { timeout: 10000 });
+ }
- // Eventually a success or completion toast should appear
- await expect(page.locator("li[data-sonner-toast]")).toBeVisible({ timeout: 60000 });
- });
+ // Eventually a success or completion toast should appear
+ await expect(page.locator('li[data-sonner-toast]')).toBeVisible({ timeout: 60000 });
+ });
});
-test.describe("Image Update UI - Individual Image Update Check via Hover Card", () => {
- test("should display update status icons in the images table", async ({ page }) => {
- test.skip(!realImages.length, "No images available");
-
- await navigateToImages(page);
-
- // Wait for the table to load
- await expect(page.locator("table")).toBeVisible();
-
- // Check that image rows exist
- const rows = page.locator("tbody tr");
- await expect(rows.first()).toBeVisible();
- });
-
- test("should show hover card tooltip when hovering over update status icon", async ({ page }) => {
- test.skip(!realImages.length, "No images available");
-
- await navigateToImages(page);
-
- // Wait for images table
- await expect(page.locator("table")).toBeVisible();
-
- // Find the first row's update status area (the Updates column)
- const firstRow = page.locator("tbody tr").first();
- await expect(firstRow).toBeVisible();
-
- // Look for the update status icon trigger element (Tooltip.Trigger wraps a span)
- const updateStatusTrigger = firstRow.locator('[data-testid="image-update-trigger"]').first();
- const hasTrigger = await updateStatusTrigger.isVisible().catch(() => false);
-
- if (hasTrigger) {
- // Hover to trigger tooltip
- await updateStatusTrigger.hover();
-
- // Wait for tooltip content to appear
- await page.waitForTimeout(500);
-
- // Check if tooltip/hover card content appeared
- const tooltipContent = page.locator('[data-radix-popper-content-wrapper], [role="tooltip"]');
- const tooltipVisible = await tooltipContent.isVisible().catch(() => false);
-
- // The hover card should be visible after hovering
- if (tooltipVisible) {
- await expect(tooltipContent).toBeVisible();
- }
- }
- });
-
- test("should allow triggering individual image update check from hover card", async ({ page }) => {
- test.skip(!realImages.length, "No images available");
-
- // Find an image with valid repo/tag for update checking
- const testImage = realImages.find((img) => img.repo && img.tag && img.repo !== "<none>" && img.tag !== "<none>");
- test.skip(!testImage, "No suitable image found for update check");
-
- await navigateToImages(page);
- await expect(page.locator("table")).toBeVisible();
-
- // Find the row for our test image or the first row with a valid image
- const rows = page.locator("tbody tr");
- const firstRow = rows.first();
- await expect(firstRow).toBeVisible();
-
- // Look for the update status trigger (could be a button or icon)
- const updateTrigger = firstRow.locator('[data-testid="image-update-trigger"]').first();
- const hasUpdateTrigger = await updateTrigger.isVisible().catch(() => false);
-
- if (hasUpdateTrigger) {
- // If it's a clickable button (for unchecked images), click it
- const updateButton = updateTrigger.locator("button").first();
- const hasButton = await updateButton.isVisible().catch(() => false);
-
- if (hasButton) {
- await updateButton.click();
-
- // Wait for checking to complete (either a toast or state change)
- await expect(async () => {
- const toast = page.locator("li[data-sonner-toast]");
- const toastVisible = await toast.isVisible().catch(() => false);
- expect(toastVisible).toBeTruthy();
- }).toPass({ timeout: 30000 });
- } else {
- // If it's an icon, hover to show the tooltip with recheck button
- await updateTrigger.hover();
- await page.waitForTimeout(500);
-
- // Look for the recheck button in the tooltip
- const recheckButton = page.locator('[data-radix-popper-content-wrapper] button, [role="tooltip"] button').first();
- const hasRecheckButton = await recheckButton.isVisible().catch(() => false);
-
- if (hasRecheckButton) {
- await recheckButton.click();
-
- // Wait for the check to complete
- await expect(async () => {
- const toast = page.locator("li[data-sonner-toast]");
- const toastVisible = await toast.isVisible().catch(() => false);
- expect(toastVisible).toBeTruthy();
- }).toPass({ timeout: 30000 });
- }
- }
- }
- });
+test.describe('Image Update UI - Individual Image Update Check via Hover Card', () => {
+ test('should display update status icons in the images table', async ({ page }) => {
+ test.skip(!realImages.length, 'No images available');
+
+ await navigateToImages(page);
+
+ // Wait for the table to load
+ await expect(page.locator('table')).toBeVisible();
+
+ // Check that image rows exist
+ const rows = page.locator('tbody tr');
+ await expect(rows.first()).toBeVisible();
+ });
+
+ test('should show hover card tooltip when hovering over update status icon', async ({ page }) => {
+ test.skip(!realImages.length, 'No images available');
+
+ await navigateToImages(page);
+
+ // Wait for images table
+ await expect(page.locator('table')).toBeVisible();
+
+ // Find the first row's update status area (the Updates column)
+ const firstRow = page.locator('tbody tr').first();
+ await expect(firstRow).toBeVisible();
+
+ // Look for the update status icon trigger element (Tooltip.Trigger wraps a span)
+ const updateStatusTrigger = firstRow.locator('[data-testid="image-update-trigger"]').first();
+ const hasTrigger = await updateStatusTrigger.isVisible().catch(() => false);
+
+ if (hasTrigger) {
+ // Hover to trigger tooltip
+ await updateStatusTrigger.hover();
+
+ // Wait for tooltip content to appear
+ await page.waitForTimeout(500);
+
+ // Check if tooltip/hover card content appeared
+ const tooltipContent = page.locator('[data-radix-popper-content-wrapper], [role="tooltip"]');
+ const tooltipVisible = await tooltipContent.isVisible().catch(() => false);
+
+ // The hover card should be visible after hovering
+ if (tooltipVisible) {
+ await expect(tooltipContent).toBeVisible();
+ }
+ }
+ });
+
+ test('should allow triggering individual image update check from hover card', async ({
+ page
+ }) => {
+ test.skip(!realImages.length, 'No images available');
+
+ // Find an image with valid repo/tag for update checking
+ const testImage = realImages.find(
+ (img) => img.repo && img.tag && img.repo !== '<none>' && img.tag !== '<none>'
+ );
+ test.skip(!testImage, 'No suitable image found for update check');
+
+ await navigateToImages(page);
+ await expect(page.locator('table')).toBeVisible();
+
+ // Find the row for our test image or the first row with a valid image
+ const rows = page.locator('tbody tr');
+ const firstRow = rows.first();
+ await expect(firstRow).toBeVisible();
+
+ // Look for the update status trigger (could be a button or icon)
+ const updateTrigger = firstRow.locator('[data-testid="image-update-trigger"]').first();
+ const hasUpdateTrigger = await updateTrigger.isVisible().catch(() => false);
+
+ if (hasUpdateTrigger) {
+ // If it's a clickable button (for unchecked images), click it
+ const updateButton = updateTrigger.locator('button').first();
+ const hasButton = await updateButton.isVisible().catch(() => false);
+
+ if (hasButton) {
+ await updateButton.click();
+
+ // Wait for checking to complete (either a toast or state change)
+ await expect(async () => {
+ const toast = page.locator('li[data-sonner-toast]');
+ const toastVisible = await toast.isVisible().catch(() => false);
+ expect(toastVisible).toBeTruthy();
+ }).toPass({ timeout: 30000 });
+ } else {
+ // If it's an icon, hover to show the tooltip with recheck button
+ await updateTrigger.hover();
+ await page.waitForTimeout(500);
+
+ // Look for the recheck button in the tooltip
+ const recheckButton = page
+ .locator('[data-radix-popper-content-wrapper] button, [role="tooltip"] button')
+ .first();
+ const hasRecheckButton = await recheckButton.isVisible().catch(() => false);
+
+ if (hasRecheckButton) {
+ await recheckButton.click();
+
+ // Wait for the check to complete
+ await expect(async () => {
+ const toast = page.locator('li[data-sonner-toast]');
+ const toastVisible = await toast.isVisible().catch(() => false);
+ expect(toastVisible).toBeTruthy();
+ }).toPass({ timeout: 30000 });
+ }
+ }
+ }
+ });
});
-test.describe("Image Update API Endpoints", () => {
- test("should check batch image updates via API", async ({ page }) => {
- const imageRefs = ["nginx:latest", "alpine:latest"];
-
- const res = await page.request.post(ROUTES.apiImageUpdatesCheckBatch, {
- data: {
- imageRefs,
- },
- });
-
- expect(res.status()).toBe(200);
-
- const json = (await res.json()) as BatchUpdateResponse;
- expect(json.success).toBe(true);
- expect(json.data).toBeDefined();
- expect(typeof json.data).toBe("object");
- });
-
- test("should check all images for updates via API", async ({ page }) => {
- const res = await page.request.post(ROUTES.apiImageUpdatesCheckAll, {
- data: {},
- });
-
- expect(res.status()).toBe(200);
-
- const json = (await res.json()) as BatchUpdateResponse;
- expect(json.success).toBe(true);
- expect(json.data).toBeDefined();
- });
-
- test("should get update summary via API", async ({ page }) => {
- const res = await page.request.get(ROUTES.apiImageUpdatesSummary);
-
- expect(res.status()).toBe(200);
-
- const json = (await res.json()) as UpdateSummary;
- expect(json.success).toBe(true);
- expect(json.data).toBeDefined();
- expect(typeof json.data.totalImages).toBe("number");
- expect(typeof json.data.imagesWithUpdates).toBe("number");
- expect(typeof json.data.digestUpdates).toBe("number");
- expect(typeof json.data.errorsCount).toBe("number");
-
- const [imagesTotal, hasUpdateTotal] = await Promise.all([
- fetchImagesTotal(page),
- fetchImagesTotal(page, "has_update"),
- ]);
-
- expect(json.data.totalImages).toBe(imagesTotal);
- expect(json.data.imagesWithUpdates).toBe(hasUpdateTotal);
- });
+test.describe('Image Update API Endpoints', () => {
+ test('should check batch image updates via API', async ({ page }) => {
+ const imageRefs = ['nginx:latest', 'alpine:latest'];
+
+ const res = await page.request.post(ROUTES.apiImageUpdatesCheckBatch, {
+ data: {
+ imageRefs
+ }
+ });
+
+ expect(res.status()).toBe(200);
+
+ const json = (await res.json()) as BatchUpdateResponse;
+ expect(json.success).toBe(true);
+ expect(json.data).toBeDefined();
+ expect(typeof json.data).toBe('object');
+ });
+
+ test('should check all images for updates via API', async ({ page }) => {
+ const res = await page.request.post(ROUTES.apiImageUpdatesCheckAll, {
+ data: {}
+ });
+
+ expect(res.status()).toBe(200);
+
+ const json = (await res.json()) as BatchUpdateResponse;
+ expect(json.success).toBe(true);
+ expect(json.data).toBeDefined();
+ });
+
+ test('should get update summary via API', async ({ page }) => {
+ const res = await page.request.get(ROUTES.apiImageUpdatesSummary);
+
+ expect(res.status()).toBe(200);
+
+ const json = (await res.json()) as UpdateSummary;
+ expect(json.success).toBe(true);
+ expect(json.data).toBeDefined();
+ expect(typeof json.data.totalImages).toBe('number');
+ expect(typeof json.data.imagesWithUpdates).toBe('number');
+ expect(typeof json.data.digestUpdates).toBe('number');
+ expect(typeof json.data.errorsCount).toBe('number');
+
+ const [imagesTotal, hasUpdateTotal] = await Promise.all([
+ fetchImagesTotal(page),
+ fetchImagesTotal(page, 'has_update')
+ ]);
+
+ expect(json.data.totalImages).toBe(imagesTotal);
+ expect(json.data.imagesWithUpdates).toBe(hasUpdateTotal);
+ });
});
-test.describe("Image Update UI Integration", () => {
- test("should display update status icon in images table", async ({ page }) => {
- test.skip(!realImages.length, "No images available");
+test.describe('Image Update UI Integration', () => {
+ test('should display update status icon in images table', async ({ page }) => {
+ test.skip(!realImages.length, 'No images available');
- await navigateToImages(page);
+ await navigateToImages(page);
- // Wait for the table to load
- await expect(page.locator("table")).toBeVisible();
+ // Wait for the table to load
+ await expect(page.locator('table')).toBeVisible();
- // Check that image rows exist
- const rows = page.locator("tbody tr");
- await expect(rows.first()).toBeVisible();
- });
+ // Check that image rows exist
+ const rows = page.locator('tbody tr');
+ await expect(rows.first()).toBeVisible();
+ });
- test("should display update information in image detail page", async ({ page }) => {
- test.skip(!realImages.length, "No images available");
+ test('should display update information in image detail page', async ({ page }) => {
+ test.skip(!realImages.length, 'No images available');
- const testImage = realImages.find((img) => img.repoTags?.[0] && !img.repoTags[0].includes("<none>"));
- test.skip(!testImage, "No suitable image found");
+ const testImage = realImages.find(
+ (img) => img.repoTags?.[0] && !img.repoTags[0].includes('<none>')
+ );
+ test.skip(!testImage, 'No suitable image found');
- // Navigate to image detail
- await page.goto(`/images/${encodeURIComponent(testImage.id)}`);
- await page.waitForLoadState("networkidle");
+ // Navigate to image detail
+ await page.goto(`/images/${encodeURIComponent(testImage.id)}`);
+ await page.waitForLoadState('networkidle');
- // The detail page should load
- await expect(page.locator('h1, h2, [data-testid="image-detail"]').first()).toBeVisible({
- timeout: 10000,
- });
- });
+ // The detail page should load
+ await expect(page.locator('h1, h2, [data-testid="image-detail"]').first()).toBeVisible({
+ timeout: 10000
+ });
+ });
});
-test.describe("Batch Update Checks", () => {
- test("should handle empty batch request", async ({ page }) => {
- const res = await page.request.post(ROUTES.apiImageUpdatesCheckBatch, {
- data: {
- imageRefs: [],
- },
- });
+test.describe('Batch Update Checks', () => {
+ test('should handle empty batch request', async ({ page }) => {
+ const res = await page.request.post(ROUTES.apiImageUpdatesCheckBatch, {
+ data: {
+ imageRefs: []
+ }
+ });
- expect(res.status()).toBe(200);
+ expect(res.status()).toBe(200);
- const json = (await res.json()) as BatchUpdateResponse;
- expect(json.success).toBe(true);
- expect(Object.keys(json.data).length).toBe(0);
- });
+ const json = (await res.json()) as BatchUpdateResponse;
+ expect(json.success).toBe(true);
+ expect(Object.keys(json.data).length).toBe(0);
+ });
- test("should return results for each image in batch", async ({ page }) => {
- const imageRefs = ["nginx:latest", "alpine:latest", "busybox:latest"];
+ test('should return results for each image in batch', async ({ page }) => {
+ const imageRefs = ['nginx:latest', 'alpine:latest', 'busybox:latest'];
- const res = await page.request.post(ROUTES.apiImageUpdatesCheckBatch, {
- data: {
- imageRefs,
- },
- });
+ const res = await page.request.post(ROUTES.apiImageUpdatesCheckBatch, {
+ data: {
+ imageRefs
+ }
+ });
- expect(res.status()).toBe(200);
+ expect(res.status()).toBe(200);
- const json = (await res.json()) as BatchUpdateResponse;
- expect(json.success).toBe(true);
+ const json = (await res.json()) as BatchUpdateResponse;
+ expect(json.success).toBe(true);
- // Each requested image should have a result
- for (const ref of imageRefs) {
- expect(json.data[ref]).toBeDefined();
- }
- });
+ // Each requested image should have a result
+ for (const ref of imageRefs) {
+ expect(json.data[ref]).toBeDefined();
+ }
+ });
- test("should handle mixed valid and invalid images in batch", async ({ page }) => {
- const imageRefs = ["nginx:latest", "invalid-registry.example.com/nonexistent:latest"];
+ test('should handle mixed valid and invalid images in batch', async ({ page }) => {
+ const imageRefs = ['nginx:latest', 'invalid-registry.example.com/nonexistent:latest'];
- const res = await page.request.post(ROUTES.apiImageUpdatesCheckBatch, {
- data: {
- imageRefs,
- },
- });
+ const res = await page.request.post(ROUTES.apiImageUpdatesCheckBatch, {
+ data: {
+ imageRefs
+ }
+ });
- expect(res.status()).toBe(200);
+ expect(res.status()).toBe(200);
- const json = (await res.json()) as BatchUpdateResponse;
- expect(json.success).toBe(true);
+ const json = (await res.json()) as BatchUpdateResponse;
+ expect(json.success).toBe(true);
- // nginx should succeed
- expect(json.data["nginx:latest"]).toBeDefined();
+ // nginx should succeed
+ expect(json.data['nginx:latest']).toBeDefined();
- // Invalid image should have an error
- const invalidResult = json.data["invalid-registry.example.com/nonexistent:latest"];
- if (invalidResult) {
- expect(invalidResult.error || invalidResult.hasUpdate === false).toBeTruthy();
- }
- });
+ // Invalid image should have an error
+ const invalidResult = json.data['invalid-registry.example.com/nonexistent:latest'];
+ if (invalidResult) {
+ expect(invalidResult.error || invalidResult.hasUpdate === false).toBeTruthy();
+ }
+ });
});
diff --git a/tests/spec/images.spec.ts b/tests/spec/images.spec.ts
index 28a963679..087e333c9 100644
--- a/tests/spec/images.spec.ts
+++ b/tests/spec/images.spec.ts
@@ -3,188 +3,211 @@ import { fetchImageCountsWithRetry, fetchImagesWithRetry } from '../utils/fetch.
import { ImageUsageCounts } from 'types/image.type';
const ROUTES = {
- page: '/images',
- apiImages: '/api/environments/0/images',
+ page: '/images',
+ apiImages: '/api/environments/0/images'
};
async function navigateToImages(page: Page) {
- await page.goto(ROUTES.page);
- await page.waitForLoadState('networkidle');
+ await page.goto(ROUTES.page);
+ await page.waitForLoadState('networkidle');
}
async function fetchAllImagesForUsage(page: Page): Promise<any[]> {
- const limit = 200;
- let start = 0;
- const all: any[] = [];
+ const limit = 200;
+ let start = 0;
+ const all: any[] = [];
- while (true) {
- const res = await page.request.get(`${ROUTES.apiImages}?start=${start}&limit=${limit}`);
- if (!res.ok()) {
- throw new Error(`HTTP ${res.status()}`);
- }
+ while (true) {
+ const res = await page.request.get(`${ROUTES.apiImages}?start=${start}&limit=${limit}`);
+ if (!res.ok()) {
+ throw new Error(`HTTP ${res.status()}`);
+ }
- const body = await res.json().catch(() => null as any);
- const data = Array.isArray(body?.data) ? body.data : [];
- all.push(...data);
+ const body = await res.json().catch(() => null as any);
+ const data = Array.isArray(body?.data) ? body.data : [];
+ all.push(...data);
- const totalItems = Number(body?.pagination?.totalItems ?? all.length);
- if (data.length === 0 || all.length >= totalItems) {
- break;
- }
+ const totalItems = Number(body?.pagination?.totalItems ?? all.length);
+ if (data.length === 0 || all.length >= totalItems) {
+ break;
+ }
- start += limit;
- }
+ start += limit;
+ }
- return all;
+ return all;
}
let realImages: any[] = [];
-let imageCounts: ImageUsageCounts = { imagesInuse: 0, imagesUnused: 0, totalImages: 0, totalImageSize: 0 };
+let imageCounts: ImageUsageCounts = {
+ imagesInuse: 0,
+ imagesUnused: 0,
+ totalImages: 0,
+ totalImageSize: 0
+};
test.beforeEach(async ({ page }) => {
- await navigateToImages(page);
-
- try {
- const images = await fetchImagesWithRetry(page);
- realImages = Array.isArray(images) ? images : [];
- imageCounts = await fetchImageCountsWithRetry(page);
- } catch {
- realImages = [];
- }
+ await navigateToImages(page);
+
+ try {
+ const images = await fetchImagesWithRetry(page);
+ realImages = Array.isArray(images) ? images : [];
+ imageCounts = await fetchImageCountsWithRetry(page);
+ } catch {
+ realImages = [];
+ }
});
test.describe('Images Page', () => {
- test('should display the images page title and description', async ({ page }) => {
- await navigateToImages(page);
-
- await expect(page.getByRole('heading', { name: 'Images', level: 1 })).toBeVisible();
- await expect(page.getByText('View and Manage your Container images').first()).toBeVisible();
- });
-
- test('should display stats cards with correct counts and size', async ({ page }) => {
- await navigateToImages(page);
-
- await expect(page.getByText(`${imageCounts.totalImages} Total Images`)).toBeVisible();
- await expect(page.getByText(/Total Size/i)).toBeVisible();
- });
-
- test('should align /images/counts with usage derived from /images list', async ({ page }) => {
- await navigateToImages(page);
-
- const allImages = await fetchAllImagesForUsage(page);
- const derivedInUse = allImages.filter((img) => !!img.inUse).length;
- const derivedUnused = allImages.length - derivedInUse;
-
- expect(imageCounts.totalImages).toBe(allImages.length);
- expect(imageCounts.imagesInuse).toBe(derivedInUse);
- expect(imageCounts.imagesUnused).toBe(derivedUnused);
- });
-
- test('should display the image table when images exist', async ({ page }) => {
- await navigateToImages(page);
-
- await expect(page.locator('table')).toBeVisible();
- await expect(page.getByRole('button', { name: 'Repository' })).toBeVisible();
- });
-
- test('should open the Pull Image dialog', async ({ page }) => {
- await navigateToImages(page);
- await page.getByRole('button', { name: 'Pull Image' }).click();
- await expect(page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Pull Image")')).toBeVisible();
- });
-
- test('should open the Prune Unused Images dialog', async ({ page }) => {
- await navigateToImages(page);
-
- let pruneButton = page.getByRole('button', { name: 'Prune Unused' });
- const isDirectlyVisible = await pruneButton.isVisible().catch(() => false);
-
- if (!isDirectlyVisible) {
- await page.getByRole('button', { name: 'More actions' }).click();
- pruneButton = page.getByRole('menuitem', { name: 'Prune Unused' });
- }
-
- await pruneButton.click();
- await expect(
- page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Prune Unused Images")'),
- ).toBeVisible();
- });
-
- test('should navigate to image details on inspect click', async ({ page }) => {
- await navigateToImages(page);
-
- const firstRow = page.locator('tbody tr').first();
- await firstRow.getByRole('button', { name: 'Open menu' }).click();
- await page.getByRole('menuitem', { name: 'Inspect' }).click();
- });
-
- test('should pull image from dropdown menu', async ({ page }) => {
- test.skip(!realImages.length, 'No images available for pull API test');
- await navigateToImages(page);
-
- const firstRow = await page.getByRole('cell', { name: 'Open menu' }).first();
- await firstRow.getByRole('button', { name: 'Open menu' }).click();
- await page.getByRole('menuitem', { name: 'Pull' }).click();
-
- await page.waitForLoadState('networkidle');
+ test('should display the images page title and description', async ({ page }) => {
+ await navigateToImages(page);
+
+ await expect(page.getByRole('heading', { name: 'Images', level: 1 })).toBeVisible();
+ await expect(page.getByText('View and Manage your Container images').first()).toBeVisible();
+ });
+
+ test('should display stats cards with correct counts and size', async ({ page }) => {
+ await navigateToImages(page);
+
+ await expect(page.getByText(`${imageCounts.totalImages} Total Images`)).toBeVisible();
+ await expect(page.getByText(/Total Size/i)).toBeVisible();
+ });
+
+ test('should align /images/counts with usage derived from /images list', async ({ page }) => {
+ await navigateToImages(page);
+
+ const allImages = await fetchAllImagesForUsage(page);
+ const derivedInUse = allImages.filter((img) => !!img.inUse).length;
+ const derivedUnused = allImages.length - derivedInUse;
+
+ expect(imageCounts.totalImages).toBe(allImages.length);
+ expect(imageCounts.imagesInuse).toBe(derivedInUse);
+ expect(imageCounts.imagesUnused).toBe(derivedUnused);
+ });
+
+ test('should display the image table when images exist', async ({ page }) => {
+ await navigateToImages(page);
+
+ await expect(page.locator('table')).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Repository' })).toBeVisible();
+ });
+
+ test('should open the Pull Image dialog', async ({ page }) => {
+ await navigateToImages(page);
+ await page.getByRole('button', { name: 'Pull Image' }).click();
+ await expect(
+ page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Pull Image")')
+ ).toBeVisible();
+ });
+
+ test('should open the Prune Unused Images dialog', async ({ page }) => {
+ await navigateToImages(page);
+
+ let pruneButton = page.getByRole('button', { name: 'Prune Unused' });
+ const isDirectlyVisible = await pruneButton.isVisible().catch(() => false);
- await expect(page.locator(`li[data-sonner-toast][data-type="success"] div[data-title]`)).toBeVisible();
- });
+ if (!isDirectlyVisible) {
+ await page.getByRole('button', { name: 'More actions' }).click();
+ pruneButton = page.getByRole('menuitem', { name: 'Prune Unused' });
+ }
- test('should call remove API on row action remove click and confirmation', async ({ page }) => {
- test.skip(!realImages.length, 'No images available for remove API test');
- await navigateToImages(page);
+ await pruneButton.click();
+ await expect(
+ page.locator(
+ 'div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Prune Unused Images")'
+ )
+ ).toBeVisible();
+ });
- const deleteableImage = realImages.find((img) => img.repoTags?.[0]?.includes('ghcr.io/linuxserver/radarr'));
- test.skip(!deleteableImage, 'No deletable images available');
+ test('should navigate to image details on inspect click', async ({ page }) => {
+ await navigateToImages(page);
- const firstRow = await page.getByRole('row', { name: 'ghcr.io/linuxserver/radarr' });
- await firstRow.getByRole('button', { name: 'Open menu' }).click();
- await page.getByRole('menuitem', { name: 'Remove' }).click();
+ const firstRow = page.locator('tbody tr').first();
+ await firstRow.getByRole('button', { name: 'Open menu' }).click();
+ await page.getByRole('menuitem', { name: 'Inspect' }).click();
+ });
- await expect(page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Remove Image")')).toBeVisible();
+ test('should pull image from dropdown menu', async ({ page }) => {
+ test.skip(!realImages.length, 'No images available for pull API test');
+ await navigateToImages(page);
- await page.locator('button:has-text("Remove")').click();
+ const firstRow = await page.getByRole('cell', { name: 'Open menu' }).first();
+ await firstRow.getByRole('button', { name: 'Open menu' }).click();
+ await page.getByRole('menuitem', { name: 'Pull' }).click();
- await expect(page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')).toBeVisible();
- });
+ await page.waitForLoadState('networkidle');
- test('should call prune API on prune click and confirmation', async ({ page }) => {
- await navigateToImages(page);
+ await expect(
+ page.locator(`li[data-sonner-toast][data-type="success"] div[data-title]`)
+ ).toBeVisible();
+ });
- let pruneButton = page.getByRole('button', { name: 'Prune Unused' });
- const isDirectlyVisible = await pruneButton.isVisible().catch(() => false);
+ test('should call remove API on row action remove click and confirmation', async ({ page }) => {
+ test.skip(!realImages.length, 'No images available for remove API test');
+ await navigateToImages(page);
- if (!isDirectlyVisible) {
- await page.getByRole('button', { name: 'More actions' }).click();
- pruneButton = page.getByRole('menuitem', { name: 'Prune Unused' });
- }
+ const deleteableImage = realImages.find((img) =>
+ img.repoTags?.[0]?.includes('ghcr.io/linuxserver/radarr')
+ );
+ test.skip(!deleteableImage, 'No deletable images available');
- await pruneButton.click();
+ const firstRow = await page.getByRole('row', { name: 'ghcr.io/linuxserver/radarr' });
+ await firstRow.getByRole('button', { name: 'Open menu' }).click();
+ await page.getByRole('menuitem', { name: 'Remove' }).click();
- await expect(
- page.locator('div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Prune Unused Images")'),
- ).toBeVisible();
+ await expect(
+ page.locator(
+ 'div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Remove Image")'
+ )
+ ).toBeVisible();
- await page.locator('button:has-text("Prune Images")').click();
+ await page.locator('button:has-text("Remove")').click();
+
+ await expect(
+ page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')
+ ).toBeVisible();
+ });
- await expect(page.locator(`li[data-sonner-toast][data-type="success"] div[data-title]:has-text("pruned")`)).toBeVisible({
- timeout: 10000,
- });
- });
+ test('should call prune API on prune click and confirmation', async ({ page }) => {
+ await navigateToImages(page);
+
+ let pruneButton = page.getByRole('button', { name: 'Prune Unused' });
+ const isDirectlyVisible = await pruneButton.isVisible().catch(() => false);
+
+ if (!isDirectlyVisible) {
+ await page.getByRole('button', { name: 'More actions' }).click();
+ pruneButton = page.getByRole('menuitem', { name: 'Prune Unused' });
+ }
+
+ await pruneButton.click();
+
+ await expect(
+ page.locator(
+ 'div[role="heading"][aria-level="2"][data-dialog-title]:has-text("Prune Unused Images")'
+ )
+ ).toBeVisible();
+
+ await page.locator('button:has-text("Prune Images")').click();
+
+ await expect(
+ page.locator(`li[data-sonner-toast][data-type="success"] div[data-title]:has-text("pruned")`)
+ ).toBeVisible({
+ timeout: 10000
+ });
+ });
- test('should pull image via form', async ({ page }) => {
- await navigateToImages(page);
+ test('should pull image via form', async ({ page }) => {
+ await navigateToImages(page);
- await page.getByRole('button', { name: 'Pull Image' }).click();
- const dialogHeading = page.getByRole('heading', { name: 'Pull Image' });
- await expect(dialogHeading).toBeVisible();
+ await page.getByRole('button', { name: 'Pull Image' }).click();
+ const dialogHeading = page.getByRole('heading', { name: 'Pull Image' });
+ await expect(dialogHeading).toBeVisible();
- await page.getByRole('textbox', { name: 'Image Name *' }).fill('ghcr.io/linuxserver/nginx');
- await page.getByRole('textbox', { name: 'Tag' }).fill('1.28.0');
+ await page.getByRole('textbox', { name: 'Image Name *' }).fill('ghcr.io/linuxserver/nginx');
+ await page.getByRole('textbox', { name: 'Tag' }).fill('1.28.0');
- await page.getByRole('button', { name: 'Pull', exact: true }).click();
+ await page.getByRole('button', { name: 'Pull', exact: true }).click();
- await expect(dialogHeading).toBeHidden({ timeout: 120_000 });
- });
+ await expect(dialogHeading).toBeHidden({ timeout: 120_000 });
+ });
});
diff --git a/tests/spec/network.spec.ts b/tests/spec/network.spec.ts
index 5bfd9fb5c..43610f0ca 100644
--- a/tests/spec/network.spec.ts
+++ b/tests/spec/network.spec.ts
@@ -2,171 +2,179 @@ import { test, expect, type Page } from '@playwright/test';
import { fetchNetworksCountsWithRetry } from '../utils/fetch.util';
async function navigateToNetworks(page: Page) {
- await page.goto('/networks');
- await page.waitForLoadState('networkidle');
+ await page.goto('/networks');
+ await page.waitForLoadState('networkidle');
}
test.beforeEach(async ({ page }) => {
- await navigateToNetworks(page);
+ await navigateToNetworks(page);
});
async function createNetworkViaUI(page: Page, networkName: string) {
- await navigateToNetworks(page);
- await page.getByRole('button', { name: 'Create Network' }).first().click();
- await expect(page.getByRole('dialog')).toBeVisible();
- await expect(page.getByRole('heading', { name: 'Create New Network' })).toBeVisible();
- await page.locator('#network-name').fill(networkName);
-
- const createRequest = page.waitForResponse(
- (response) => {
- const request = response.request();
- if (request.method() !== 'POST') return false;
- return /\/api\/environments\/[^/]+\/networks$/.test(new URL(response.url()).pathname);
- },
- { timeout: 15000 },
- );
-
- await page.getByRole('dialog').getByRole('button', { name: 'Create Network' }).click();
- const createResponse = await createRequest;
- if (!createResponse.ok()) {
- const responseText = await createResponse.text().catch(() => '');
- throw new Error(`Failed to create network ${networkName}: ${createResponse.status()} ${responseText}`);
- }
-
- await navigateToNetworks(page);
- await expect(await findNetworkRow(page, networkName, 15)).toBeVisible();
+ await navigateToNetworks(page);
+ await page.getByRole('button', { name: 'Create Network' }).first().click();
+ await expect(page.getByRole('dialog')).toBeVisible();
+ await expect(page.getByRole('heading', { name: 'Create New Network' })).toBeVisible();
+ await page.locator('#network-name').fill(networkName);
+
+ const createRequest = page.waitForResponse(
+ (response) => {
+ const request = response.request();
+ if (request.method() !== 'POST') return false;
+ return /\/api\/environments\/[^/]+\/networks$/.test(new URL(response.url()).pathname);
+ },
+ { timeout: 15000 }
+ );
+
+ await page.getByRole('dialog').getByRole('button', { name: 'Create Network' }).click();
+ const createResponse = await createRequest;
+ if (!createResponse.ok()) {
+ const responseText = await createResponse.text().catch(() => '');
+ throw new Error(
+ `Failed to create network ${networkName}: ${createResponse.status()} ${responseText}`
+ );
+ }
+
+ await navigateToNetworks(page);
+ await expect(await findNetworkRow(page, networkName, 15)).toBeVisible();
}
async function findNetworkRow(page: Page, networkName: string, maxRetries = 10) {
- for (let i = 0; i < maxRetries; i++) {
- const searchInput = page.getByPlaceholder(/Search/i).first();
- if (await searchInput.isVisible().catch(() => false)) {
- await searchInput.fill(networkName);
- }
-
- const row = page.locator('tbody tr', { has: page.getByText(networkName) }).first();
- if (await row.isVisible().catch(() => false)) return row;
- await page.waitForTimeout(500);
- await navigateToNetworks(page);
- }
- return page.locator('tbody tr', { has: page.getByText(networkName) }).first();
+ for (let i = 0; i < maxRetries; i++) {
+ const searchInput = page.getByPlaceholder(/Search/i).first();
+ if (await searchInput.isVisible().catch(() => false)) {
+ await searchInput.fill(networkName);
+ }
+
+ const row = page.locator('tbody tr', { has: page.getByText(networkName) }).first();
+ if (await row.isVisible().catch(() => false)) return row;
+ await page.waitForTimeout(500);
+ await navigateToNetworks(page);
+ }
+ return page.locator('tbody tr', { has: page.getByText(networkName) }).first();
}
async function removeNetworkViaUI(page: Page, networkName: string) {
- await navigateToNetworks(page);
-
- const row = await findNetworkRow(page, networkName, 4);
- if ((await row.count()) === 0) return;
-
- await row.locator('a[href*="/networks/"]').first().click();
- await expect(page).toHaveURL(/\/networks\/.+/);
- await page.getByRole('button', { name: 'Remove', exact: true }).click();
- await page.getByRole('button', { name: 'Remove', exact: true }).last().click();
- await expect(page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')).toBeVisible();
+ await navigateToNetworks(page);
+
+ const row = await findNetworkRow(page, networkName, 4);
+ if ((await row.count()) === 0) return;
+
+ await row.locator('a[href*="/networks/"]').first().click();
+ await expect(page).toHaveURL(/\/networks\/.+/);
+ await page.getByRole('button', { name: 'Remove', exact: true }).click();
+ await page.getByRole('button', { name: 'Remove', exact: true }).last().click();
+ await expect(
+ page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')
+ ).toBeVisible();
}
test.describe('Networks Page', () => {
- test.describe.configure({ mode: 'serial' });
-
- test('Page renders with heading and subtitle', async ({ page }) => {
- await navigateToNetworks(page);
- await expect(page.getByRole('heading', { level: 1, name: 'Networks' })).toBeVisible();
- await expect(page.getByText('Manage your Docker networks').first()).toBeVisible();
- });
-
- test('Stat cards show correct counts', async ({ page }) => {
- await navigateToNetworks(page);
-
- // Fetch counts directly in the test to ensure we have fresh data
- const counts = await fetchNetworksCountsWithRetry(page);
-
- await expect(page.getByText(`${counts.total} Total Networks`)).toBeVisible();
- await expect(page.getByText(`${counts.unused} Unused Networks`)).toBeVisible();
- });
-
- test('Table displays when networks exist, else empty state', async ({ page }) => {
- const networkName = `e2e-table-network-${Date.now()}`;
- await navigateToNetworks(page);
- try {
- await createNetworkViaUI(page, networkName);
- await navigateToNetworks(page);
- await expect(page.locator('table')).toBeVisible();
- await expect(page.getByRole('button', { name: 'Name' })).toBeVisible();
- await expect(await findNetworkRow(page, networkName)).toBeVisible();
- } finally {
- await removeNetworkViaUI(page, networkName);
- }
- });
-
- test('Open Create Network sheet', async ({ page }) => {
- const networkName = `test-network-${Date.now()}`;
- try {
- await createNetworkViaUI(page, networkName);
- await navigateToNetworks(page);
- await expect(await findNetworkRow(page, networkName)).toBeVisible();
- } finally {
- await removeNetworkViaUI(page, networkName);
- }
- });
-
- test('Inspect Network from row actions', async ({ page }) => {
- const networkName = `e2e-inspect-network-${Date.now()}`;
- try {
- await createNetworkViaUI(page, networkName);
- await navigateToNetworks(page);
-
- const row = await findNetworkRow(page, networkName);
- await expect(row).toBeVisible();
- await row.locator('a[href*="/networks/"]').first().click();
- await expect(page).toHaveURL(/\/networks\/.+/);
- await expect(page.getByRole('heading', { level: 1, name: networkName })).toBeVisible();
- } finally {
- await removeNetworkViaUI(page, networkName);
- }
- });
-
- test('Remove Network from table', async ({ page }) => {
- const networkName = `test-remove-network-${Date.now()}`;
- await createNetworkViaUI(page, networkName);
- await navigateToNetworks(page);
- const row = await findNetworkRow(page, networkName);
- await expect(row).toBeVisible();
-
- await row.locator('a[href*="/networks/"]').first().click();
- await expect(page).toHaveURL(/\/networks\/.+/);
- await page.getByRole('button', { name: 'Remove', exact: true }).click();
- await page.getByRole('button', { name: 'Remove', exact: true }).last().click();
- await expect(page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')).toBeVisible();
-
- await navigateToNetworks(page);
- const removedRow = await findNetworkRow(page, networkName, 2);
- await expect(removedRow).not.toBeVisible();
- });
-
- test('Default networks cannot be removed on details page', async ({ page }) => {
- await navigateToNetworks(page);
- const bridgeRow = page.locator('tbody tr', { has: page.getByText('bridge', { exact: true }) }).first();
- await expect(bridgeRow).toBeVisible();
- await bridgeRow.locator('a[href*="/networks/"]').first().click();
- await page.waitForLoadState('networkidle');
-
- const removeBtn = page.getByRole('button', { name: 'Remove' });
- await expect(removeBtn).toBeDisabled();
- });
-
- test('Details page shows usage badge', async ({ page }) => {
- const networkName = `e2e-badge-network-${Date.now()}`;
- try {
- await createNetworkViaUI(page, networkName);
- await navigateToNetworks(page);
- const row = await findNetworkRow(page, networkName);
- await expect(row).toBeVisible();
- await row.locator('a[href*="/networks/"]').first().click();
- await page.waitForLoadState('networkidle');
-
- await expect(page.getByText('Unused').first()).toBeVisible();
- } finally {
- await removeNetworkViaUI(page, networkName);
- }
- });
+ test.describe.configure({ mode: 'serial' });
+
+ test('Page renders with heading and subtitle', async ({ page }) => {
+ await navigateToNetworks(page);
+ await expect(page.getByRole('heading', { level: 1, name: 'Networks' })).toBeVisible();
+ await expect(page.getByText('Manage your Docker networks').first()).toBeVisible();
+ });
+
+ test('Stat cards show correct counts', async ({ page }) => {
+ await navigateToNetworks(page);
+
+ // Fetch counts directly in the test to ensure we have fresh data
+ const counts = await fetchNetworksCountsWithRetry(page);
+
+ await expect(page.getByText(`${counts.total} Total Networks`)).toBeVisible();
+ await expect(page.getByText(`${counts.unused} Unused Networks`)).toBeVisible();
+ });
+
+ test('Table displays when networks exist, else empty state', async ({ page }) => {
+ const networkName = `e2e-table-network-${Date.now()}`;
+ await navigateToNetworks(page);
+ try {
+ await createNetworkViaUI(page, networkName);
+ await navigateToNetworks(page);
+ await expect(page.locator('table')).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Name' })).toBeVisible();
+ await expect(await findNetworkRow(page, networkName)).toBeVisible();
+ } finally {
+ await removeNetworkViaUI(page, networkName);
+ }
+ });
+
+ test('Open Create Network sheet', async ({ page }) => {
+ const networkName = `test-network-${Date.now()}`;
+ try {
+ await createNetworkViaUI(page, networkName);
+ await navigateToNetworks(page);
+ await expect(await findNetworkRow(page, networkName)).toBeVisible();
+ } finally {
+ await removeNetworkViaUI(page, networkName);
+ }
+ });
+
+ test('Inspect Network from row actions', async ({ page }) => {
+ const networkName = `e2e-inspect-network-${Date.now()}`;
+ try {
+ await createNetworkViaUI(page, networkName);
+ await navigateToNetworks(page);
+
+ const row = await findNetworkRow(page, networkName);
+ await expect(row).toBeVisible();
+ await row.locator('a[href*="/networks/"]').first().click();
+ await expect(page).toHaveURL(/\/networks\/.+/);
+ await expect(page.getByRole('heading', { level: 1, name: networkName })).toBeVisible();
+ } finally {
+ await removeNetworkViaUI(page, networkName);
+ }
+ });
+
+ test('Remove Network from table', async ({ page }) => {
+ const networkName = `test-remove-network-${Date.now()}`;
+ await createNetworkViaUI(page, networkName);
+ await navigateToNetworks(page);
+ const row = await findNetworkRow(page, networkName);
+ await expect(row).toBeVisible();
+
+ await row.locator('a[href*="/networks/"]').first().click();
+ await expect(page).toHaveURL(/\/networks\/.+/);
+ await page.getByRole('button', { name: 'Remove', exact: true }).click();
+ await page.getByRole('button', { name: 'Remove', exact: true }).last().click();
+ await expect(
+ page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')
+ ).toBeVisible();
+
+ await navigateToNetworks(page);
+ const removedRow = await findNetworkRow(page, networkName, 2);
+ await expect(removedRow).not.toBeVisible();
+ });
+
+ test('Default networks cannot be removed on details page', async ({ page }) => {
+ await navigateToNetworks(page);
+ const bridgeRow = page
+ .locator('tbody tr', { has: page.getByText('bridge', { exact: true }) })
+ .first();
+ await expect(bridgeRow).toBeVisible();
+ await bridgeRow.locator('a[href*="/networks/"]').first().click();
+ await page.waitForLoadState('networkidle');
+
+ const removeBtn = page.getByRole('button', { name: 'Remove' });
+ await expect(removeBtn).toBeDisabled();
+ });
+
+ test('Details page shows usage badge', async ({ page }) => {
+ const networkName = `e2e-badge-network-${Date.now()}`;
+ try {
+ await createNetworkViaUI(page, networkName);
+ await navigateToNetworks(page);
+ const row = await findNetworkRow(page, networkName);
+ await expect(row).toBeVisible();
+ await row.locator('a[href*="/networks/"]').first().click();
+ await page.waitForLoadState('networkidle');
+
+ await expect(page.getByText('Unused').first()).toBeVisible();
+ } finally {
+ await removeNetworkViaUI(page, networkName);
+ }
+ });
});
diff --git a/tests/spec/project.spec.ts b/tests/spec/project.spec.ts
index 595c736d5..a6407ea2e 100644
--- a/tests/spec/project.spec.ts
+++ b/tests/spec/project.spec.ts
@@ -4,789 +4,825 @@ import { Project, ProjectStatusCounts } from 'types/project.type';
import { TEST_COMPOSE_YAML, TEST_ENV_FILE } from '../setup/project.data';
const ROUTES = {
- page: '/projects',
- apiProjects: '/api/environments/0/projects',
- newProject: '/projects/new',
+ page: '/projects',
+ apiProjects: '/api/environments/0/projects',
+ newProject: '/projects/new'
};
-const DEPLOY_STREAM_SUCCESS = '{"type":"deploy","phase":"begin"}\n' + '{"type":"deploy","phase":"complete"}\n';
+const DEPLOY_STREAM_SUCCESS =
+ '{"type":"deploy","phase":"begin"}\n' + '{"type":"deploy","phase":"complete"}\n';
async function navigateToProjects(page: Page) {
- await page.goto(ROUTES.page);
- await page.waitForLoadState('networkidle');
+ await page.goto(ROUTES.page);
+ await page.waitForLoadState('networkidle');
}
async function setCodeMirrorValue(page: Page, editor: Locator, text: string) {
- const content = editor.locator('.cm-content').first();
- await expect(content).toBeVisible();
- await content.click({ position: { x: 10, y: 10 } });
- await content.press('ControlOrMeta+A');
- await page.keyboard.type(text, { delay: 0 });
+ const content = editor.locator('.cm-content').first();
+ await expect(content).toBeVisible();
+ await content.click({ position: { x: 10, y: 10 } });
+ await content.press('ControlOrMeta+A');
+ await page.keyboard.type(text, { delay: 0 });
}
async function createProjectViaUI(page: Page, projectName: string) {
- const containerName = `test-redis-container-${Date.now()}`;
- const envFile = TEST_ENV_FILE.replace(/CONTAINER_NAME=.*/m, `CONTAINER_NAME=${containerName}`);
+ const containerName = `test-redis-container-${Date.now()}`;
+ const envFile = TEST_ENV_FILE.replace(/CONTAINER_NAME=.*/m, `CONTAINER_NAME=${containerName}`);
- await page.goto(ROUTES.newProject);
- await page.waitForLoadState('networkidle');
+ await page.goto(ROUTES.newProject);
+ await page.waitForLoadState('networkidle');
- await page.getByRole('button', { name: 'My New Project' }).click();
- await page.getByRole('textbox', { name: 'My New Project' }).fill(projectName);
- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
+ await page.getByRole('button', { name: 'My New Project' }).click();
+ await page.getByRole('textbox', { name: 'My New Project' }).fill(projectName);
+ await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
- const composeEditor = page.locator('.cm-editor').first();
- const envEditor = page.locator('.cm-editor').nth(1);
- await expect(composeEditor).toBeVisible();
- await expect(envEditor).toBeVisible();
+ const composeEditor = page.locator('.cm-editor').first();
+ const envEditor = page.locator('.cm-editor').nth(1);
+ await expect(composeEditor).toBeVisible();
+ await expect(envEditor).toBeVisible();
- await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);
- await setCodeMirrorValue(page, envEditor, envFile);
+ await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);
+ await setCodeMirrorValue(page, envEditor, envFile);
- const createButton = page.getByRole('button', { name: 'Create Project' }).locator('[data-slot="arcane-button"]');
- await createButton.click();
+ const createButton = page
+ .getByRole('button', { name: 'Create Project' })
+ .locator('[data-slot="arcane-button"]');
+ await createButton.click();
- await page.waitForURL(/\/projects\/.+/, { timeout: 10000 });
- await expect(page.getByRole('button', { name: projectName })).toBeVisible();
+ await page.waitForURL(/\/projects\/.+/, { timeout: 10000 });
+ await expect(page.getByRole('button', { name: projectName })).toBeVisible();
- return new URL(page.url()).pathname.split('/').pop()!;
+ return new URL(page.url()).pathname.split('/').pop()!;
}
async function destroyCurrentProjectViaUI(page: Page) {
- if (page.isClosed()) {
- return;
- }
-
- const destroyButton = page.getByRole('button', {
- name: 'Destroy',
- exact: true,
- });
- await expect(destroyButton).toBeVisible();
- await destroyButton.click();
-
- const dialog = page.getByRole('dialog');
- await expect(dialog).toBeVisible();
- await dialog.getByLabel(/Remove project files/i).check();
- await dialog.getByRole('button', { name: 'Destroy', exact: true }).click();
-
- await page.waitForURL(ROUTES.page, { timeout: 10000 });
+ if (page.isClosed()) {
+ return;
+ }
+
+ const destroyButton = page.getByRole('button', {
+ name: 'Destroy',
+ exact: true
+ });
+ await expect(destroyButton).toBeVisible();
+ await destroyButton.click();
+
+ const dialog = page.getByRole('dialog');
+ await expect(dialog).toBeVisible();
+ await dialog.getByLabel(/Remove project files/i).check();
+ await dialog.getByRole('button', { name: 'Destroy', exact: true }).click();
+
+ await page.waitForURL(ROUTES.page, { timeout: 10000 });
}
async function destroyProjectByNameViaUI(page: Page, projectName: string) {
- if (page.isClosed()) {
- return;
- }
-
- await page.goto(ROUTES.page);
- await page.waitForLoadState('networkidle');
-
- const searchInput = page.getByPlaceholder('Search…');
- if (await searchInput.isVisible().catch(() => false)) {
- await searchInput.fill(projectName);
- }
-
- const row = page.locator('tbody tr').filter({ hasText: projectName }).first();
- if (!(await row.isVisible().catch(() => false))) {
- return;
- }
-
- await row.getByRole('button', { name: 'Open menu' }).click();
- await page.getByRole('menuitem', { name: 'Destroy', exact: true }).click();
-
- const dialog = page.getByRole('dialog');
- await expect(dialog).toBeVisible();
- await dialog.getByLabel(/Remove project files/i).check();
- await dialog.getByRole('button', { name: 'Destroy', exact: true }).click();
-
- await expect(page.locator('tbody tr').filter({ hasText: projectName })).toHaveCount(0, {
- timeout: 15000,
- });
+ if (page.isClosed()) {
+ return;
+ }
+
+ await page.goto(ROUTES.page);
+ await page.waitForLoadState('networkidle');
+
+ const searchInput = page.getByPlaceholder('Search…');
+ if (await searchInput.isVisible().catch(() => false)) {
+ await searchInput.fill(projectName);
+ }
+
+ const row = page.locator('tbody tr').filter({ hasText: projectName }).first();
+ if (!(await row.isVisible().catch(() => false))) {
+ return;
+ }
+
+ await row.getByRole('button', { name: 'Open menu' }).click();
+ await page.getByRole('menuitem', { name: 'Destroy', exact: true }).click();
+
+ const dialog = page.getByRole('dialog');
+ await expect(dialog).toBeVisible();
+ await dialog.getByLabel(/Remove project files/i).check();
+ await dialog.getByRole('button', { name: 'Destroy', exact: true }).click();
+
+ await expect(page.locator('tbody tr').filter({ hasText: projectName })).toHaveCount(0, {
+ timeout: 15000
+ });
}
let realProjects: Project[] = [];
let projectCounts: ProjectStatusCounts = {
- runningProjects: 0,
- stoppedProjects: 0,
- totalProjects: 0,
+ runningProjects: 0,
+ stoppedProjects: 0,
+ totalProjects: 0
};
test.beforeEach(async ({ page }) => {
- await navigateToProjects(page);
-
- try {
- realProjects = await fetchProjectsWithRetry(page);
- projectCounts = await fetchProjectCountsWithRetry(page);
- } catch (error) {
- realProjects = [];
- }
+ await navigateToProjects(page);
+
+ try {
+ realProjects = await fetchProjectsWithRetry(page);
+ projectCounts = await fetchProjectCountsWithRetry(page);
+ } catch (error) {
+ realProjects = [];
+ }
});
test.describe('Projects Page', () => {
- test('should display the main heading and description', async ({ page }) => {
- await expect(page.getByRole('heading', { name: 'Projects', level: 1 })).toBeVisible();
- await expect(page.getByText('View and Manage Compose Projects')).toBeVisible();
- });
-
- test('should display summary cards with correct counts', async ({ page }) => {
- await expect(
- page.getByText(`${projectCounts.totalProjects} Total Projects`, {
- exact: true,
- }),
- ).toBeVisible();
- await expect(
- page.getByText(`${projectCounts.runningProjects} Running`, {
- exact: true,
- }),
- ).toBeVisible();
- await expect(
- page.getByText(`${projectCounts.stoppedProjects} Stopped`, {
- exact: true,
- }),
- ).toBeVisible();
- });
-
- test('should display projects list', async ({ page }) => {
- await expect(page.locator('table')).toBeVisible();
- });
-
- test('should show project actions menu', async ({ page }) => {
- test.skip(!realProjects.length, 'No projects available for actions menu test');
-
- await page.waitForLoadState('networkidle');
- const firstRow = page.locator('tbody tr').first();
- const menuButton = firstRow.getByRole('button', { name: 'Open menu' });
- await expect(menuButton).toBeVisible();
- await menuButton.click();
-
- await expect(page.getByRole('menuitem', { name: 'Edit' })).toBeVisible();
- // Check for at least one of the state action buttons (Up/Down/Restart)
- const upItem = page.getByRole('menuitem', { name: 'Up', exact: true });
- const downItem = page.getByRole('menuitem', { name: 'Down', exact: true });
- const restartItem = page.getByRole('menuitem', {
- name: 'Restart',
- exact: true,
- });
- const hasStateAction = (await upItem.count()) > 0 || (await downItem.count()) > 0 || (await restartItem.count()) > 0;
- expect(hasStateAction).toBe(true);
- await expect(page.getByRole('menuitem', { name: 'Pull & Redeploy' })).toBeVisible();
- await expect(page.getByRole('menuitem', { name: 'Destroy' })).toBeVisible();
- });
-
- test('should navigate to project details when project name is clicked', async ({ page }) => {
- test.skip(!realProjects.length, 'No projects available for navigation test');
-
- await page.waitForLoadState('networkidle');
- // Get the first project link that points to /projects/ (not the "Git" indicator link)
- const firstProjectLink = page
- .locator('tbody tr')
- .first()
- .getByRole('link')
- .filter({ hasText: /^(?!Git$)/ })
- .first();
- const projectName = await firstProjectLink.textContent();
-
- await firstProjectLink.click();
- await expect(page).toHaveURL(/\/projects\/.+/);
- await expect(page.getByRole('button', { name: new RegExp(`${projectName}`) })).toBeVisible();
- });
-
- test('should allow searching/filtering projects', async ({ page }) => {
- test.skip(!realProjects.length, 'No projects available for search test');
-
- const searchInput = page.getByPlaceholder('Search…');
- await expect(searchInput).toBeVisible();
-
- const firstProject = realProjects[0];
- if (firstProject?.name) {
- await searchInput.fill(firstProject.name);
- await expect(page.getByRole('link', { name: firstProject.name })).toBeVisible();
- await searchInput.clear();
- }
- });
-
- test('should display project status badges', async ({ page }) => {
- test.skip(!realProjects.length, 'No projects available for status badge test');
-
- await page.waitForLoadState('networkidle');
-
- const runningProjects = realProjects.filter((p) => p.status === 'running');
- const stoppedProjects = realProjects.filter((p) => p.status === 'stopped');
-
- if (runningProjects.length > 0) {
- await expect(page.locator('text="Running"').first()).toBeVisible();
- }
-
- if (stoppedProjects.length > 0) {
- await expect(page.locator('text="Stopped"').first()).toBeVisible();
- }
- });
+ test('should display the main heading and description', async ({ page }) => {
+ await expect(page.getByRole('heading', { name: 'Projects', level: 1 })).toBeVisible();
+ await expect(page.getByText('View and Manage Compose Projects')).toBeVisible();
+ });
+
+ test('should display summary cards with correct counts', async ({ page }) => {
+ await expect(
+ page.getByText(`${projectCounts.totalProjects} Total Projects`, {
+ exact: true
+ })
+ ).toBeVisible();
+ await expect(
+ page.getByText(`${projectCounts.runningProjects} Running`, {
+ exact: true
+ })
+ ).toBeVisible();
+ await expect(
+ page.getByText(`${projectCounts.stoppedProjects} Stopped`, {
+ exact: true
+ })
+ ).toBeVisible();
+ });
+
+ test('should display projects list', async ({ page }) => {
+ await expect(page.locator('table')).toBeVisible();
+ });
+
+ test('should show project actions menu', async ({ page }) => {
+ test.skip(!realProjects.length, 'No projects available for actions menu test');
+
+ await page.waitForLoadState('networkidle');
+ const firstRow = page.locator('tbody tr').first();
+ const menuButton = firstRow.getByRole('button', { name: 'Open menu' });
+ await expect(menuButton).toBeVisible();
+ await menuButton.click();
+
+ await expect(page.getByRole('menuitem', { name: 'Edit' })).toBeVisible();
+ // Check for at least one of the state action buttons (Up/Down/Restart)
+ const upItem = page.getByRole('menuitem', { name: 'Up', exact: true });
+ const downItem = page.getByRole('menuitem', { name: 'Down', exact: true });
+ const restartItem = page.getByRole('menuitem', {
+ name: 'Restart',
+ exact: true
+ });
+ const hasStateAction =
+ (await upItem.count()) > 0 || (await downItem.count()) > 0 || (await restartItem.count()) > 0;
+ expect(hasStateAction).toBe(true);
+ await expect(page.getByRole('menuitem', { name: 'Pull & Redeploy' })).toBeVisible();
+ await expect(page.getByRole('menuitem', { name: 'Destroy' })).toBeVisible();
+ });
+
+ test('should navigate to project details when project name is clicked', async ({ page }) => {
+ test.skip(!realProjects.length, 'No projects available for navigation test');
+
+ await page.waitForLoadState('networkidle');
+ // Get the first project link that points to /projects/ (not the "Git" indicator link)
+ const firstProjectLink = page
+ .locator('tbody tr')
+ .first()
+ .getByRole('link')
+ .filter({ hasText: /^(?!Git$)/ })
+ .first();
+ const projectName = await firstProjectLink.textContent();
+
+ await firstProjectLink.click();
+ await expect(page).toHaveURL(/\/projects\/.+/);
+ await expect(page.getByRole('button', { name: new RegExp(`${projectName}`) })).toBeVisible();
+ });
+
+ test('should allow searching/filtering projects', async ({ page }) => {
+ test.skip(!realProjects.length, 'No projects available for search test');
+
+ const searchInput = page.getByPlaceholder('Search…');
+ await expect(searchInput).toBeVisible();
+
+ const firstProject = realProjects[0];
+ if (firstProject?.name) {
+ await searchInput.fill(firstProject.name);
+ await expect(page.getByRole('link', { name: firstProject.name })).toBeVisible();
+ await searchInput.clear();
+ }
+ });
+
+ test('should display project status badges', async ({ page }) => {
+ test.skip(!realProjects.length, 'No projects available for status badge test');
+
+ await page.waitForLoadState('networkidle');
+
+ const runningProjects = realProjects.filter((p) => p.status === 'running');
+ const stoppedProjects = realProjects.filter((p) => p.status === 'stopped');
+
+ if (runningProjects.length > 0) {
+ await expect(page.locator('text="Running"').first()).toBeVisible();
+ }
+
+ if (stoppedProjects.length > 0) {
+ await expect(page.locator('text="Stopped"').first()).toBeVisible();
+ }
+ });
});
test.describe('New Compose Project Page', () => {
- test.beforeEach(async ({ page }) => {
- await page.goto(ROUTES.newProject);
- await page.waitForLoadState('networkidle');
- });
-
- test('should display the create project form', async ({ page }) => {
- await expect(page.getByRole('button', { name: 'My New Project' })).toBeVisible();
- await expect(page.getByRole('heading', { name: 'Docker Compose File' })).toBeVisible();
- await expect(page.getByRole('heading', { name: 'Environment (.env)' })).toBeVisible();
- });
-
- test('should validate required fields', async ({ page }) => {
- const createButton = page.getByRole('button', { name: 'Create Project' }).locator('[data-slot="arcane-button"]');
- await expect(createButton).toBeDisabled();
-
- await page.getByRole('button', { name: 'My New Project' }).click();
- await page.getByRole('textbox', { name: 'My New Project' }).fill('test-project');
- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
- });
-
- test('should enable Create Project after entering a valid name', async ({ page }) => {
- const observedErrors: string[] = [];
- page.on('pageerror', (err) => observedErrors.push(String(err?.message ?? err)));
- page.on('console', (msg) => {
- if (msg.type() === 'error') observedErrors.push(msg.text());
- });
-
- const createButton = page.getByRole('button', { name: 'Create Project' }).locator('[data-slot="arcane-button"]');
-
- await expect(createButton).toBeVisible();
-
- // Open the inline name editor and set a valid name.
- await page.getByRole('button', { name: 'My New Project' }).click();
- await page.getByRole('textbox', { name: 'My New Project' }).fill('test-project');
- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
-
- // The button should become enabled once name + compose content are present.
- await expect(createButton).toBeEnabled();
-
- const stateUnsafe = observedErrors.filter((e) => e.includes('state_unsafe_mutation'));
- expect(stateUnsafe, `Unexpected state_unsafe_mutation errors: ${stateUnsafe.join('\n')}`).toHaveLength(0);
- });
-
- test('should hide Create Project when compose syntax is invalid and show it when fixed', async ({ page }) => {
- await page.getByRole('button', { name: 'My New Project' }).click();
- await page.getByRole('textbox', { name: 'My New Project' }).fill('syntax-check-project');
- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
-
- const composeEditor = page.locator('.cm-editor').first();
- await expect(composeEditor).toBeVisible();
-
- await setCodeMirrorValue(page, composeEditor, 'services:\n\tredis:\n\t\timage: redis:latest\n');
- await expect(page.locator('button[data-slot="arcane-button"]').filter({ hasText: 'Create Project' })).toHaveCount(0);
-
- await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);
- const createButton = page.locator('button[data-slot="arcane-button"]').filter({ hasText: 'Create Project' });
- await expect(createButton).toBeVisible();
- await expect(createButton).toBeEnabled();
- });
-
- test('should hide Create Project when env syntax is invalid and show it when fixed', async ({ page }) => {
- await page.getByRole('button', { name: 'My New Project' }).click();
- await page.getByRole('textbox', { name: 'My New Project' }).fill('env-check-project');
- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
-
- const composeEditor = page.locator('.cm-editor').first();
- const envEditor = page.locator('.cm-editor').nth(1);
- await expect(composeEditor).toBeVisible();
- await expect(envEditor).toBeVisible();
-
- await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);
- await setCodeMirrorValue(page, envEditor, 'NOT VALID LINE');
- await expect(page.locator('button[data-slot="arcane-button"]').filter({ hasText: 'Create Project' })).toHaveCount(0);
-
- await setCodeMirrorValue(page, envEditor, TEST_ENV_FILE);
- const createButton = page.locator('button[data-slot="arcane-button"]').filter({ hasText: 'Create Project' });
- await expect(createButton).toBeVisible();
- await expect(createButton).toBeEnabled();
- });
-
- test('should create a new project successfully', async ({ page }) => {
- const projectName = `test-project-${Date.now()}`;
- const containerName = `test-redis-container-${Date.now()}`;
- const envFile = TEST_ENV_FILE.replace(/CONTAINER_NAME=.*/m, `CONTAINER_NAME=${containerName}`);
- let createdProjectId: string | null = null;
- let projectPullRequestCount = 0;
-
- await page.getByRole('button', { name: 'My New Project' }).click();
- await page.getByRole('textbox', { name: 'My New Project' }).fill(projectName);
- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
-
- const composeEditor = page.locator('.cm-editor').first();
- await expect(composeEditor).toBeVisible();
- await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);
- await expect(composeEditor).toContainText(/redis/i);
-
- const envEditor = page.locator('.cm-editor').nth(1);
- await expect(envEditor).toBeVisible();
- await setCodeMirrorValue(page, envEditor, envFile);
- await expect(envEditor).toContainText(/redis/i);
-
- await page.route('/api/environments/*/projects', async (route) => {
- if (route.request().method() === 'POST') {
- const response = await route.fetch();
- const responseBody = await response.text();
-
- try {
- const parsed = JSON.parse(responseBody);
- createdProjectId = parsed.id;
- } catch {
- // Keep existing createdProjectId value if parsing fails
- }
-
- await route.fulfill({
- status: response.status(),
- headers: response.headers(),
- body: responseBody,
- });
- } else {
- await route.continue();
- }
- });
-
- const createButton = page.getByRole('button', { name: 'Create Project' }).locator('[data-slot="arcane-button"]');
- await createButton.click();
-
- await page.waitForURL(/\/projects\/.+/, { timeout: 10000 });
-
- if (createdProjectId) {
- await expect(page).toHaveURL(new RegExp(`/projects/${createdProjectId}`));
- } else {
- await expect(page).toHaveURL(new RegExp(`/projects/[a-f0-9\\-]{36}`));
- }
-
- await expect(page.getByRole('button', { name: projectName })).toBeVisible();
-
- await page.getByRole('tab', { name: 'Services' }).click();
- await page.waitForLoadState('networkidle');
-
- const serviceTable = page.getByRole('table');
- const serviceNameWhenStopped = serviceTable.getByText('redis', {
- exact: true,
- });
- const emptyServicesState = page.getByText(/No services found for this project/i);
-
- if ((await serviceNameWhenStopped.count()) > 0) {
- await expect(serviceNameWhenStopped.first()).toBeVisible();
- } else {
- await expect(emptyServicesState).toBeVisible();
- }
-
- await page.route('**/api/environments/*/projects/*/pull', async (route) => {
- projectPullRequestCount += 1;
- await route.continue();
- });
-
- const deployButton = page.getByRole('button', { name: 'Up', exact: true }).filter({ hasText: 'Up' }).last();
- await deployButton.click();
-
- await page.waitForTimeout(5000);
- await page.waitForLoadState('networkidle');
-
- expect(projectPullRequestCount).toBe(0);
- await expect(page.getByText('Running', { exact: true })).toBeVisible({
- timeout: 20000,
- });
- await expect(page.getByRole('button', { name: 'Down', exact: true })).toBeVisible();
- });
-
- test('should send selected deploy split-button options in the up request', async ({ page }) => {
- // Use a wider viewport to prevent the header's project-name area from
- // overlapping the deploy split-button trigger at the 1280px boundary.
- await page.setViewportSize({ width: 1440, height: 900 });
-
- const projectName = `test-deploy-options-${Date.now()}`;
-
- try {
- await createProjectViaUI(page, projectName);
-
- // Reset scroll so the floating header doesn't appear from stale scroll state
- await page.evaluate(() => window.scrollTo(0, 0));
-
- await page.route('**/api/environments/*/projects/*/up', async (route) => {
- await route.fulfill({
- status: 200,
- contentType: 'application/x-json-stream',
- body: DEPLOY_STREAM_SUCCESS,
- });
- });
-
- const deployButtonGroup = page
- .locator('[data-slot="button-group"]')
- .filter({ has: page.getByRole('button', { name: 'Up', exact: true }) })
- .first();
- const deployMenuTrigger = deployButtonGroup.getByRole('button', {
- name: 'Open menu',
- });
-
- await expect(deployMenuTrigger).toBeVisible();
-
- // Open dropdown and select "Always" pull policy
- await deployMenuTrigger.click();
- const alwaysItem = page.getByRole('menuitemradio', { name: /Always/i });
- await expect(alwaysItem).toBeVisible();
- await alwaysItem.click();
- // Wait for the dropdown to fully close before reopening
- await expect(alwaysItem).not.toBeVisible();
-
- // Reopen dropdown and toggle "Force recreate containers"
- await deployMenuTrigger.click();
- const forceRecreateItem = page.getByRole('menuitemcheckbox', { name: /Force recreate containers/i });
- await expect(forceRecreateItem).toBeVisible();
- await forceRecreateItem.click();
- // Wait for the dropdown to fully close
- await expect(forceRecreateItem).not.toBeVisible();
-
- // Set up request listener right before clicking to minimize timeout window
- const deployRequestPromise = page.waitForRequest((request) => {
- if (request.method() !== 'POST') return false;
- return /\/api\/environments\/[^/]+\/projects\/[^/]+\/up$/.test(new URL(request.url()).pathname);
- });
-
- await page.getByRole('button', { name: 'Up', exact: true }).click();
-
- const deployRequest = await deployRequestPromise;
- const deployRequestBody = deployRequest.postDataJSON() as Record<string, unknown> | null;
-
- await expect
- .poll(() => deployRequestBody, {
- message: 'Expected the deploy request body to be captured',
- })
- .not.toBeNull();
-
- expect(deployRequestBody).toEqual({
- pullPolicy: 'always',
- forceRecreate: true,
- });
- } finally {
- if (!page.isClosed() && /\/projects\/.+/.test(new URL(page.url()).pathname)) {
- await destroyCurrentProjectViaUI(page);
- } else {
- await destroyProjectByNameViaUI(page, projectName);
- }
- }
- });
-
- test('should destroy the project and remove files from disk', async ({ page }) => {
- const projectName = `test-destroy-${Date.now()}`;
-
- // 1. Create the project first
- await page.getByRole('button', { name: 'My New Project' }).click();
- await page.getByRole('textbox', { name: 'My New Project' }).fill(projectName);
- await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
-
- const composeEditor = page.locator('.cm-editor').first();
- await expect(composeEditor).toBeVisible();
- await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);
-
- const createButton = page.locator('button[data-slot="arcane-button"]').filter({ hasText: 'Create Project' });
- await createButton.click();
-
- await page.waitForURL(/\/projects\/.+/, { timeout: 10000 });
- await expect(page.getByRole('button', { name: projectName })).toBeVisible();
-
- // 2. Destroy the project
- const destroyButton = page.getByRole('button', {
- name: 'Destroy',
- exact: true,
- });
- await expect(destroyButton).toBeVisible();
- await destroyButton.click();
-
- // 3. Handle the confirmation dialog
- const dialog = page.getByRole('dialog');
- await expect(dialog).toBeVisible();
-
- // Check "Remove project files"
- const removeFilesCheckbox = dialog.getByLabel(/Remove project files/i);
- await removeFilesCheckbox.check();
-
- // Click "Destroy" in the dialog
- const confirmDestroyButton = dialog.getByRole('button', {
- name: 'Destroy',
- exact: true,
- });
- await confirmDestroyButton.click();
-
- // 4. Verify redirection and project removal
- await page.waitForURL(ROUTES.page, { timeout: 10000 });
- await expect(page.getByRole('link', { name: projectName })).not.toBeVisible();
- });
+ test.beforeEach(async ({ page }) => {
+ await page.goto(ROUTES.newProject);
+ await page.waitForLoadState('networkidle');
+ });
+
+ test('should display the create project form', async ({ page }) => {
+ await expect(page.getByRole('button', { name: 'My New Project' })).toBeVisible();
+ await expect(page.getByRole('heading', { name: 'Docker Compose File' })).toBeVisible();
+ await expect(page.getByRole('heading', { name: 'Environment (.env)' })).toBeVisible();
+ });
+
+ test('should validate required fields', async ({ page }) => {
+ const createButton = page
+ .getByRole('button', { name: 'Create Project' })
+ .locator('[data-slot="arcane-button"]');
+ await expect(createButton).toBeDisabled();
+
+ await page.getByRole('button', { name: 'My New Project' }).click();
+ await page.getByRole('textbox', { name: 'My New Project' }).fill('test-project');
+ await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
+ });
+
+ test('should enable Create Project after entering a valid name', async ({ page }) => {
+ const observedErrors: string[] = [];
+ page.on('pageerror', (err) => observedErrors.push(String(err?.message ?? err)));
+ page.on('console', (msg) => {
+ if (msg.type() === 'error') observedErrors.push(msg.text());
+ });
+
+ const createButton = page
+ .getByRole('button', { name: 'Create Project' })
+ .locator('[data-slot="arcane-button"]');
+
+ await expect(createButton).toBeVisible();
+
+ // Open the inline name editor and set a valid name.
+ await page.getByRole('button', { name: 'My New Project' }).click();
+ await page.getByRole('textbox', { name: 'My New Project' }).fill('test-project');
+ await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
+
+ // The button should become enabled once name + compose content are present.
+ await expect(createButton).toBeEnabled();
+
+ const stateUnsafe = observedErrors.filter((e) => e.includes('state_unsafe_mutation'));
+ expect(
+ stateUnsafe,
+ `Unexpected state_unsafe_mutation errors: ${stateUnsafe.join('\n')}`
+ ).toHaveLength(0);
+ });
+
+ test('should hide Create Project when compose syntax is invalid and show it when fixed', async ({
+ page
+ }) => {
+ await page.getByRole('button', { name: 'My New Project' }).click();
+ await page.getByRole('textbox', { name: 'My New Project' }).fill('syntax-check-project');
+ await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
+
+ const composeEditor = page.locator('.cm-editor').first();
+ await expect(composeEditor).toBeVisible();
+
+ await setCodeMirrorValue(page, composeEditor, 'services:\n\tredis:\n\t\timage: redis:latest\n');
+ await expect(
+ page.locator('button[data-slot="arcane-button"]').filter({ hasText: 'Create Project' })
+ ).toHaveCount(0);
+
+ await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);
+ const createButton = page
+ .locator('button[data-slot="arcane-button"]')
+ .filter({ hasText: 'Create Project' });
+ await expect(createButton).toBeVisible();
+ await expect(createButton).toBeEnabled();
+ });
+
+ test('should hide Create Project when env syntax is invalid and show it when fixed', async ({
+ page
+ }) => {
+ await page.getByRole('button', { name: 'My New Project' }).click();
+ await page.getByRole('textbox', { name: 'My New Project' }).fill('env-check-project');
+ await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
+
+ const composeEditor = page.locator('.cm-editor').first();
+ const envEditor = page.locator('.cm-editor').nth(1);
+ await expect(composeEditor).toBeVisible();
+ await expect(envEditor).toBeVisible();
+
+ await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);
+ await setCodeMirrorValue(page, envEditor, 'NOT VALID LINE');
+ await expect(
+ page.locator('button[data-slot="arcane-button"]').filter({ hasText: 'Create Project' })
+ ).toHaveCount(0);
+
+ await setCodeMirrorValue(page, envEditor, TEST_ENV_FILE);
+ const createButton = page
+ .locator('button[data-slot="arcane-button"]')
+ .filter({ hasText: 'Create Project' });
+ await expect(createButton).toBeVisible();
+ await expect(createButton).toBeEnabled();
+ });
+
+ test('should create a new project successfully', async ({ page }) => {
+ const projectName = `test-project-${Date.now()}`;
+ const containerName = `test-redis-container-${Date.now()}`;
+ const envFile = TEST_ENV_FILE.replace(/CONTAINER_NAME=.*/m, `CONTAINER_NAME=${containerName}`);
+ let createdProjectId: string | null = null;
+ let projectPullRequestCount = 0;
+
+ await page.getByRole('button', { name: 'My New Project' }).click();
+ await page.getByRole('textbox', { name: 'My New Project' }).fill(projectName);
+ await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
+
+ const composeEditor = page.locator('.cm-editor').first();
+ await expect(composeEditor).toBeVisible();
+ await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);
+ await expect(composeEditor).toContainText(/redis/i);
+
+ const envEditor = page.locator('.cm-editor').nth(1);
+ await expect(envEditor).toBeVisible();
+ await setCodeMirrorValue(page, envEditor, envFile);
+ await expect(envEditor).toContainText(/redis/i);
+
+ await page.route('/api/environments/*/projects', async (route) => {
+ if (route.request().method() === 'POST') {
+ const response = await route.fetch();
+ const responseBody = await response.text();
+
+ try {
+ const parsed = JSON.parse(responseBody);
+ createdProjectId = parsed.id;
+ } catch {
+ // Keep existing createdProjectId value if parsing fails
+ }
+
+ await route.fulfill({
+ status: response.status(),
+ headers: response.headers(),
+ body: responseBody
+ });
+ } else {
+ await route.continue();
+ }
+ });
+
+ const createButton = page
+ .getByRole('button', { name: 'Create Project' })
+ .locator('[data-slot="arcane-button"]');
+ await createButton.click();
+
+ await page.waitForURL(/\/projects\/.+/, { timeout: 10000 });
+
+ if (createdProjectId) {
+ await expect(page).toHaveURL(new RegExp(`/projects/${createdProjectId}`));
+ } else {
+ await expect(page).toHaveURL(new RegExp(`/projects/[a-f0-9\\-]{36}`));
+ }
+
+ await expect(page.getByRole('button', { name: projectName })).toBeVisible();
+
+ await page.getByRole('tab', { name: 'Services' }).click();
+ await page.waitForLoadState('networkidle');
+
+ const serviceTable = page.getByRole('table');
+ const serviceNameWhenStopped = serviceTable.getByText('redis', {
+ exact: true
+ });
+ const emptyServicesState = page.getByText(/No services found for this project/i);
+
+ if ((await serviceNameWhenStopped.count()) > 0) {
+ await expect(serviceNameWhenStopped.first()).toBeVisible();
+ } else {
+ await expect(emptyServicesState).toBeVisible();
+ }
+
+ await page.route('**/api/environments/*/projects/*/pull', async (route) => {
+ projectPullRequestCount += 1;
+ await route.continue();
+ });
+
+ const deployButton = page
+ .getByRole('button', { name: 'Up', exact: true })
+ .filter({ hasText: 'Up' })
+ .last();
+ await deployButton.click();
+
+ await page.waitForTimeout(5000);
+ await page.waitForLoadState('networkidle');
+
+ expect(projectPullRequestCount).toBe(0);
+ await expect(page.getByText('Running', { exact: true })).toBeVisible({
+ timeout: 20000
+ });
+ await expect(page.getByRole('button', { name: 'Down', exact: true })).toBeVisible();
+ });
+
+ test('should send selected deploy split-button options in the up request', async ({ page }) => {
+ // Use a wider viewport to prevent the header's project-name area from
+ // overlapping the deploy split-button trigger at the 1280px boundary.
+ await page.setViewportSize({ width: 1440, height: 900 });
+
+ const projectName = `test-deploy-options-${Date.now()}`;
+
+ try {
+ await createProjectViaUI(page, projectName);
+
+ // Reset scroll so the floating header doesn't appear from stale scroll state
+ await page.evaluate(() => window.scrollTo(0, 0));
+
+ await page.route('**/api/environments/*/projects/*/up', async (route) => {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/x-json-stream',
+ body: DEPLOY_STREAM_SUCCESS
+ });
+ });
+
+ const deployButtonGroup = page
+ .locator('[data-slot="button-group"]')
+ .filter({ has: page.getByRole('button', { name: 'Up', exact: true }) })
+ .first();
+ const deployMenuTrigger = deployButtonGroup.getByRole('button', {
+ name: 'Open menu'
+ });
+
+ await expect(deployMenuTrigger).toBeVisible();
+
+ // Open dropdown and select "Always" pull policy
+ await deployMenuTrigger.click();
+ const alwaysItem = page.getByRole('menuitemradio', { name: /Always/i });
+ await expect(alwaysItem).toBeVisible();
+ await alwaysItem.click();
+ // Wait for the dropdown to fully close before reopening
+ await expect(alwaysItem).not.toBeVisible();
+
+ // Reopen dropdown and toggle "Force recreate containers"
+ await deployMenuTrigger.click();
+ const forceRecreateItem = page.getByRole('menuitemcheckbox', {
+ name: /Force recreate containers/i
+ });
+ await expect(forceRecreateItem).toBeVisible();
+ await forceRecreateItem.click();
+ // Wait for the dropdown to fully close
+ await expect(forceRecreateItem).not.toBeVisible();
+
+ // Set up request listener right before clicking to minimize timeout window
+ const deployRequestPromise = page.waitForRequest((request) => {
+ if (request.method() !== 'POST') return false;
+ return /\/api\/environments\/[^/]+\/projects\/[^/]+\/up$/.test(
+ new URL(request.url()).pathname
+ );
+ });
+
+ await page.getByRole('button', { name: 'Up', exact: true }).click();
+
+ const deployRequest = await deployRequestPromise;
+ const deployRequestBody = deployRequest.postDataJSON() as Record<string, unknown> | null;
+
+ await expect
+ .poll(() => deployRequestBody, {
+ message: 'Expected the deploy request body to be captured'
+ })
+ .not.toBeNull();
+
+ expect(deployRequestBody).toEqual({
+ pullPolicy: 'always',
+ forceRecreate: true
+ });
+ } finally {
+ if (!page.isClosed() && /\/projects\/.+/.test(new URL(page.url()).pathname)) {
+ await destroyCurrentProjectViaUI(page);
+ } else {
+ await destroyProjectByNameViaUI(page, projectName);
+ }
+ }
+ });
+
+ test('should destroy the project and remove files from disk', async ({ page }) => {
+ const projectName = `test-destroy-${Date.now()}`;
+
+ // 1. Create the project first
+ await page.getByRole('button', { name: 'My New Project' }).click();
+ await page.getByRole('textbox', { name: 'My New Project' }).fill(projectName);
+ await page.getByRole('textbox', { name: 'My New Project' }).press('Enter');
+
+ const composeEditor = page.locator('.cm-editor').first();
+ await expect(composeEditor).toBeVisible();
+ await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);
+
+ const createButton = page
+ .locator('button[data-slot="arcane-button"]')
+ .filter({ hasText: 'Create Project' });
+ await createButton.click();
+
+ await page.waitForURL(/\/projects\/.+/, { timeout: 10000 });
+ await expect(page.getByRole('button', { name: projectName })).toBeVisible();
+
+ // 2. Destroy the project
+ const destroyButton = page.getByRole('button', {
+ name: 'Destroy',
+ exact: true
+ });
+ await expect(destroyButton).toBeVisible();
+ await destroyButton.click();
+
+ // 3. Handle the confirmation dialog
+ const dialog = page.getByRole('dialog');
+ await expect(dialog).toBeVisible();
+
+ // Check "Remove project files"
+ const removeFilesCheckbox = dialog.getByLabel(/Remove project files/i);
+ await removeFilesCheckbox.check();
+
+ // Click "Destroy" in the dialog
+ const confirmDestroyButton = dialog.getByRole('button', {
+ name: 'Destroy',
+ exact: true
+ });
+ await confirmDestroyButton.click();
+
+ // 4. Verify redirection and project removal
+ await page.waitForURL(ROUTES.page, { timeout: 10000 });
+ await expect(page.getByRole('link', { name: projectName })).not.toBeVisible();
+ });
});
test.describe('GitOps Managed Project', () => {
- test('should show read-only alert when project is GitOps managed', async ({ page }) => {
- const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);
- test.skip(!gitOpsProject, 'No GitOps-managed projects found');
+ test('should show read-only alert when project is GitOps managed', async ({ page }) => {
+ const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);
+ test.skip(!gitOpsProject, 'No GitOps-managed projects found');
- await page.goto(`/projects/${gitOpsProject!.id}`);
- await page.waitForLoadState('networkidle');
+ await page.goto(`/projects/${gitOpsProject!.id}`);
+ await page.waitForLoadState('networkidle');
- // Navigate to Configuration tab
- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
- await configTab.click();
- await page.waitForLoadState('networkidle');
+ // Navigate to Configuration tab
+ const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
+ await configTab.click();
+ await page.waitForLoadState('networkidle');
- // Verify the GitOps read-only alert is visible (title contains "Git" and "Read-only")
- await expect(page.getByText('Git Read-only')).toBeVisible();
- await expect(page.getByText(/managed by Git/i)).toBeVisible();
- });
+ // Verify the GitOps read-only alert is visible (title contains "Git" and "Read-only")
+ await expect(page.getByText('Git Read-only')).toBeVisible();
+ await expect(page.getByText(/managed by Git/i)).toBeVisible();
+ });
- test('should display Sync from Git button when GitOps managed', async ({ page }) => {
- const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);
- test.skip(!gitOpsProject, 'No GitOps-managed projects found');
+ test('should display Sync from Git button when GitOps managed', async ({ page }) => {
+ const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);
+ test.skip(!gitOpsProject, 'No GitOps-managed projects found');
- await page.goto(`/projects/${gitOpsProject!.id}`);
- await page.waitForLoadState('networkidle');
+ await page.goto(`/projects/${gitOpsProject!.id}`);
+ await page.waitForLoadState('networkidle');
- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
- await configTab.click();
- await page.waitForLoadState('networkidle');
+ const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
+ await configTab.click();
+ await page.waitForLoadState('networkidle');
+
+ // Verify the Sync from Git button is present
+ await expect(page.getByRole('button', { name: 'Sync from Git' })).toBeVisible();
+ });
+
+ test('should show last sync commit when GitOps managed', async ({ page }) => {
+ const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy && p.lastSyncCommit);
+ test.skip(!gitOpsProject, 'No GitOps-managed projects with sync commit found');
+
+ await page.goto(`/projects/${gitOpsProject!.id}`);
+ await page.waitForLoadState('networkidle');
+
+ // The commit hash should be visible somewhere on the page
+ const commitHash = gitOpsProject!.lastSyncCommit!.substring(0, 7);
+ await expect(page.getByText(new RegExp(commitHash))).toBeVisible();
+ });
+
+ test('should disable name editing when GitOps managed', async ({ page }) => {
+ const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);
+ test.skip(!gitOpsProject, 'No GitOps-managed projects found');
+
+ await page.goto(`/projects/${gitOpsProject!.id}`);
+ await page.waitForLoadState('networkidle');
+
+ // The name button should be disabled for GitOps-managed projects
+ const nameButton = page.getByRole('button', { name: gitOpsProject!.name });
+ await expect(nameButton).toBeDisabled();
+ });
+
+ test('should have compose editor in read-only mode when GitOps managed', async ({ page }) => {
+ const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);
+ test.skip(!gitOpsProject, 'No GitOps-managed projects found');
+
+ await page.goto(`/projects/${gitOpsProject!.id}`);
+ await page.waitForLoadState('networkidle');
+
+ const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
+ await configTab.click();
+ await page.waitForLoadState('networkidle');
+
+ await page.waitForTimeout(800);
+ const composeContent = page.locator('.cm-editor').first().locator('.cm-content');
+ await expect(composeContent).toHaveAttribute('aria-readonly', 'true');
+ });
+
+ test('should have env editor in read-only mode when GitOps managed', async ({ page }) => {
+ const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);
+ test.skip(!gitOpsProject, 'No GitOps-managed projects found');
+
+ await page.goto(`/projects/${gitOpsProject!.id}`);
+ await page.waitForLoadState('networkidle');
+
+ const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
+ await configTab.click();
+ await page.waitForLoadState('networkidle');
+
+ await page.waitForTimeout(800);
+ const envContent = page.locator('.cm-editor').nth(1).locator('.cm-content');
+ await expect(envContent).toHaveAttribute('aria-readonly', 'true');
+ });
+
+ test('should allow editing for non-GitOps managed projects', async ({ page }) => {
+ const regularProject = realProjects.find((p) => !p.gitOpsManagedBy && p.status === 'stopped');
+ test.skip(!regularProject, 'No regular (non-GitOps) stopped projects found');
+
+ await page.goto(`/projects/${regularProject!.id}`);
+ await page.waitForLoadState('networkidle');
+
+ // The name button should be enabled for regular projects that are stopped
+ const nameButton = page.getByRole('button', { name: regularProject!.name });
+ await expect(nameButton).toBeEnabled();
+
+ // Navigate to Configuration tab
+ const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
+ await configTab.click();
+ await page.waitForLoadState('networkidle');
- // Verify the Sync from Git button is present
- await expect(page.getByRole('button', { name: 'Sync from Git' })).toBeVisible();
- });
+ // GitOps alert should NOT be visible
+ await expect(page.getByText('Git Read-only')).not.toBeVisible();
- test('should show last sync commit when GitOps managed', async ({ page }) => {
- const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy && p.lastSyncCommit);
- test.skip(!gitOpsProject, 'No GitOps-managed projects with sync commit found');
+ // Sync from Git button should NOT be visible
+ await expect(page.getByRole('button', { name: 'Sync from Git' })).not.toBeVisible();
+ });
- await page.goto(`/projects/${gitOpsProject!.id}`);
- await page.waitForLoadState('networkidle');
+ test('should not show GitOps alert on Configuration tab for regular projects', async ({
+ page
+ }) => {
+ const regularProject = realProjects.find((p) => !p.gitOpsManagedBy);
+ test.skip(!regularProject, 'No regular (non-GitOps) projects found');
- // The commit hash should be visible somewhere on the page
- const commitHash = gitOpsProject!.lastSyncCommit!.substring(0, 7);
- await expect(page.getByText(new RegExp(commitHash))).toBeVisible();
- });
+ await page.goto(`/projects/${regularProject!.id}`);
+ await page.waitForLoadState('networkidle');
- test('should disable name editing when GitOps managed', async ({ page }) => {
- const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);
- test.skip(!gitOpsProject, 'No GitOps-managed projects found');
+ const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
+ await configTab.click();
+ await page.waitForLoadState('networkidle');
- await page.goto(`/projects/${gitOpsProject!.id}`);
- await page.waitForLoadState('networkidle');
-
- // The name button should be disabled for GitOps-managed projects
- const nameButton = page.getByRole('button', { name: gitOpsProject!.name });
- await expect(nameButton).toBeDisabled();
- });
-
- test('should have compose editor in read-only mode when GitOps managed', async ({ page }) => {
- const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);
- test.skip(!gitOpsProject, 'No GitOps-managed projects found');
-
- await page.goto(`/projects/${gitOpsProject!.id}`);
- await page.waitForLoadState('networkidle');
-
- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
- await configTab.click();
- await page.waitForLoadState('networkidle');
-
- await page.waitForTimeout(800);
- const composeContent = page.locator('.cm-editor').first().locator('.cm-content');
- await expect(composeContent).toHaveAttribute('aria-readonly', 'true');
- });
-
- test('should have env editor in read-only mode when GitOps managed', async ({ page }) => {
- const gitOpsProject = realProjects.find((p) => p.gitOpsManagedBy);
- test.skip(!gitOpsProject, 'No GitOps-managed projects found');
-
- await page.goto(`/projects/${gitOpsProject!.id}`);
- await page.waitForLoadState('networkidle');
-
- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
- await configTab.click();
- await page.waitForLoadState('networkidle');
-
- await page.waitForTimeout(800);
- const envContent = page.locator('.cm-editor').nth(1).locator('.cm-content');
- await expect(envContent).toHaveAttribute('aria-readonly', 'true');
- });
-
- test('should allow editing for non-GitOps managed projects', async ({ page }) => {
- const regularProject = realProjects.find((p) => !p.gitOpsManagedBy && p.status === 'stopped');
- test.skip(!regularProject, 'No regular (non-GitOps) stopped projects found');
-
- await page.goto(`/projects/${regularProject!.id}`);
- await page.waitForLoadState('networkidle');
-
- // The name button should be enabled for regular projects that are stopped
- const nameButton = page.getByRole('button', { name: regularProject!.name });
- await expect(nameButton).toBeEnabled();
-
- // Navigate to Configuration tab
- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
- await configTab.click();
- await page.waitForLoadState('networkidle');
-
- // GitOps alert should NOT be visible
- await expect(page.getByText('Git Read-only')).not.toBeVisible();
-
- // Sync from Git button should NOT be visible
- await expect(page.getByRole('button', { name: 'Sync from Git' })).not.toBeVisible();
- });
-
- test('should not show GitOps alert on Configuration tab for regular projects', async ({ page }) => {
- const regularProject = realProjects.find((p) => !p.gitOpsManagedBy);
- test.skip(!regularProject, 'No regular (non-GitOps) projects found');
-
- await page.goto(`/projects/${regularProject!.id}`);
- await page.waitForLoadState('networkidle');
-
- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
- await configTab.click();
- await page.waitForLoadState('networkidle');
-
- // Verify no GitOps-related UI elements
- await expect(page.getByText(/managed by Git\./i)).not.toBeVisible();
- await expect(page.getByRole('button', { name: 'Sync from Git' })).not.toBeVisible();
- });
+ // Verify no GitOps-related UI elements
+ await expect(page.getByText(/managed by Git\./i)).not.toBeVisible();
+ await expect(page.getByRole('button', { name: 'Sync from Git' })).not.toBeVisible();
+ });
});
test.describe('Project Detail Page', () => {
- test('should display project details for existing project', async ({ page }) => {
- test.skip(!realProjects.length, 'No projects available for detail page test');
-
- const firstProject = realProjects[0];
- await page.goto(`/projects/${firstProject.id || firstProject.name}`);
- await page.waitForLoadState('networkidle');
-
- await expect(page.getByRole('button', { name: firstProject.name, exact: false })).toBeVisible();
-
- await expect(page.getByRole('tab', { name: /Services/i })).toBeVisible();
- await expect(page.getByRole('tab', { name: /Configuration|Config/i })).toBeVisible();
- await expect(page.getByRole('tab', { name: /Logs/i })).toBeVisible();
- });
-
- test('should display tabs navigation', async ({ page }) => {
- test.skip(!realProjects.length, 'No projects available for navigation test');
- const firstProject = realProjects[0];
- await page.goto(`/projects/${firstProject.id || firstProject.name}`);
- await page.waitForLoadState('networkidle');
-
- await expect(page.getByRole('tab', { name: /Services/i })).toBeVisible();
- await expect(page.getByRole('tab', { name: /Configuration|Config/i })).toBeVisible();
- await expect(page.getByRole('tab', { name: /Logs/i })).toBeVisible();
- });
-
- test('should display services tab content', async ({ page }) => {
- test.skip(!realProjects.length, 'No projects available for services test');
-
- const projectWithServices = realProjects.find((p) => p.serviceCount > 0) || realProjects[0];
- await page.goto(`/projects/${projectWithServices.id || projectWithServices.name}`);
- await page.waitForLoadState('networkidle');
-
- await page.getByRole('tab', { name: /Services/i }).click();
-
- const nginxService = page.getByRole('heading', { name: /nginx/i });
- const emptyState = page.getByText(/No services found/i);
-
- if ((await nginxService.count()) > 0) {
- await expect(nginxService.first()).toBeVisible();
- } else {
- const anyServiceBadge = page.locator('text=/running|stopped|unknown/i').first();
- if ((await anyServiceBadge.count()) > 0) {
- await expect(anyServiceBadge).toBeVisible();
- } else {
- await expect(emptyState).toBeVisible();
- }
- }
- });
-
- test('should display configuration editors', async ({ page }) => {
- test.skip(!realProjects.length, 'No projects available for configuration test');
-
- const firstProject = realProjects[0];
- await page.goto(`/projects/${firstProject.id || firstProject.name}`);
- await page.waitForLoadState('networkidle');
-
- const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
- await configTab.click();
-
- // The project config editor supports two layouts:
- // - classic (default): side-by-side compose.yaml + .env panels
- // - tree view: file list on the left and a single code panel on the right
- await expect(page.getByRole('heading', { name: 'compose.yaml' })).toBeVisible();
-
- const projectFilesHeading = page.getByRole('heading', {
- name: /Project Files/i,
- });
- const isTreeView = await projectFilesHeading.isVisible();
-
- if (isTreeView) {
- const composeFileButton = page.getByRole('button', { name: 'compose.yaml' }).first();
- const envFileButton = page.getByRole('button', { name: '.env' }).first();
-
- await expect(composeFileButton).toBeVisible();
- await expect(envFileButton).toBeVisible();
-
- // Switching files should update the visible code panel title
- await envFileButton.click();
- await expect(page.getByRole('heading', { name: '.env' })).toBeVisible();
-
- await composeFileButton.click();
- await expect(page.getByRole('heading', { name: 'compose.yaml' })).toBeVisible();
-
- const includesFolder = page.getByRole('button', { name: 'Includes' });
- if (await includesFolder.count()) {
- await expect(includesFolder.first()).toBeVisible();
- }
- } else {
- // Classic layout renders both editors at the same time.
- await expect(page.getByRole('heading', { name: '.env' })).toBeVisible();
-
- // Also validate that we can switch to tree view and see the file list.
- const layoutSwitch = page.getByRole('switch', {
- name: /Classic|Tree View/i,
- });
- if (await layoutSwitch.count()) {
- await layoutSwitch.click();
- await expect(projectFilesHeading).toBeVisible();
-
- const composeFileButton = page.getByRole('button', { name: 'compose.yaml' }).first();
- const envFileButton = page.getByRole('button', { name: '.env' }).first();
-
- await expect(composeFileButton).toBeVisible();
- await expect(envFileButton).toBeVisible();
-
- await envFileButton.click();
- await expect(page.getByRole('heading', { name: '.env' })).toBeVisible();
- }
- }
- });
-
- test('should show logs tab for running projects', async ({ page }) => {
- test.skip(!realProjects.length, 'No projects available for logs test');
-
- const runningProject = realProjects.find((p) => p.status === 'running');
- test.skip(!runningProject, 'No running projects found for logs test');
-
- await page.goto(`/projects/${runningProject.id || runningProject.name}`);
- await page.waitForLoadState('networkidle');
-
- const logsTab = page.getByRole('tab', { name: /Logs/i });
- await expect(logsTab).toBeEnabled();
- await logsTab.click();
-
- const logsSelected = await logsTab.getAttribute('aria-selected');
- if (logsSelected === 'true') {
- await expect(page.getByText(/Real-time project logs/i)).toBeVisible();
- await expect(page.getByRole('button', { name: /^(Start|Stop)$/i })).toBeVisible();
- await expect(page.getByRole('button', { name: 'Clear', exact: true })).toBeVisible();
-
- const startButton = page.getByRole('button', {
- name: 'Start',
- exact: true,
- });
- if ((await startButton.count()) > 0) {
- await startButton.click();
- }
-
- await expect(page.getByText(/No project selected/i)).not.toBeVisible();
- } else {
- await expect(logsTab).toBeEnabled();
- }
- });
+ test('should display project details for existing project', async ({ page }) => {
+ test.skip(!realProjects.length, 'No projects available for detail page test');
+
+ const firstProject = realProjects[0];
+ await page.goto(`/projects/${firstProject.id || firstProject.name}`);
+ await page.waitForLoadState('networkidle');
+
+ await expect(page.getByRole('button', { name: firstProject.name, exact: false })).toBeVisible();
+
+ await expect(page.getByRole('tab', { name: /Services/i })).toBeVisible();
+ await expect(page.getByRole('tab', { name: /Configuration|Config/i })).toBeVisible();
+ await expect(page.getByRole('tab', { name: /Logs/i })).toBeVisible();
+ });
+
+ test('should display tabs navigation', async ({ page }) => {
+ test.skip(!realProjects.length, 'No projects available for navigation test');
+ const firstProject = realProjects[0];
+ await page.goto(`/projects/${firstProject.id || firstProject.name}`);
+ await page.waitForLoadState('networkidle');
+
+ await expect(page.getByRole('tab', { name: /Services/i })).toBeVisible();
+ await expect(page.getByRole('tab', { name: /Configuration|Config/i })).toBeVisible();
+ await expect(page.getByRole('tab', { name: /Logs/i })).toBeVisible();
+ });
+
+ test('should display services tab content', async ({ page }) => {
+ test.skip(!realProjects.length, 'No projects available for services test');
+
+ const projectWithServices = realProjects.find((p) => p.serviceCount > 0) || realProjects[0];
+ await page.goto(`/projects/${projectWithServices.id || projectWithServices.name}`);
+ await page.waitForLoadState('networkidle');
+
+ await page.getByRole('tab', { name: /Services/i }).click();
+
+ const nginxService = page.getByRole('heading', { name: /nginx/i });
+ const emptyState = page.getByText(/No services found/i);
+
+ if ((await nginxService.count()) > 0) {
+ await expect(nginxService.first()).toBeVisible();
+ } else {
+ const anyServiceBadge = page.locator('text=/running|stopped|unknown/i').first();
+ if ((await anyServiceBadge.count()) > 0) {
+ await expect(anyServiceBadge).toBeVisible();
+ } else {
+ await expect(emptyState).toBeVisible();
+ }
+ }
+ });
+
+ test('should display configuration editors', async ({ page }) => {
+ test.skip(!realProjects.length, 'No projects available for configuration test');
+
+ const firstProject = realProjects[0];
+ await page.goto(`/projects/${firstProject.id || firstProject.name}`);
+ await page.waitForLoadState('networkidle');
+
+ const configTab = page.getByRole('tab', { name: /Configuration|Config/i });
+ await configTab.click();
+
+ // The project config editor supports two layouts:
+ // - classic (default): side-by-side compose.yaml + .env panels
+ // - tree view: file list on the left and a single code panel on the right
+ await expect(page.getByRole('heading', { name: 'compose.yaml' })).toBeVisible();
+
+ const projectFilesHeading = page.getByRole('heading', {
+ name: /Project Files/i
+ });
+ const isTreeView = await projectFilesHeading.isVisible();
+
+ if (isTreeView) {
+ const composeFileButton = page.getByRole('button', { name: 'compose.yaml' }).first();
+ const envFileButton = page.getByRole('button', { name: '.env' }).first();
+
+ await expect(composeFileButton).toBeVisible();
+ await expect(envFileButton).toBeVisible();
+
+ // Switching files should update the visible code panel title
+ await envFileButton.click();
+ await expect(page.getByRole('heading', { name: '.env' })).toBeVisible();
+
+ await composeFileButton.click();
+ await expect(page.getByRole('heading', { name: 'compose.yaml' })).toBeVisible();
+
+ const includesFolder = page.getByRole('button', { name: 'Includes' });
+ if (await includesFolder.count()) {
+ await expect(includesFolder.first()).toBeVisible();
+ }
+ } else {
+ // Classic layout renders both editors at the same time.
+ await expect(page.getByRole('heading', { name: '.env' })).toBeVisible();
+
+ // Also validate that we can switch to tree view and see the file list.
+ const layoutSwitch = page.getByRole('switch', {
+ name: /Classic|Tree View/i
+ });
+ if (await layoutSwitch.count()) {
+ await layoutSwitch.click();
+ await expect(projectFilesHeading).toBeVisible();
+
+ const composeFileButton = page.getByRole('button', { name: 'compose.yaml' }).first();
+ const envFileButton = page.getByRole('button', { name: '.env' }).first();
+
+ await expect(composeFileButton).toBeVisible();
+ await expect(envFileButton).toBeVisible();
+
+ await envFileButton.click();
+ await expect(page.getByRole('heading', { name: '.env' })).toBeVisible();
+ }
+ }
+ });
+
+ test('should show logs tab for running projects', async ({ page }) => {
+ test.skip(!realProjects.length, 'No projects available for logs test');
+
+ const runningProject = realProjects.find((p) => p.status === 'running');
+ test.skip(!runningProject, 'No running projects found for logs test');
+
+ await page.goto(`/projects/${runningProject.id || runningProject.name}`);
+ await page.waitForLoadState('networkidle');
+
+ const logsTab = page.getByRole('tab', { name: /Logs/i });
+ await expect(logsTab).toBeEnabled();
+ await logsTab.click();
+
+ const logsSelected = await logsTab.getAttribute('aria-selected');
+ if (logsSelected === 'true') {
+ await expect(page.getByText(/Real-time project logs/i)).toBeVisible();
+ await expect(page.getByRole('button', { name: /^(Start|Stop)$/i })).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Clear', exact: true })).toBeVisible();
+
+ const startButton = page.getByRole('button', {
+ name: 'Start',
+ exact: true
+ });
+ if ((await startButton.count()) > 0) {
+ await startButton.click();
+ }
+
+ await expect(page.getByText(/No project selected/i)).not.toBeVisible();
+ } else {
+ await expect(logsTab).toBeEnabled();
+ }
+ });
});
diff --git a/tests/spec/registries.spec.ts b/tests/spec/registries.spec.ts
index cb24a5357..aef071cee 100644
--- a/tests/spec/registries.spec.ts
+++ b/tests/spec/registries.spec.ts
@@ -4,85 +4,95 @@ const route = '/customize/registries';
const TOKEN = process.env.REGISTRY_TEST_TOKEN ?? 'e2e-token';
test.describe('Container Registries', () => {
- test.beforeEach(async ({ page }) => {
- await page.goto(route);
- await page.waitForLoadState('networkidle');
- });
-
- test('should display title and subtitle, and refresh', async ({ page }) => {
- await expect(page.getByRole('heading', { name: 'Container Registries', level: 1 })).toBeVisible();
- await expect(
- page.getByText('Configure access credentials for private Docker registries and container repositories').first()
- ).toBeVisible();
-
- await page.getByRole('button', { name: 'Refresh' }).click();
- await expect(page.locator('li[data-sonner-toast] div[data-title]')).toBeVisible({ timeout: 10000 });
- });
-
- test('should open Add Registry dialog and validate required fields', async ({ page }) => {
- await page.getByRole('button', { name: 'Add Registry' }).click();
-
- const dialog = page.getByRole('dialog');
- await expect(dialog).toBeVisible();
-
- // Submit without URL -> expect validation error
- await dialog.getByRole('button', { name: /Add Registry|Save Changes/ }).click();
- await expect(dialog.getByText(/Registry URL is required/i)).toBeVisible();
-
- // Close dialog
- await page.keyboard.press('Escape');
- await expect(dialog).toBeHidden();
- });
-
- test('should create, test, edit, and delete a registry', async ({ page }) => {
- // Create
- await page.getByRole('button', { name: 'Add Registry' }).click();
- const dialog = page.getByRole('dialog');
- await expect(dialog).toBeVisible();
-
- const url = `e2e.example.com-${Date.now()}`;
-
- // URL
- await dialog.getByLabel(/Registry URL|^URL$/i).fill(url);
- // Username (frontend requires it)
- await dialog.getByLabel(/^Username$/i).fill('e2e');
- // Token (backend needs it to avoid 400)
- const tokenInput = dialog.getByLabel(/token|access token/i);
- await tokenInput.fill(TOKEN);
-
- // Optional description
- const desc = dialog.getByLabel(/^Description$/i);
- if (await desc.count()) await desc.fill('E2E test registry');
-
- await dialog.getByRole('button', { name: /Add Registry/ }).click();
-
- // Creation complete when dialog closes
- await expect(dialog).toBeHidden({ timeout: 10000 });
-
- // Row should appear
- const row = page.locator('tbody tr', { hasText: url }).first();
- await expect(row).toBeVisible();
-
- // Test Connection (accept either success or failure toast)
- await row.getByRole('button', { name: 'Open menu' }).click();
- await page.getByRole('menuitem', { name: 'Test Connection' }).click();
- });
-
- test('should open Remove Selected dialog and cancel (no mutation)', async ({ page }) => {
- const firstRowCheckbox = page.locator('tbody tr input[type="checkbox"]').first();
- if (await firstRowCheckbox.count()) {
- await firstRowCheckbox.check();
-
- const removeSelected = page.getByRole('button', { name: /Remove Selected/i });
- if (await removeSelected.count()) {
- await removeSelected.click();
-
- const confirm = page.locator('div[role="heading"][aria-level="2"][data-dialog-title], [role="dialog"] >> text=Remove');
- await expect(confirm).toBeVisible();
-
- await page.getByRole('button', { name: 'Cancel' }).click();
- await expect(confirm).toBeHidden();
- }
- }
- });
+ test.beforeEach(async ({ page }) => {
+ await page.goto(route);
+ await page.waitForLoadState('networkidle');
+ });
+
+ test('should display title and subtitle, and refresh', async ({ page }) => {
+ await expect(
+ page.getByRole('heading', { name: 'Container Registries', level: 1 })
+ ).toBeVisible();
+ await expect(
+ page
+ .getByText(
+ 'Configure access credentials for private Docker registries and container repositories'
+ )
+ .first()
+ ).toBeVisible();
+
+ await page.getByRole('button', { name: 'Refresh' }).click();
+ await expect(page.locator('li[data-sonner-toast] div[data-title]')).toBeVisible({
+ timeout: 10000
+ });
+ });
+
+ test('should open Add Registry dialog and validate required fields', async ({ page }) => {
+ await page.getByRole('button', { name: 'Add Registry' }).click();
+
+ const dialog = page.getByRole('dialog');
+ await expect(dialog).toBeVisible();
+
+ // Submit without URL -> expect validation error
+ await dialog.getByRole('button', { name: /Add Registry|Save Changes/ }).click();
+ await expect(dialog.getByText(/Registry URL is required/i)).toBeVisible();
+
+ // Close dialog
+ await page.keyboard.press('Escape');
+ await expect(dialog).toBeHidden();
+ });
+
+ test('should create, test, edit, and delete a registry', async ({ page }) => {
+ // Create
+ await page.getByRole('button', { name: 'Add Registry' }).click();
+ const dialog = page.getByRole('dialog');
+ await expect(dialog).toBeVisible();
+
+ const url = `e2e.example.com-${Date.now()}`;
+
+ // URL
+ await dialog.getByLabel(/Registry URL|^URL$/i).fill(url);
+ // Username (frontend requires it)
+ await dialog.getByLabel(/^Username$/i).fill('e2e');
+ // Token (backend needs it to avoid 400)
+ const tokenInput = dialog.getByLabel(/token|access token/i);
+ await tokenInput.fill(TOKEN);
+
+ // Optional description
+ const desc = dialog.getByLabel(/^Description$/i);
+ if (await desc.count()) await desc.fill('E2E test registry');
+
+ await dialog.getByRole('button', { name: /Add Registry/ }).click();
+
+ // Creation complete when dialog closes
+ await expect(dialog).toBeHidden({ timeout: 10000 });
+
+ // Row should appear
+ const row = page.locator('tbody tr', { hasText: url }).first();
+ await expect(row).toBeVisible();
+
+ // Test Connection (accept either success or failure toast)
+ await row.getByRole('button', { name: 'Open menu' }).click();
+ await page.getByRole('menuitem', { name: 'Test Connection' }).click();
+ });
+
+ test('should open Remove Selected dialog and cancel (no mutation)', async ({ page }) => {
+ const firstRowCheckbox = page.locator('tbody tr input[type="checkbox"]').first();
+ if (await firstRowCheckbox.count()) {
+ await firstRowCheckbox.check();
+
+ const removeSelected = page.getByRole('button', { name: /Remove Selected/i });
+ if (await removeSelected.count()) {
+ await removeSelected.click();
+
+ const confirm = page.locator(
+ 'div[role="heading"][aria-level="2"][data-dialog-title], [role="dialog"] >> text=Remove'
+ );
+ await expect(confirm).toBeVisible();
+
+ await page.getByRole('button', { name: 'Cancel' }).click();
+ await expect(confirm).toBeHidden();
+ }
+ }
+ });
});
diff --git a/tests/spec/settings-notifications.spec.ts b/tests/spec/settings-notifications.spec.ts
index 8e77c1d92..86c19baad 100644
--- a/tests/spec/settings-notifications.spec.ts
+++ b/tests/spec/settings-notifications.spec.ts
@@ -1,257 +1,268 @@
import { test, expect, type Page } from '@playwright/test';
test.describe('Notification settings', () => {
- const openProviderTab = async (page: Page, name: string) => {
- const tab = page.getByRole('tab', { name });
- await tab.scrollIntoViewIfNeeded();
- await expect(tab).toBeVisible();
- await tab.click();
- await expect(page.locator('h3').filter({ hasText: name }).first()).toBeVisible();
- };
-
- const enableCurrentProvider = async (page: Page) => {
- const toggle = page.getByRole('switch').first();
- await expect(toggle).toBeVisible();
- await toggle.click();
- await expect(page.locator('[data-dropdown-menu-trigger]').last()).toBeVisible({ timeout: 10000 });
- };
-
- const openTestMenu = async (page: Page) => {
- const trigger = page.locator('[data-dropdown-menu-trigger]').last();
- await expect(trigger).toBeVisible({ timeout: 10000 });
- await trigger.click();
- };
-
- // Shared setup for all notification tests
- const setupNotificationTest = async (page: Page, provider: string) => {
- const observedErrors: string[] = [];
-
- page.on('pageerror', (err) => {
- observedErrors.push(String(err?.message ?? err));
- });
-
- page.on('console', (msg) => {
- if (msg.type() === 'error') {
- observedErrors.push(msg.text());
- }
- });
-
- let saveEndpointCalled = false;
- let testEndpointCalled = false;
-
- await page.route('**/api/environments/*/notifications/settings', async (route) => {
- const req = route.request();
- if (req.method() === 'GET') {
- await route.fulfill({
- status: 200,
- contentType: 'application/json',
- body: JSON.stringify([]),
- });
- return;
- }
-
- if (req.method() === 'POST') {
- saveEndpointCalled = true;
- await route.fulfill({
- status: 200,
- contentType: 'application/json',
- body: JSON.stringify({ success: true }),
- });
- return;
- }
-
- await route.continue();
- });
-
- await page.route('**/api/environments/*/notifications/apprise', async (route) => {
- if (route.request().method() === 'GET') {
- await route.fulfill({
- status: 404,
- contentType: 'application/json',
- body: JSON.stringify({ error: 'not configured' }),
- });
- return;
- }
-
- await route.continue();
- });
-
- // Stub the specific test endpoint
- await page.route(`**/api/environments/*/notifications/test/${provider}**`, async (route) => {
- testEndpointCalled = true;
- await route.fulfill({
- status: 200,
- contentType: 'application/json',
- body: JSON.stringify({ success: true }),
- });
- });
-
- await page.goto('/settings/notifications');
- await page.waitForLoadState('networkidle');
- await expect(page.getByRole('tab', { name: 'Built-in Notifications' })).toBeVisible();
- await expect(page.getByRole('tab', { name: 'Email' })).toBeVisible();
-
- return {
- getErrorCheck: () => {
- const stateUnsafe = observedErrors.filter((e) => e.includes('state_unsafe_mutation'));
- expect(stateUnsafe, `Unexpected state_unsafe_mutation errors: ${stateUnsafe.join('\n')}`).toHaveLength(0);
- },
- wasTestEndpointCalled: () => testEndpointCalled,
- wasSaveEndpointCalled: () => saveEndpointCalled,
- };
- };
-
- test('should allow testing email notifications without state_unsafe_mutation errors', async ({ page }) => {
- const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'email');
-
- await openProviderTab(page, 'Email');
- await enableCurrentProvider(page);
-
- // Fill fields
- await page.getByPlaceholder('smtp.example.com').fill('smtp.example.com');
- await page.getByPlaceholder('[email protected]').fill('[email protected]');
- await page.getByPlaceholder('[email protected], [email protected]').fill('[email protected]');
-
- // Trigger test
- await openTestMenu(page);
- await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
-
- // Handle Save & Test if needed
- const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
- if (await saveAndTestButton.isVisible().catch(() => false)) {
- await saveAndTestButton.click();
- }
-
- await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
- getErrorCheck();
- });
-
- test('should allow testing discord notifications', async ({ page }) => {
- const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'discord');
-
- await openProviderTab(page, 'Discord');
- await enableCurrentProvider(page);
-
- // Discord split fields
- await page.getByPlaceholder('Enter webhook ID').fill('123456789');
- await page.getByPlaceholder('Enter webhook token').fill('abc-def-ghi');
-
- await openTestMenu(page);
- await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
-
- const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
- if (await saveAndTestButton.isVisible().catch(() => false)) {
- await saveAndTestButton.click();
- }
-
- await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
- getErrorCheck();
- });
-
- test('should allow testing slack notifications', async ({ page }) => {
- const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'slack');
-
- await openProviderTab(page, 'Slack');
- await enableCurrentProvider(page);
-
- // Slack OAuth token (xoxb- or xoxp- format)
- await page.getByPlaceholder('xoxb-... or xoxp-...').fill('xoxb-123456789012-1234567890123-abcdefghijklmnopqrstuvwx');
-
- await openTestMenu(page);
- await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
+ const openProviderTab = async (page: Page, name: string) => {
+ const tab = page.getByRole('tab', { name });
+ await tab.scrollIntoViewIfNeeded();
+ await expect(tab).toBeVisible();
+ await tab.click();
+ await expect(page.locator('h3').filter({ hasText: name }).first()).toBeVisible();
+ };
+
+ const enableCurrentProvider = async (page: Page) => {
+ const toggle = page.getByRole('switch').first();
+ await expect(toggle).toBeVisible();
+ await toggle.click();
+ await expect(page.locator('[data-dropdown-menu-trigger]').last()).toBeVisible({
+ timeout: 10000
+ });
+ };
+
+ const openTestMenu = async (page: Page) => {
+ const trigger = page.locator('[data-dropdown-menu-trigger]').last();
+ await expect(trigger).toBeVisible({ timeout: 10000 });
+ await trigger.click();
+ };
+
+ // Shared setup for all notification tests
+ const setupNotificationTest = async (page: Page, provider: string) => {
+ const observedErrors: string[] = [];
+
+ page.on('pageerror', (err) => {
+ observedErrors.push(String(err?.message ?? err));
+ });
+
+ page.on('console', (msg) => {
+ if (msg.type() === 'error') {
+ observedErrors.push(msg.text());
+ }
+ });
+
+ let saveEndpointCalled = false;
+ let testEndpointCalled = false;
+
+ await page.route('**/api/environments/*/notifications/settings', async (route) => {
+ const req = route.request();
+ if (req.method() === 'GET') {
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify([])
+ });
+ return;
+ }
+
+ if (req.method() === 'POST') {
+ saveEndpointCalled = true;
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({ success: true })
+ });
+ return;
+ }
+
+ await route.continue();
+ });
+
+ await page.route('**/api/environments/*/notifications/apprise', async (route) => {
+ if (route.request().method() === 'GET') {
+ await route.fulfill({
+ status: 404,
+ contentType: 'application/json',
+ body: JSON.stringify({ error: 'not configured' })
+ });
+ return;
+ }
+
+ await route.continue();
+ });
+
+ // Stub the specific test endpoint
+ await page.route(`**/api/environments/*/notifications/test/${provider}**`, async (route) => {
+ testEndpointCalled = true;
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({ success: true })
+ });
+ });
+
+ await page.goto('/settings/notifications');
+ await page.waitForLoadState('networkidle');
+ await expect(page.getByRole('tab', { name: 'Built-in Notifications' })).toBeVisible();
+ await expect(page.getByRole('tab', { name: 'Email' })).toBeVisible();
+
+ return {
+ getErrorCheck: () => {
+ const stateUnsafe = observedErrors.filter((e) => e.includes('state_unsafe_mutation'));
+ expect(
+ stateUnsafe,
+ `Unexpected state_unsafe_mutation errors: ${stateUnsafe.join('\n')}`
+ ).toHaveLength(0);
+ },
+ wasTestEndpointCalled: () => testEndpointCalled,
+ wasSaveEndpointCalled: () => saveEndpointCalled
+ };
+ };
+
+ test('should allow testing email notifications without state_unsafe_mutation errors', async ({
+ page
+ }) => {
+ const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'email');
+
+ await openProviderTab(page, 'Email');
+ await enableCurrentProvider(page);
+
+ // Fill fields
+ await page.getByPlaceholder('smtp.example.com').fill('smtp.example.com');
+ await page.getByPlaceholder('[email protected]').fill('[email protected]');
+ await page.getByPlaceholder('[email protected], [email protected]').fill('[email protected]');
+
+ // Trigger test
+ await openTestMenu(page);
+ await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
+
+ // Handle Save & Test if needed
+ const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
+ if (await saveAndTestButton.isVisible().catch(() => false)) {
+ await saveAndTestButton.click();
+ }
+
+ await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
+ getErrorCheck();
+ });
+
+ test('should allow testing discord notifications', async ({ page }) => {
+ const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'discord');
+
+ await openProviderTab(page, 'Discord');
+ await enableCurrentProvider(page);
+
+ // Discord split fields
+ await page.getByPlaceholder('Enter webhook ID').fill('123456789');
+ await page.getByPlaceholder('Enter webhook token').fill('abc-def-ghi');
+
+ await openTestMenu(page);
+ await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
+
+ const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
+ if (await saveAndTestButton.isVisible().catch(() => false)) {
+ await saveAndTestButton.click();
+ }
+
+ await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
+ getErrorCheck();
+ });
+
+ test('should allow testing slack notifications', async ({ page }) => {
+ const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'slack');
+
+ await openProviderTab(page, 'Slack');
+ await enableCurrentProvider(page);
+
+ // Slack OAuth token (xoxb- or xoxp- format)
+ await page
+ .getByPlaceholder('xoxb-... or xoxp-...')
+ .fill('xoxb-123456789012-1234567890123-abcdefghijklmnopqrstuvwx');
+
+ await openTestMenu(page);
+ await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
+
+ const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
+ if (await saveAndTestButton.isVisible().catch(() => false)) {
+ await saveAndTestButton.click();
+ }
+
+ await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
+ getErrorCheck();
+ });
+
+ test('should allow testing telegram notifications', async ({ page }) => {
+ const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'telegram');
+
+ await openProviderTab(page, 'Telegram');
+ await enableCurrentProvider(page);
+
+ // Telegram fields (placeholders are hardcoded in component)
+ await page
+ .getByPlaceholder('123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11')
+ .fill('123456:TEST-TOKEN');
+ await page.getByPlaceholder('@channel, 123456789, @another_channel').fill('123456789');
+
+ await openTestMenu(page);
+ await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
- const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
- if (await saveAndTestButton.isVisible().catch(() => false)) {
- await saveAndTestButton.click();
- }
-
- await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
- getErrorCheck();
- });
+ const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
+ if (await saveAndTestButton.isVisible().catch(() => false)) {
+ await saveAndTestButton.click();
+ }
- test('should allow testing telegram notifications', async ({ page }) => {
- const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'telegram');
+ await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
+ getErrorCheck();
+ });
- await openProviderTab(page, 'Telegram');
- await enableCurrentProvider(page);
+ test('should allow testing generic webhook notifications', async ({ page }) => {
+ const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'generic');
- // Telegram fields (placeholders are hardcoded in component)
- await page.getByPlaceholder('123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11').fill('123456:TEST-TOKEN');
- await page.getByPlaceholder('@channel, 123456789, @another_channel').fill('123456789');
+ await openProviderTab(page, 'Generic');
+ await enableCurrentProvider(page);
- await openTestMenu(page);
- await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
+ await page.getByPlaceholder('https://example.com/webhook').fill('https://example.com/webhook');
- const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
- if (await saveAndTestButton.isVisible().catch(() => false)) {
- await saveAndTestButton.click();
- }
+ await openTestMenu(page);
+ await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
- await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
- getErrorCheck();
- });
+ const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
+ if (await saveAndTestButton.isVisible().catch(() => false)) {
+ await saveAndTestButton.click();
+ }
- test('should allow testing generic webhook notifications', async ({ page }) => {
- const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'generic');
+ await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
+ getErrorCheck();
+ });
- await openProviderTab(page, 'Generic');
- await enableCurrentProvider(page);
+ test('should allow testing signal notifications', async ({ page }) => {
+ const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'signal');
- await page.getByPlaceholder('https://example.com/webhook').fill('https://example.com/webhook');
+ await openProviderTab(page, 'Signal');
+ await enableCurrentProvider(page);
- await openTestMenu(page);
- await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
+ await page.getByPlaceholder('localhost').fill('signal-api.example.com');
+ await page.getByPlaceholder('8080').fill('8080');
+ await page.locator('#signal-source').fill('+1234567890');
+ await page.locator('#signal-recipients').fill('+1987654321');
- const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
- if (await saveAndTestButton.isVisible().catch(() => false)) {
- await saveAndTestButton.click();
- }
+ await openTestMenu(page);
+ await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
- await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
- getErrorCheck();
- });
+ const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
+ if (await saveAndTestButton.isVisible().catch(() => false)) {
+ await saveAndTestButton.click();
+ }
- test('should allow testing signal notifications', async ({ page }) => {
- const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'signal');
+ await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
+ getErrorCheck();
+ });
- await openProviderTab(page, 'Signal');
- await enableCurrentProvider(page);
+ test('should allow testing ntfy notifications', async ({ page }) => {
+ const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'ntfy');
- await page.getByPlaceholder('localhost').fill('signal-api.example.com');
- await page.getByPlaceholder('8080').fill('8080');
- await page.locator('#signal-source').fill('+1234567890');
- await page.locator('#signal-recipients').fill('+1987654321');
+ await openProviderTab(page, 'Ntfy');
+ await enableCurrentProvider(page);
- await openTestMenu(page);
- await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
+ await page.getByPlaceholder('ntfy.sh').fill('ntfy.sh');
+ await page.getByPlaceholder('my-updates').fill('arcane-updates');
- const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
- if (await saveAndTestButton.isVisible().catch(() => false)) {
- await saveAndTestButton.click();
- }
+ await openTestMenu(page);
+ await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
- await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
- getErrorCheck();
- });
+ const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
+ if (await saveAndTestButton.isVisible().catch(() => false)) {
+ await saveAndTestButton.click();
+ }
- test('should allow testing ntfy notifications', async ({ page }) => {
- const { getErrorCheck, wasTestEndpointCalled } = await setupNotificationTest(page, 'ntfy');
-
- await openProviderTab(page, 'Ntfy');
- await enableCurrentProvider(page);
-
- await page.getByPlaceholder('ntfy.sh').fill('ntfy.sh');
- await page.getByPlaceholder('my-updates').fill('arcane-updates');
-
- await openTestMenu(page);
- await page.getByRole('menuitem', { name: 'Simple Test Notification', exact: true }).click();
-
- const saveAndTestButton = page.getByRole('button', { name: 'Save & Test', exact: true });
- if (await saveAndTestButton.isVisible().catch(() => false)) {
- await saveAndTestButton.click();
- }
-
- await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
- getErrorCheck();
- });
+ await expect.poll(wasTestEndpointCalled, { timeout: 10_000 }).toBe(true);
+ getErrorCheck();
+ });
});
diff --git a/tests/spec/token-refresh.spec.ts b/tests/spec/token-refresh.spec.ts
index 3ae3fbde1..0e5affe33 100644
--- a/tests/spec/token-refresh.spec.ts
+++ b/tests/spec/token-refresh.spec.ts
@@ -1,7 +1,7 @@
-import { test, expect, type Page } from "@playwright/test";
+import { test, expect, type Page } from '@playwright/test';
-const REFRESH_TOKEN_KEY = "arcane_refresh_token";
-const TOKEN_EXPIRY_KEY = "arcane_token_expiry";
+const REFRESH_TOKEN_KEY = 'arcane_refresh_token';
+const TOKEN_EXPIRY_KEY = 'arcane_token_expiry';
/**
* Register an addInitScript that plants a fake refresh token in sessionStorage
@@ -9,13 +9,13 @@ const TOKEN_EXPIRY_KEY = "arcane_token_expiry";
* addInitScript survives page.goto() calls made later in the test.
*/
async function registerTokenSeeding(page: Page) {
- await page.addInitScript(
- ([tokenKey, expiryKey]: [string, string]) => {
- sessionStorage.setItem(tokenKey, "playwright-test-refresh-token");
- sessionStorage.setItem(expiryKey, new Date(Date.now() + 3_600_000).toISOString());
- },
- [REFRESH_TOKEN_KEY, TOKEN_EXPIRY_KEY],
- );
+ await page.addInitScript(
+ ([tokenKey, expiryKey]: [string, string]) => {
+ sessionStorage.setItem(tokenKey, 'playwright-test-refresh-token');
+ sessionStorage.setItem(expiryKey, new Date(Date.now() + 3_600_000).toISOString());
+ },
+ [REFRESH_TOKEN_KEY, TOKEN_EXPIRY_KEY]
+ );
}
/**
@@ -24,35 +24,35 @@ async function registerTokenSeeding(page: Page) {
* through. Uses a flag rather than unroute() to avoid "Route is already handled".
*/
async function injectVersionMismatch401Once(page: Page, urlPattern: string | RegExp) {
- let fired = false;
- await page.route(urlPattern, async (route) => {
- if (!fired) {
- fired = true;
- await route.fulfill({
- status: 401,
- contentType: "application/json",
- body: JSON.stringify({
- code: "UNAUTHORIZED",
- message: "Application has been updated. Please log in again.",
- }),
- });
- } else {
- await route.continue();
- }
- });
+ let fired = false;
+ await page.route(urlPattern, async (route) => {
+ if (!fired) {
+ fired = true;
+ await route.fulfill({
+ status: 401,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ code: 'UNAUTHORIZED',
+ message: 'Application has been updated. Please log in again.'
+ })
+ });
+ } else {
+ await route.continue();
+ }
+ });
}
/**
* Intercept every request matching urlPattern with a 401.
*/
async function injectExpired401Always(page: Page, urlPattern: string | RegExp) {
- await page.route(urlPattern, async (route) => {
- await route.fulfill({
- status: 401,
- contentType: "application/json",
- body: JSON.stringify({ code: "UNAUTHORIZED", message: "Invalid or expired token" }),
- });
- });
+ await page.route(urlPattern, async (route) => {
+ await route.fulfill({
+ status: 401,
+ contentType: 'application/json',
+ body: JSON.stringify({ code: 'UNAUTHORIZED', message: 'Invalid or expired token' })
+ });
+ });
}
/**
@@ -60,87 +60,95 @@ async function injectExpired401Always(page: Page, urlPattern: string | RegExp) {
* whether the endpoint was called.
*/
async function mockRefreshSuccess(page: Page): Promise<() => boolean> {
- let called = false;
- await page.route(/\/api\/auth\/refresh$/, async (route) => {
- called = true;
- await route.fulfill({
- status: 200,
- contentType: "application/json",
- body: JSON.stringify({
- success: true,
- data: {
- token: "mocked-access-token",
- refreshToken: "mocked-refresh-token",
- expiresAt: new Date(Date.now() + 3_600_000).toISOString(),
- },
- }),
- });
- });
- return () => called;
+ let called = false;
+ await page.route(/\/api\/auth\/refresh$/, async (route) => {
+ called = true;
+ await route.fulfill({
+ status: 200,
+ contentType: 'application/json',
+ body: JSON.stringify({
+ success: true,
+ data: {
+ token: 'mocked-access-token',
+ refreshToken: 'mocked-refresh-token',
+ expiresAt: new Date(Date.now() + 3_600_000).toISOString()
+ }
+ })
+ });
+ });
+ return () => called;
}
-test.describe("Token refresh behaviour", () => {
- test("version mismatch 401 on /auth/me during page load is silently recovered", async ({ page }) => {
- await registerTokenSeeding(page);
- const wasRefreshCalled = await mockRefreshSuccess(page);
- await injectVersionMismatch401Once(page, /\/api\/auth\/me$/);
-
- await page.goto("/dashboard");
- await page.waitForLoadState("networkidle");
-
- expect(wasRefreshCalled()).toBe(true);
- await expect(page).toHaveURL("/dashboard");
- await expect(page.getByRole("button", { name: "Sign in to Arcane" })).not.toBeVisible();
- });
-
- test("version mismatch 401 on a data endpoint mid-session is silently recovered", async ({ page }) => {
- await registerTokenSeeding(page);
- const wasRefreshCalled = await mockRefreshSuccess(page);
- await injectVersionMismatch401Once(page, /\/api\/environments\/0\/containers/);
-
- await page.goto("/containers");
- await page.waitForLoadState("networkidle");
-
- expect(wasRefreshCalled()).toBe(true);
- await expect(page).toHaveURL("/containers");
- await expect(page.getByRole("heading", { name: "Containers", level: 1 })).toBeVisible();
- await expect(page.getByRole("button", { name: "Sign in to Arcane" })).not.toBeVisible();
- });
-
- test("failed token refresh redirects to /login", async ({ page }) => {
- await registerTokenSeeding(page);
-
- let refreshCalled = false;
- await page.route(/\/api\/auth\/refresh$/, async (route) => {
- refreshCalled = true;
- await route.fulfill({
- status: 401,
- contentType: "application/json",
- body: JSON.stringify({ code: "UNAUTHORIZED", message: "Invalid or expired refresh token" }),
- });
- });
-
- // Force a protected data endpoint to 401 so the axios interceptor always runs refresh logic.
- await injectExpired401Always(page, /\/api\/environments\/0\/containers/);
-
- await page.goto("/containers");
- await expect.poll(() => refreshCalled).toBe(true);
- await page.waitForURL(/\/login(\?|$)/, { timeout: 15_000 });
- });
-
- test("unauthenticated users are redirected to /login", async ({ page }) => {
- await page.context().clearCookies();
- await page.goto("/dashboard");
- await page.waitForURL(/\/login/, { timeout: 10_000 });
- await page.waitForLoadState("networkidle");
- await expect(page).toHaveURL(/\/login/);
- await expect(page.getByRole("button", { name: "Sign in to Arcane", exact: true })).toBeVisible();
- });
-
- test("login page honours the redirect param and returns users to their original path", async ({ page }) => {
- await page.goto("/login?redirect=%2Fcontainers");
- await page.waitForURL(/\/containers|\/login/, { timeout: 8_000 });
- const url = page.url();
- expect(url).toMatch(/\/containers|\/login\?redirect=%2Fcontainers/);
- });
+test.describe('Token refresh behaviour', () => {
+ test('version mismatch 401 on /auth/me during page load is silently recovered', async ({
+ page
+ }) => {
+ await registerTokenSeeding(page);
+ const wasRefreshCalled = await mockRefreshSuccess(page);
+ await injectVersionMismatch401Once(page, /\/api\/auth\/me$/);
+
+ await page.goto('/dashboard');
+ await page.waitForLoadState('networkidle');
+
+ expect(wasRefreshCalled()).toBe(true);
+ await expect(page).toHaveURL('/dashboard');
+ await expect(page.getByRole('button', { name: 'Sign in to Arcane' })).not.toBeVisible();
+ });
+
+ test('version mismatch 401 on a data endpoint mid-session is silently recovered', async ({
+ page
+ }) => {
+ await registerTokenSeeding(page);
+ const wasRefreshCalled = await mockRefreshSuccess(page);
+ await injectVersionMismatch401Once(page, /\/api\/environments\/0\/containers/);
+
+ await page.goto('/containers');
+ await page.waitForLoadState('networkidle');
+
+ expect(wasRefreshCalled()).toBe(true);
+ await expect(page).toHaveURL('/containers');
+ await expect(page.getByRole('heading', { name: 'Containers', level: 1 })).toBeVisible();
+ await expect(page.getByRole('button', { name: 'Sign in to Arcane' })).not.toBeVisible();
+ });
+
+ test('failed token refresh redirects to /login', async ({ page }) => {
+ await registerTokenSeeding(page);
+
+ let refreshCalled = false;
+ await page.route(/\/api\/auth\/refresh$/, async (route) => {
+ refreshCalled = true;
+ await route.fulfill({
+ status: 401,
+ contentType: 'application/json',
+ body: JSON.stringify({ code: 'UNAUTHORIZED', message: 'Invalid or expired refresh token' })
+ });
+ });
+
+ // Force a protected data endpoint to 401 so the axios interceptor always runs refresh logic.
+ await injectExpired401Always(page, /\/api\/environments\/0\/containers/);
+
+ await page.goto('/containers');
+ await expect.poll(() => refreshCalled).toBe(true);
+ await page.waitForURL(/\/login(\?|$)/, { timeout: 15_000 });
+ });
+
+ test('unauthenticated users are redirected to /login', async ({ page }) => {
+ await page.context().clearCookies();
+ await page.goto('/dashboard');
+ await page.waitForURL(/\/login/, { timeout: 10_000 });
+ await page.waitForLoadState('networkidle');
+ await expect(page).toHaveURL(/\/login/);
+ await expect(
+ page.getByRole('button', { name: 'Sign in to Arcane', exact: true })
+ ).toBeVisible();
+ });
+
+ test('login page honours the redirect param and returns users to their original path', async ({
+ page
+ }) => {
+ await page.goto('/login?redirect=%2Fcontainers');
+ await page.waitForURL(/\/containers|\/login/, { timeout: 8_000 });
+ const url = page.url();
+ expect(url).toMatch(/\/containers|\/login\?redirect=%2Fcontainers/);
+ });
});
diff --git a/tests/spec/volumes.spec.ts b/tests/spec/volumes.spec.ts
index 2eafc7f3b..bab9d82f0 100644
--- a/tests/spec/volumes.spec.ts
+++ b/tests/spec/volumes.spec.ts
@@ -5,176 +5,182 @@ import { VolumeUsageCounts } from 'types/volumes.type';
let volumeCount: VolumeUsageCounts = { inuse: 0, unused: 0, total: 0 };
test.beforeEach(async ({ page }) => {
- await page.goto('/volumes');
- volumeCount = await fetchVolumeCountsWithRetry(page);
+ await page.goto('/volumes');
+ volumeCount = await fetchVolumeCountsWithRetry(page);
});
async function openCreateVolumeSheet(page: Page) {
- await page.goto('/volumes');
- await page.waitForLoadState('networkidle');
- await expect(page.getByRole('heading', { name: 'Volumes', level: 1 })).toBeVisible();
-
- const createButton = page.getByRole('button', { name: 'Create Volume' }).first();
- if (await createButton.isVisible().catch(() => false)) {
- await createButton.click();
- } else {
- const overflowButton = page.getByRole('button', { name: 'More actions' }).first();
- await expect(overflowButton).toBeVisible();
- await overflowButton.click();
- await page.getByRole('menuitem', { name: 'Create Volume', exact: true }).click();
- }
-
- await expect(page.getByRole('dialog')).toBeVisible();
+ await page.goto('/volumes');
+ await page.waitForLoadState('networkidle');
+ await expect(page.getByRole('heading', { name: 'Volumes', level: 1 })).toBeVisible();
+
+ const createButton = page.getByRole('button', { name: 'Create Volume' }).first();
+ if (await createButton.isVisible().catch(() => false)) {
+ await createButton.click();
+ } else {
+ const overflowButton = page.getByRole('button', { name: 'More actions' }).first();
+ await expect(overflowButton).toBeVisible();
+ await overflowButton.click();
+ await page.getByRole('menuitem', { name: 'Create Volume', exact: true }).click();
+ }
+
+ await expect(page.getByRole('dialog')).toBeVisible();
}
async function createVolumeViaUI(page: Page, volumeName: string) {
- await openCreateVolumeSheet(page);
- await page.getByRole('dialog').locator('input[type="text"]').first().fill(volumeName);
- await page.getByRole('dialog').getByRole('button', { name: 'Create Volume' }).click();
- await expect(page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')).toBeVisible();
+ await openCreateVolumeSheet(page);
+ await page.getByRole('dialog').locator('input[type="text"]').first().fill(volumeName);
+ await page.getByRole('dialog').getByRole('button', { name: 'Create Volume' }).click();
+ await expect(
+ page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')
+ ).toBeVisible();
}
async function findVolumeRow(page: Page, volumeName: string, maxRetries = 10) {
- for (let i = 0; i < maxRetries; i++) {
- const searchInput = page.getByPlaceholder(/Search/i).first();
- if (await searchInput.isVisible().catch(() => false)) {
- await searchInput.fill(volumeName);
- }
-
- const row = page.locator('tbody tr').filter({ hasText: volumeName }).first();
- if (await row.isVisible().catch(() => false)) return row;
- await page.waitForTimeout(500);
- await page.goto('/volumes');
- await page.waitForLoadState('networkidle');
- }
- return page.locator('tbody tr').filter({ hasText: volumeName }).first();
+ for (let i = 0; i < maxRetries; i++) {
+ const searchInput = page.getByPlaceholder(/Search/i).first();
+ if (await searchInput.isVisible().catch(() => false)) {
+ await searchInput.fill(volumeName);
+ }
+
+ const row = page.locator('tbody tr').filter({ hasText: volumeName }).first();
+ if (await row.isVisible().catch(() => false)) return row;
+ await page.waitForTimeout(500);
+ await page.goto('/volumes');
+ await page.waitForLoadState('networkidle');
+ }
+ return page.locator('tbody tr').filter({ hasText: volumeName }).first();
}
async function removeVolumeViaUI(page: Page, volumeName: string) {
- if (page.isClosed()) {
- return;
- }
-
- await page.goto('/volumes');
- await page.waitForLoadState('networkidle');
-
- const row = await findVolumeRow(page, volumeName, 4);
- if (!(await row.isVisible().catch(() => false))) return;
-
- await row.locator('a[href*="/volumes/"]').first().click();
- await expect(page).toHaveURL(/\/volumes\/.+/);
- await page.getByRole('button', { name: 'Remove', exact: true }).click();
- await page.getByRole('button', { name: 'Remove', exact: true }).last().click();
- await expect(page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')).toBeVisible();
+ if (page.isClosed()) {
+ return;
+ }
+
+ await page.goto('/volumes');
+ await page.waitForLoadState('networkidle');
+
+ const row = await findVolumeRow(page, volumeName, 4);
+ if (!(await row.isVisible().catch(() => false))) return;
+
+ await row.locator('a[href*="/volumes/"]').first().click();
+ await expect(page).toHaveURL(/\/volumes\/.+/);
+ await page.getByRole('button', { name: 'Remove', exact: true }).click();
+ await page.getByRole('button', { name: 'Remove', exact: true }).last().click();
+ await expect(
+ page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')
+ ).toBeVisible();
}
function facetIds(title: string) {
- const key = title.toLowerCase();
- return {
- triggerId: `facet-${key}-trigger`,
- contentId: `facet-${key}-content`,
- };
+ const key = title.toLowerCase();
+ return {
+ triggerId: `facet-${key}-trigger`,
+ contentId: `facet-${key}-content`
+ };
}
async function ensureFacetOpen(page: Page, title: string) {
- const { triggerId, contentId } = facetIds(title);
- const trigger = page.getByTestId(triggerId).first();
- const content = page.getByTestId(contentId).first();
+ const { triggerId, contentId } = facetIds(title);
+ const trigger = page.getByTestId(triggerId).first();
+ const content = page.getByTestId(contentId).first();
- if (await content.isVisible().catch(() => false)) return { trigger, content };
+ if (await content.isVisible().catch(() => false)) return { trigger, content };
- if ((await trigger.getAttribute('data-state')) !== 'open') await trigger.click();
- await content.waitFor({ state: 'visible' });
- return { trigger, content };
+ if ((await trigger.getAttribute('data-state')) !== 'open') await trigger.click();
+ await content.waitFor({ state: 'visible' });
+ return { trigger, content };
}
test.describe('Volumes Page', () => {
- test('Volume Page Display', async ({ page }) => {
- await page.goto('/volumes');
-
- await expect(page.getByRole('heading', { name: 'Volumes', level: 1 })).toBeVisible();
- await expect(page.getByText('Manage your Docker volumes').first()).toBeVisible();
- });
-
- test('Correct Volume Stat Card Counts', async ({ page }) => {
- await page.goto('/volumes');
- await page.waitForLoadState('networkidle');
-
- await expect(page.getByText(`${volumeCount.total} Total Volumes`)).toBeVisible();
- });
-
- test('Create Volume Sheet Opens', async ({ page }) => {
- await openCreateVolumeSheet(page);
- await expect(page.getByText('Create New Volume')).toBeVisible();
- });
-
- test('Display Volume Filters', async ({ page }) => {
- await page.goto('/volumes');
- await page.waitForLoadState('networkidle');
-
- const { content } = await ensureFacetOpen(page, 'Usage');
- await expect(content.getByRole('option', { name: /In Use\b/i })).toBeVisible();
- await expect(content.getByRole('option', { name: /Unused\b/i })).toBeVisible();
- });
-
- test('Inspect Volume', async ({ page }) => {
- const volumeName = `e2e-inspect-volume-${Date.now()}`;
-
- try {
- await createVolumeViaUI(page, volumeName);
- await page.goto('/volumes');
- await page.waitForLoadState('networkidle');
-
- const row = await findVolumeRow(page, volumeName);
- await expect(row).toBeVisible();
- await row.locator('a[href*="/volumes/"]').first().click();
-
- await expect(page).toHaveURL(new RegExp(`/volumes/.+`));
- await expect(page.getByRole('heading', { level: 1, name: volumeName })).toBeVisible();
- } finally {
- await removeVolumeViaUI(page, volumeName);
- }
- });
-
- test('Remove Volume', async ({ page }) => {
- const volumeName = `test-remove-volume-${Date.now()}`;
- await createVolumeViaUI(page, volumeName);
- await page.goto('/volumes');
- await page.waitForLoadState('networkidle');
-
- const row = await findVolumeRow(page, volumeName);
- await expect(row).toBeVisible();
- await row.locator('a[href*="/volumes/"]').first().click();
- await expect(page).toHaveURL(new RegExp(`/volumes/.+`));
- await page.getByRole('button', { name: 'Remove', exact: true }).click();
- await page.getByRole('button', { name: 'Remove', exact: true }).last().click();
-
- await expect(page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')).toBeVisible();
- });
-
- test('Create Volume', async ({ page }) => {
- const volumeName = `test-volume-${Date.now()}`;
- try {
- await createVolumeViaUI(page, volumeName);
- await page.goto('/volumes');
- await expect(await findVolumeRow(page, volumeName)).toBeVisible();
- } finally {
- await removeVolumeViaUI(page, volumeName);
- }
- });
-
- test('Display correct volume usage badge', async ({ page }) => {
- const volumeName = `e2e-badge-volume-${Date.now()}`;
- try {
- await createVolumeViaUI(page, volumeName);
- await page.goto('/volumes');
- await page.waitForLoadState('networkidle');
-
- const row = await findVolumeRow(page, volumeName);
- await expect(row).toBeVisible();
- await expect(row.getByText('Unused')).toBeVisible();
- } finally {
- await removeVolumeViaUI(page, volumeName);
- }
- });
+ test('Volume Page Display', async ({ page }) => {
+ await page.goto('/volumes');
+
+ await expect(page.getByRole('heading', { name: 'Volumes', level: 1 })).toBeVisible();
+ await expect(page.getByText('Manage your Docker volumes').first()).toBeVisible();
+ });
+
+ test('Correct Volume Stat Card Counts', async ({ page }) => {
+ await page.goto('/volumes');
+ await page.waitForLoadState('networkidle');
+
+ await expect(page.getByText(`${volumeCount.total} Total Volumes`)).toBeVisible();
+ });
+
+ test('Create Volume Sheet Opens', async ({ page }) => {
+ await openCreateVolumeSheet(page);
+ await expect(page.getByText('Create New Volume')).toBeVisible();
+ });
+
+ test('Display Volume Filters', async ({ page }) => {
+ await page.goto('/volumes');
+ await page.waitForLoadState('networkidle');
+
+ const { content } = await ensureFacetOpen(page, 'Usage');
+ await expect(content.getByRole('option', { name: /In Use\b/i })).toBeVisible();
+ await expect(content.getByRole('option', { name: /Unused\b/i })).toBeVisible();
+ });
+
+ test('Inspect Volume', async ({ page }) => {
+ const volumeName = `e2e-inspect-volume-${Date.now()}`;
+
+ try {
+ await createVolumeViaUI(page, volumeName);
+ await page.goto('/volumes');
+ await page.waitForLoadState('networkidle');
+
+ const row = await findVolumeRow(page, volumeName);
+ await expect(row).toBeVisible();
+ await row.locator('a[href*="/volumes/"]').first().click();
+
+ await expect(page).toHaveURL(new RegExp(`/volumes/.+`));
+ await expect(page.getByRole('heading', { level: 1, name: volumeName })).toBeVisible();
+ } finally {
+ await removeVolumeViaUI(page, volumeName);
+ }
+ });
+
+ test('Remove Volume', async ({ page }) => {
+ const volumeName = `test-remove-volume-${Date.now()}`;
+ await createVolumeViaUI(page, volumeName);
+ await page.goto('/volumes');
+ await page.waitForLoadState('networkidle');
+
+ const row = await findVolumeRow(page, volumeName);
+ await expect(row).toBeVisible();
+ await row.locator('a[href*="/volumes/"]').first().click();
+ await expect(page).toHaveURL(new RegExp(`/volumes/.+`));
+ await page.getByRole('button', { name: 'Remove', exact: true }).click();
+ await page.getByRole('button', { name: 'Remove', exact: true }).last().click();
+
+ await expect(
+ page.locator('li[data-sonner-toast][data-type="success"] div[data-title]')
+ ).toBeVisible();
+ });
+
+ test('Create Volume', async ({ page }) => {
+ const volumeName = `test-volume-${Date.now()}`;
+ try {
+ await createVolumeViaUI(page, volumeName);
+ await page.goto('/volumes');
+ await expect(await findVolumeRow(page, volumeName)).toBeVisible();
+ } finally {
+ await removeVolumeViaUI(page, volumeName);
+ }
+ });
+
+ test('Display correct volume usage badge', async ({ page }) => {
+ const volumeName = `e2e-badge-volume-${Date.now()}`;
+ try {
+ await createVolumeViaUI(page, volumeName);
+ await page.goto('/volumes');
+ await page.waitForLoadState('networkidle');
+
+ const row = await findVolumeRow(page, volumeName);
+ await expect(row).toBeVisible();
+ await expect(row.getByText('Unused')).toBeVisible();
+ } finally {
+ await removeVolumeViaUI(page, volumeName);
+ }
+ });
});
diff --git a/tests/types/api-key.type.ts b/tests/types/api-key.type.ts
index 33795539f..89b23db67 100644
--- a/tests/types/api-key.type.ts
+++ b/tests/types/api-key.type.ts
@@ -1,11 +1,11 @@
export type ApiKey = {
- id: string;
- name: string;
- description?: string;
- keyPrefix: string;
- userId: string;
- expiresAt?: string;
- lastUsedAt?: string;
- createdAt: string;
- updatedAt?: string;
+ id: string;
+ name: string;
+ description?: string;
+ keyPrefix: string;
+ userId: string;
+ expiresAt?: string;
+ lastUsedAt?: string;
+ createdAt: string;
+ updatedAt?: string;
};
diff --git a/tests/types/containers.type.ts b/tests/types/containers.type.ts
index cad285394..c3393ebc0 100644
--- a/tests/types/containers.type.ts
+++ b/tests/types/containers.type.ts
@@ -1,8 +1,8 @@
export type ContainerSummary = {
- id: string;
- names?: string[];
- image?: string;
- state: string;
- status?: string;
- created?: number;
+ id: string;
+ names?: string[];
+ image?: string;
+ state: string;
+ status?: string;
+ created?: number;
};
diff --git a/tests/types/image.type.ts b/tests/types/image.type.ts
index a9a2844c3..359d89d42 100644
--- a/tests/types/image.type.ts
+++ b/tests/types/image.type.ts
@@ -1,29 +1,29 @@
export interface ImageUsageCounts {
- imagesInuse: number;
- imagesUnused: number;
- totalImages: number;
- totalImageSize: number;
+ imagesInuse: number;
+ imagesUnused: number;
+ totalImages: number;
+ totalImageSize: number;
}
export interface ImageUpdateInfo {
- hasUpdate: boolean;
- updateType: string;
- currentVersion?: string;
- latestVersion?: string;
- currentDigest?: string;
- latestDigest?: string;
- checkTime: string;
- responseTimeMs: number;
- error?: string;
- authMethod?: 'none' | 'anonymous' | 'credential' | 'unknown';
- authUsername?: string;
- authRegistry?: string;
- usedCredential?: boolean;
+ hasUpdate: boolean;
+ updateType: string;
+ currentVersion?: string;
+ latestVersion?: string;
+ currentDigest?: string;
+ latestDigest?: string;
+ checkTime: string;
+ responseTimeMs: number;
+ error?: string;
+ authMethod?: 'none' | 'anonymous' | 'credential' | 'unknown';
+ authUsername?: string;
+ authRegistry?: string;
+ usedCredential?: boolean;
}
export interface ImageUpdateSummary {
- totalImages: number;
- imagesWithUpdates: number;
- digestUpdates: number;
- errorsCount: number;
+ totalImages: number;
+ imagesWithUpdates: number;
+ digestUpdates: number;
+ errorsCount: number;
}
diff --git a/tests/types/networks.type.ts b/tests/types/networks.type.ts
index e9de86938..3e5426082 100644
--- a/tests/types/networks.type.ts
+++ b/tests/types/networks.type.ts
@@ -1,12 +1,12 @@
export interface NetworkUsageCounts {
- inuse: number;
- unused: number;
- total: number;
+ inuse: number;
+ unused: number;
+ total: number;
}
export type NetworkSummary = {
- id: string;
- name: string;
- driver?: string;
- scope?: string;
+ id: string;
+ name: string;
+ driver?: string;
+ scope?: string;
};
diff --git a/tests/types/project.type.ts b/tests/types/project.type.ts
index 7f85dbf8a..536ad753d 100644
--- a/tests/types/project.type.ts
+++ b/tests/types/project.type.ts
@@ -1,13 +1,13 @@
export type Project = {
- id?: string;
- name?: string;
- status?: string;
- serviceCount?: number;
- [key: string]: any;
+ id?: string;
+ name?: string;
+ status?: string;
+ serviceCount?: number;
+ [key: string]: any;
};
export interface ProjectStatusCounts {
- runningProjects: number;
- stoppedProjects: number;
- totalProjects: number;
+ runningProjects: number;
+ stoppedProjects: number;
+ totalProjects: number;
}
diff --git a/tests/types/volumes.type.ts b/tests/types/volumes.type.ts
index 8a92daf8d..bc0412892 100644
--- a/tests/types/volumes.type.ts
+++ b/tests/types/volumes.type.ts
@@ -1,5 +1,5 @@
export interface VolumeUsageCounts {
- inuse: number;
- unused: number;
- total: number;
+ inuse: number;
+ unused: number;
+ total: number;
}
diff --git a/tests/utils/auth.util.ts b/tests/utils/auth.util.ts
index 9ab5f4ce2..cfa28e297 100644
--- a/tests/utils/auth.util.ts
+++ b/tests/utils/auth.util.ts
@@ -1,20 +1,23 @@
import type { Page } from '@playwright/test';
async function login(page: Page) {
- await page.goto('/login');
- await page.getByLabel('Username').fill('arcane');
- await page.getByLabel('Password').fill('arcane-admin');
- await page.getByRole('button', { name: 'Sign in to Arcane', exact: true }).click();
+ await page.goto('/login');
+ await page.getByLabel('Username').fill('arcane');
+ await page.getByLabel('Password').fill('arcane-admin');
+ await page.getByRole('button', { name: 'Sign in to Arcane', exact: true }).click();
}
async function changeDefaultPassword(page: Page, newPassword: string) {
- const dialog = page.getByRole('dialog', { name: 'Change Default Password' });
- await dialog.waitFor({ state: 'visible' });
- await dialog.getByRole('textbox', { name: 'Current Password' }).fill('arcane-admin');
- await dialog.getByRole('textbox', { name: 'New Password', exact: true }).fill(newPassword);
- await dialog.getByRole('textbox', { name: 'Confirm New Password' }).fill(newPassword);
- await dialog.getByRole('button', { name: 'Change Password' }).click();
- await page.getByRole('listitem').filter({ hasText: 'Password changed successfully' }).waitFor({ state: 'visible' });
+ const dialog = page.getByRole('dialog', { name: 'Change Default Password' });
+ await dialog.waitFor({ state: 'visible' });
+ await dialog.getByRole('textbox', { name: 'Current Password' }).fill('arcane-admin');
+ await dialog.getByRole('textbox', { name: 'New Password', exact: true }).fill(newPassword);
+ await dialog.getByRole('textbox', { name: 'Confirm New Password' }).fill(newPassword);
+ await dialog.getByRole('button', { name: 'Change Password' }).click();
+ await page
+ .getByRole('listitem')
+ .filter({ hasText: 'Password changed successfully' })
+ .waitFor({ state: 'visible' });
}
export default { login, changeDefaultPassword };
diff --git a/tests/utils/fetch.util.ts b/tests/utils/fetch.util.ts
index 2832c575a..366a8d6de 100644
--- a/tests/utils/fetch.util.ts
+++ b/tests/utils/fetch.util.ts
@@ -9,132 +9,153 @@ import { ApiKey } from 'types/api-key.type';
export type Paginated<T> = { data: T[]; pagination?: { totalItems?: number } };
async function retry<T>(fn: () => Promise<T>, maxRetries: number, delayMs = 1000): Promise<T> {
- let attempt = 0;
- while (true) {
- try {
- return await fn();
- } catch (e) {
- attempt++;
- if (attempt >= maxRetries) throw e;
- await new Promise((r) => setTimeout(r, delayMs));
- }
- }
+ let attempt = 0;
+ while (true) {
+ try {
+ return await fn();
+ } catch (e) {
+ attempt++;
+ if (attempt >= maxRetries) throw e;
+ await new Promise((r) => setTimeout(r, delayMs));
+ }
+ }
}
export async function fetchVolumesWithRetry(page: Page, maxRetries = 1): Promise<any[]> {
- return retry(async () => {
- const res = await page.request.get('/api/environments/0/volumes');
- const json = await res.json();
- return Array.isArray(json?.data) ? json.data : [];
- }, maxRetries);
+ return retry(async () => {
+ const res = await page.request.get('/api/environments/0/volumes');
+ const json = await res.json();
+ return Array.isArray(json?.data) ? json.data : [];
+ }, maxRetries);
}
-export async function fetchVolumeCountsWithRetry(page: Page, maxRetries = 3): Promise<VolumeUsageCounts> {
- return retry(
- async () => {
- const res = await page.request.get('/api/environments/0/volumes/counts');
- const json = await res.json().catch(() => null);
- // API returns { success: true, data: { inuse, unused, total } }
- const data = json?.data ?? { inuse: 0, unused: 0, total: 0 };
- return data as VolumeUsageCounts;
- },
- maxRetries,
- 800
- );
+export async function fetchVolumeCountsWithRetry(
+ page: Page,
+ maxRetries = 3
+): Promise<VolumeUsageCounts> {
+ return retry(
+ async () => {
+ const res = await page.request.get('/api/environments/0/volumes/counts');
+ const json = await res.json().catch(() => null);
+ // API returns { success: true, data: { inuse, unused, total } }
+ const data = json?.data ?? { inuse: 0, unused: 0, total: 0 };
+ return data as VolumeUsageCounts;
+ },
+ maxRetries,
+ 800
+ );
}
const PROJECTS_ENDPOINT = '/api/environments/0/projects';
export async function fetchProjectsWithRetry(page: Page, maxRetries = 3): Promise<Project[]> {
- return retry(async () => {
- const res = await page.request.get(PROJECTS_ENDPOINT);
- const body = await res.json().catch(() => null as any);
- if (Array.isArray(body)) return body;
- if (Array.isArray(body?.data)) return body.data;
- if (Array.isArray(body?.projects)) return body.projects;
- return [];
- }, maxRetries);
+ return retry(async () => {
+ const res = await page.request.get(PROJECTS_ENDPOINT);
+ const body = await res.json().catch(() => null as any);
+ if (Array.isArray(body)) return body;
+ if (Array.isArray(body?.data)) return body.data;
+ if (Array.isArray(body?.projects)) return body.projects;
+ return [];
+ }, maxRetries);
}
-export async function fetchProjectCountsWithRetry(page: Page, maxRetries = 3): Promise<ProjectStatusCounts> {
- return retry(
- async () => {
- const res = await page.request.get('/api/environments/0/projects/counts');
- const json = await res.json().catch(() => null);
- const data = Array.isArray(json) ? json : json?.data?.data ?? json?.data ?? [];
- return data as ProjectStatusCounts;
- },
- maxRetries,
- 800
- );
+export async function fetchProjectCountsWithRetry(
+ page: Page,
+ maxRetries = 3
+): Promise<ProjectStatusCounts> {
+ return retry(
+ async () => {
+ const res = await page.request.get('/api/environments/0/projects/counts');
+ const json = await res.json().catch(() => null);
+ const data = Array.isArray(json) ? json : (json?.data?.data ?? json?.data ?? []);
+ return data as ProjectStatusCounts;
+ },
+ maxRetries,
+ 800
+ );
}
-export async function fetchNetworksWithRetry(page: Page, maxRetries = 3): Promise<NetworkSummary[]> {
- return retry(
- async () => {
- const res = await page.request.get('/api/environments/0/networks');
- const json = await res.json().catch(() => null);
- const data = Array.isArray(json) ? json : json?.data?.data ?? json?.data ?? [];
- return (data ?? []) as NetworkSummary[];
- },
- maxRetries,
- 800
- );
+export async function fetchNetworksWithRetry(
+ page: Page,
+ maxRetries = 3
+): Promise<NetworkSummary[]> {
+ return retry(
+ async () => {
+ const res = await page.request.get('/api/environments/0/networks');
+ const json = await res.json().catch(() => null);
+ const data = Array.isArray(json) ? json : (json?.data?.data ?? json?.data ?? []);
+ return (data ?? []) as NetworkSummary[];
+ },
+ maxRetries,
+ 800
+ );
}
-export async function fetchNetworksCountsWithRetry(page: Page, maxRetries = 3): Promise<NetworkUsageCounts> {
- return retry(
- async () => {
- const res = await page.request.get('/api/environments/0/networks/counts');
- const json = await res.json().catch(() => null);
- // API returns { success: true, data: { inuse, unused, total } }
- const data = json?.data ?? { inuse: 0, unused: 0, total: 0 };
- return data as NetworkUsageCounts;
- },
- maxRetries,
- 800
- );
+export async function fetchNetworksCountsWithRetry(
+ page: Page,
+ maxRetries = 3
+): Promise<NetworkUsageCounts> {
+ return retry(
+ async () => {
+ const res = await page.request.get('/api/environments/0/networks/counts');
+ const json = await res.json().catch(() => null);
+ // API returns { success: true, data: { inuse, unused, total } }
+ const data = json?.data ?? { inuse: 0, unused: 0, total: 0 };
+ return data as NetworkUsageCounts;
+ },
+ maxRetries,
+ 800
+ );
}
export async function fetchImagesWithRetry(page: Page, maxRetries = 3): Promise<any[]> {
- return retry(async () => {
- const res = await page.request.get('/api/environments/0/images');
- if (!res.ok()) throw new Error(`HTTP ${res.status()}`);
- const body = await res.json().catch(() => null as any);
- return Array.isArray(body?.data) ? body.data : [];
- }, maxRetries);
+ return retry(async () => {
+ const res = await page.request.get('/api/environments/0/images');
+ if (!res.ok()) throw new Error(`HTTP ${res.status()}`);
+ const body = await res.json().catch(() => null as any);
+ return Array.isArray(body?.data) ? body.data : [];
+ }, maxRetries);
}
-export async function fetchImageCountsWithRetry(page: Page, maxRetries = 3): Promise<ImageUsageCounts> {
- return retry(
- async () => {
- const res = await page.request.get('/api/environments/0/images/counts');
- const json = await res.json().catch(() => null);
- const data = Array.isArray(json) ? json : json?.data?.data ?? json?.data ?? [];
- return data as ImageUsageCounts;
- },
- maxRetries,
- 800
- );
+export async function fetchImageCountsWithRetry(
+ page: Page,
+ maxRetries = 3
+): Promise<ImageUsageCounts> {
+ return retry(
+ async () => {
+ const res = await page.request.get('/api/environments/0/images/counts');
+ const json = await res.json().catch(() => null);
+ const data = Array.isArray(json) ? json : (json?.data?.data ?? json?.data ?? []);
+ return data as ImageUsageCounts;
+ },
+ maxRetries,
+ 800
+ );
}
-export async function fetchContainersWithRetry(page: Page, maxRetries = 3): Promise<Paginated<ContainerSummary>> {
- return retry(async () => {
- const res = await page.request.get('/api/environments/0/containers');
- if (!res.ok()) throw new Error(`HTTP ${res.status()}`);
- const body = await res.json().catch(() => null as any);
- const data = Array.isArray(body?.data) ? (body.data as ContainerSummary[]) : [];
- const pagination = body?.pagination || { totalItems: data.length };
- return { data, pagination };
- }, maxRetries);
+export async function fetchContainersWithRetry(
+ page: Page,
+ maxRetries = 3
+): Promise<Paginated<ContainerSummary>> {
+ return retry(async () => {
+ const res = await page.request.get('/api/environments/0/containers');
+ if (!res.ok()) throw new Error(`HTTP ${res.status()}`);
+ const body = await res.json().catch(() => null as any);
+ const data = Array.isArray(body?.data) ? (body.data as ContainerSummary[]) : [];
+ const pagination = body?.pagination || { totalItems: data.length };
+ return { data, pagination };
+ }, maxRetries);
}
-export async function fetchApiKeysWithRetry(page: Page, maxRetries = 3): Promise<Paginated<ApiKey>> {
- return retry(async () => {
- const res = await page.request.get('/api/api-keys');
- if (!res.ok()) throw new Error(`HTTP ${res.status()}`);
- const body = await res.json().catch(() => null as any);
- const data = Array.isArray(body?.data) ? (body.data as ApiKey[]) : [];
- const pagination = body?.pagination || { totalItems: data.length };
- return { data, pagination };
- }, maxRetries);
+export async function fetchApiKeysWithRetry(
+ page: Page,
+ maxRetries = 3
+): Promise<Paginated<ApiKey>> {
+ return retry(async () => {
+ const res = await page.request.get('/api/api-keys');
+ if (!res.ok()) throw new Error(`HTTP ${res.status()}`);
+ const body = await res.json().catch(() => null as any);
+ const data = Array.isArray(body?.data) ? (body.data as ApiKey[]) : [];
+ const pagination = body?.pagination || { totalItems: data.length };
+ return { data, pagination };
+ }, maxRetries);
}
diff --git a/tests/utils/playwright.util.ts b/tests/utils/playwright.util.ts
index 245768f17..18a4e12c9 100644
--- a/tests/utils/playwright.util.ts
+++ b/tests/utils/playwright.util.ts
@@ -1,31 +1,31 @@
import playwrightConfig from '../playwright.config';
export async function createTestApiKeys(count: number = 2) {
- const url = new URL('/api/playwright/create-test-api-keys', playwrightConfig.use!.baseURL);
+ const url = new URL('/api/playwright/create-test-api-keys', playwrightConfig.use!.baseURL);
- const response = await fetch(url, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ count }),
- });
+ const response = await fetch(url, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({ count })
+ });
- if (!response.ok) {
- throw new Error(`Failed to create test API keys: ${response.status} ${response.statusText}`);
- }
+ if (!response.ok) {
+ throw new Error(`Failed to create test API keys: ${response.status} ${response.statusText}`);
+ }
- return response.json();
+ return response.json();
}
export async function deleteTestApiKeys() {
- const url = new URL('/api/playwright/delete-test-api-keys', playwrightConfig.use!.baseURL);
+ const url = new URL('/api/playwright/delete-test-api-keys', playwrightConfig.use!.baseURL);
- const response = await fetch(url, {
- method: 'POST',
- });
+ const response = await fetch(url, {
+ method: 'POST'
+ });
- if (!response.ok) {
- throw new Error(`Failed to delete test API keys: ${response.status} ${response.statusText}`);
- }
+ if (!response.ok) {
+ throw new Error(`Failed to delete test API keys: ${response.status} ${response.statusText}`);
+ }
}