diff --git a/tests/integration/tests/23-truenas-infrastructure-storage-links.spec.ts b/tests/integration/tests/23-truenas-infrastructure-storage-links.spec.ts deleted file mode 100644 index 05b64334d..000000000 --- a/tests/integration/tests/23-truenas-infrastructure-storage-links.spec.ts +++ /dev/null @@ -1,159 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; -import { test as base, expect } from '@playwright/test'; -import { createAuthenticatedStorageState } from './helpers'; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); - -type WorkerFixtures = { - authStorageStatePath: string; -}; - -const SCREENSHOT_PATH = '/tmp/truenas-infrastructure-storage-recovery-links.png'; - -const test = base.extend<{}, WorkerFixtures>({ - storageState: async ({ authStorageStatePath }, use) => { - await use(authStorageStatePath); - }, - authStorageStatePath: [async ({ browser }, use, workerInfo) => { - const storageStatePath = path.resolve( - __dirname, - '..', - '..', - 'tmp', - 'playwright-auth', - `truenas-infrastructure-storage-links-${workerInfo.project.name}.json`, - ); - fs.mkdirSync(path.dirname(storageStatePath), { recursive: true }); - await createAuthenticatedStorageState(browser, storageStatePath); - try { - await use(storageStatePath); - } finally { - fs.rmSync(storageStatePath, { force: true }); - } - }, { scope: 'worker' }], -}); - -test.describe('TrueNAS infrastructure storage and recovery links', () => { - test.setTimeout(180_000); - - test('surfaces canonical workloads, storage, and recovery links for top-level TrueNAS systems', async ({ - page, - }) => { - await page.route('**/api/resources**', async (route) => { - const requestUrl = new URL(route.request().url()); - - if (requestUrl.pathname === '/api/resources') { - await route.fulfill({ - status: 200, - contentType: 'application/json', - body: JSON.stringify({ - data: [ - { - id: 'truenas-main', - type: 'agent', - name: 'truenas-main', - displayName: 'TrueNAS Main', - platformId: 'truenas-main', - platformType: 'truenas', - sourceType: 'hybrid', - sources: ['agent', 'truenas'], - status: 'online', - lastSeen: '2026-03-29T22:00:00Z', - canonicalIdentity: { - displayName: 'TrueNAS Main', - hostname: 'truenas-main', - platformId: 'truenas-main', - }, - platformData: { - sources: ['agent', 'truenas'], - }, - }, - { - id: 'storage-truenas-display', - type: 'storage', - name: 'tank', - displayName: 'tank', - parentId: 'truenas-main', - parentName: 'TrueNAS Main', - platformId: 'truenas-1', - platformType: 'truenas', - sourceType: 'api', - sources: ['truenas'], - status: 'online', - lastSeen: '2026-03-29T22:00:00Z', - canonicalIdentity: { - displayName: 'tank', - platformId: 'truenas-1', - }, - storage: { - platform: 'truenas', - type: 'zfs-pool', - topology: 'pool', - }, - platformData: { - sources: ['truenas'], - }, - }, - ], - meta: { - page: 1, - limit: 200, - total: 2, - totalPages: 1, - }, - }), - }); - return; - } - - if (requestUrl.pathname === '/api/resources/truenas-main/facets') { - await route.fulfill({ - status: 200, - contentType: 'application/json', - body: JSON.stringify({ - recentChanges: [], - counts: { - recentChanges: 0, - }, - }), - }); - return; - } - - await route.continue(); - }); - - await page.goto('/infrastructure?source=truenas&resource=truenas-main', { - waitUntil: 'domcontentloaded', - }); - - await expect(page).toHaveURL(/\/infrastructure\?source=truenas&resource=truenas-main/); - await expect(page.getByTestId('infrastructure-page')).toBeVisible(); - await page.getByRole('button', { name: 'List' }).click(); - - const showAccessButton = page.getByRole('button', { name: 'Show access' }); - await expect(showAccessButton).toBeVisible(); - await showAccessButton.click(); - - const workloadsLink = page.getByRole('link', { name: 'Open related workloads for TrueNAS Main' }); - const storageLink = page.getByRole('link', { name: 'Open related storage for TrueNAS Main' }); - const recoveryLink = page.getByRole('link', { name: 'Open related recovery for TrueNAS Main' }); - - await expect(workloadsLink).toHaveAttribute( - 'href', - '/workloads?type=app-container&platform=truenas&agent=truenas-main', - ); - await expect(storageLink).toHaveAttribute( - 'href', - '/storage?source=truenas&node=truenas-main', - ); - await expect(recoveryLink).toHaveAttribute( - 'href', - '/recovery?platform=truenas&node=truenas-main', - ); - - await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true }); - }); -}); diff --git a/tests/integration/tests/35-vmware-infrastructure-source-filter.spec.ts b/tests/integration/tests/35-vmware-infrastructure-source-filter.spec.ts deleted file mode 100644 index 33047dec4..000000000 --- a/tests/integration/tests/35-vmware-infrastructure-source-filter.spec.ts +++ /dev/null @@ -1,114 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; -import { expect, test as base } from '@playwright/test'; - -import { createAuthenticatedStorageState } from './helpers'; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const SCREENSHOT_PATH = '/tmp/vmware-infrastructure-source-filter.png'; - -type WorkerFixtures = { - authStorageStatePath: string; -}; - -const test = base.extend<{}, WorkerFixtures>({ - storageState: async ({ authStorageStatePath }, use) => { - await use(authStorageStatePath); - }, - authStorageStatePath: [async ({ browser }, use, workerInfo) => { - const storageStatePath = path.resolve( - __dirname, - '..', - '..', - 'tmp', - 'playwright-auth', - `vmware-infrastructure-source-filter-${workerInfo.project.name}.json`, - ); - fs.mkdirSync(path.dirname(storageStatePath), { recursive: true }); - await createAuthenticatedStorageState(browser, storageStatePath); - try { - await use(storageStatePath); - } finally { - fs.rmSync(storageStatePath, { force: true }); - } - }, { scope: 'worker' }], -}); - -test.describe('VMware infrastructure source filter', () => { - test.setTimeout(180_000); - - test('surfaces VMware resources under the canonical vSphere infrastructure filter', async ({ - page, - }) => { - await page.route('**/api/resources**', async (route) => { - const requestUrl = new URL(route.request().url()); - if (requestUrl.pathname !== '/api/resources') { - await route.continue(); - return; - } - - await route.fulfill({ - status: 200, - contentType: 'application/json', - body: JSON.stringify({ - data: [ - { - id: 'vmware-host-1', - type: 'agent', - name: 'esxi-01.lab.local', - displayName: 'ESXi 01', - platformId: 'vmware-host-1', - platformType: 'vmware-vsphere', - sourceType: 'api', - sources: ['vmware-vsphere'], - status: 'online', - lastSeen: '2026-03-30T17:00:00Z', - canonicalIdentity: { - displayName: 'ESXi 01', - hostname: 'esxi-01.lab.local', - platformId: 'vmware-host-1', - }, - agent: { - hostname: 'esxi-01.lab.local', - platform: 'VMware ESXi', - uptimeSeconds: 86400, - }, - platformData: { - sources: ['vmware-vsphere'], - }, - }, - ], - meta: { - page: 1, - limit: 200, - total: 1, - totalPages: 1, - }, - }), - }); - }); - - await page.goto('/infrastructure?source=vmware-vsphere', { - waitUntil: 'domcontentloaded', - }); - - await expect(page.getByTestId('infrastructure-page')).toBeVisible(); - await expect(page).toHaveURL(/\/infrastructure\?source=vmware-vsphere/); - await expect(page.locator('#infra-source-filter')).toHaveValue('vmware-vsphere'); - - const sourceOptions = await page.locator('#infra-source-filter option').evaluateAll((options) => - options.map((option) => ({ - value: option.getAttribute('value'), - label: option.textContent?.trim(), - })), - ); - expect(sourceOptions).toEqual([ - { value: '', label: 'All' }, - { value: 'vmware-vsphere', label: 'vSphere' }, - ]); - - await expect(page.getByText('ESXi 01')).toBeVisible(); - await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true }); - }); -});