Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

test(e2e): replace three assertions that could not fail

Sergey Kozyrenko2fd4c0b68515
diff --git a/frontend/e2e/specs/cross/themes.spec.ts b/frontend/e2e/specs/cross/themes.spec.ts
index 4c13af86..c3e916d3 100644
--- a/frontend/e2e/specs/cross/themes.spec.ts
+++ b/frontend/e2e/specs/cross/themes.spec.ts
@@ -20,14 +20,14 @@ test.describe('themes', { tag: '@cross' }, () => {
test('switches themes from the sidebar user menu', async ({ page, pageErrorLog }) => {
await page.goto('/flows');
- await expect(page.locator('html')).not.toHaveClass(/dark/);
+ await expect(page.locator('html')).toHaveClass(/light/);
await page.getByRole('button', { name: /admin@pentagi\.com/ }).click();
await page.getByRole('tab', { name: 'Dark theme' }).click();
await expect(page.locator('html')).toHaveClass(/dark/);
await page.getByRole('tab', { name: 'Light theme' }).click();
- await expect(page.locator('html')).not.toHaveClass(/dark/);
+ await expect(page.locator('html')).toHaveClass(/light/);
expectCleanPage(pageErrorLog);
});
});
diff --git a/frontend/e2e/specs/flows/lifecycle.spec.ts b/frontend/e2e/specs/flows/lifecycle.spec.ts
index 3df3f2d2..4354e541 100644
--- a/frontend/e2e/specs/flows/lifecycle.spec.ts
+++ b/frontend/e2e/specs/flows/lifecycle.spec.ts
@@ -95,6 +95,9 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
await page.getByRole('button', { name: 'Flow actions' }).click();
+ // Anchor on an item that stays: absence alone also holds while the
+ // reopened menu is still rendering.
+ await expect(page.getByRole('menuitem', { name: 'Rename' })).toBeVisible();
await expect(page.getByRole('menuitem', { name: 'Finish' })).toBeHidden();
expectCleanPage(pageErrorLog);
});
@@ -175,7 +178,10 @@ test.describe('flow lifecycle', { tag: '@flows' }, () => {
const dialog = page.getByRole('dialog');
await expect(dialog.getByText('Delete flow')).toBeVisible();
- await expect(dialog.getByRole('button', { name: 'Delete' })).toHaveClass(/destructive/);
+ // Anchored on the variant's own fill: every shadcn Button carries
+ // `border-destructive`/`ring-destructive` in its base for the invalid
+ // state, so a bare /destructive/ matches whatever variant is set.
+ await expect(dialog.getByRole('button', { name: 'Delete' })).toHaveClass(/(^|\s)bg-destructive(\s|$)/);
await dialog.getByRole('button', { name: 'Delete' }).click();
await expect(page.getByText('Flow deleted successfully')).toBeVisible();
diff --git a/frontend/e2e/specs/flows/messages.spec.ts b/frontend/e2e/specs/flows/messages.spec.ts
index 007ac6f5..9b035129 100644
--- a/frontend/e2e/specs/flows/messages.spec.ts
+++ b/frontend/e2e/specs/flows/messages.spec.ts
@@ -60,8 +60,13 @@ test.describe('flow message rendering', { tag: '@flows' }, () => {
expect(await page.evaluate(anyTerminalContains, 'e2e-terminal-marker')).toBe(true);
}).toPass();
- // input message right-aligns its row
- await expect(page.locator('.items-end').first()).toBeVisible();
+ // Only the input message right-aligns: pinning the count and the text means
+ // an inverted alignment ternary fails on both counts instead of finding some
+ // other right-aligned element on the page.
+ const rightAligned = page.locator('.items-end');
+
+ await expect(rightAligned).toHaveCount(1);
+ await expect(rightAligned).toContainText('run the smoke command');
expectCleanPage(pageErrorLog);
});