Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ import '@testing-library/jest-dom/vitest';
import { render, screen, within } from '@testing-library/svelte';
import { beforeEach, expect, test, vi } from 'vitest';

import { notificationQueue } from '/@/stores/notifications';
import { openshellSandboxes } from '/@/stores/openshell-sandboxes';
import type { NotificationCard } from '/@api/notification';
import type { GatewaySandboxes } from '/@api/openshell-gateway-info';

import AgentWorkspaceList from './AgentWorkspaceList.svelte';

beforeEach(() => {
vi.resetAllMocks();
openshellSandboxes.set([]);
notificationQueue.set([]);
});

test('Expect empty screen when no workspaces', () => {
Expand Down Expand Up @@ -102,3 +105,27 @@ test('Expect page title to be Agentic Workspaces', () => {

expect(screen.getByText('Agentic Workspaces')).toBeInTheDocument();
});

test('Expect NotificationsBox to be hidden when there are no notifications', () => {
render(AgentWorkspaceList);

const notificationsBox = screen.queryByLabelText('Notifications Box');
expect(notificationsBox).not.toBeInTheDocument();
});

test('Expect NotificationsBox to be visible when there are highlighted notifications', () => {
const notification: NotificationCard = {
id: 1,
extensionId: 'extension',
title: 'Test notification',
body: 'Test body',
type: 'info',
highlight: true,
};
notificationQueue.set([notification]);

render(AgentWorkspaceList);

const notificationsBox = screen.queryByLabelText('Notifications Box');
expect(notificationsBox).toBeInTheDocument();
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
TableRow,
} from '@podman-desktop/ui-svelte';

import NotificationsBox from '/@/lib/dashboard/NotificationsBox.svelte';
import NoLogIcon from '/@/lib/ui/NoLogIcon.svelte';
import { handleNavigation } from '/@/navigation';
import {
Expand Down Expand Up @@ -100,6 +101,7 @@ const sandboxColumns = [

{#snippet content()}
<div class="flex flex-col min-w-full h-full">
<NotificationsBox />
<div class="px-5 pt-4 pb-4">
<AgentWorkspaceStatCards sandboxes={$allOpenshellSandboxes} />
<SearchInput bind:searchTerm={searchTerm} title="Agentic Workspaces" />
Expand Down
Loading