@@ -411,6 +437,19 @@ exports[`Layout renders the web UI layout 1`] = `
+
+
+
+
diff --git a/galasa-ui/src/tests/components/headers/PageHeader.test.tsx b/galasa-ui/src/tests/components/headers/PageHeader.test.tsx
index 4baf67e4..a3bdbacb 100644
--- a/galasa-ui/src/tests/components/headers/PageHeader.test.tsx
+++ b/galasa-ui/src/tests/components/headers/PageHeader.test.tsx
@@ -7,7 +7,6 @@ import { render, screen } from '@testing-library/react';
import PageHeader from '@/components/headers/PageHeader';
import { FeatureFlagProvider } from '@/contexts/FeatureFlagContext';
import { useRouter } from 'next/navigation';
-import { FEATURE_FLAGS } from '@/utils/featureFlags';
const mockRouter = {
push: jest.fn(() => useRouter().push),
@@ -51,26 +50,27 @@ test('renders the header containing the header menu', () => {
expect(headerMenu).toBeInTheDocument();
});
-test('does NOT render the "Test runs" link by default', () => {
+test('renders the "Test runs" link by default', () => {
render(
);
- const testRunsLink = screen.queryByText('Test runs');
- expect(testRunsLink).not.toBeInTheDocument();
-});
+ // Verify "Test runs" link appears in both desktop header nav and mobile side nav
+ const testRunsLinks = screen.getAllByRole('link', { name: 'Test runs' });
+ expect(testRunsLinks).toHaveLength(2);
-test('renders the "Test runs" link when the feature flag is enabled via prop', () => {
- const initialFlags = JSON.stringify({ [FEATURE_FLAGS.TEST_RUNS]: true });
+ // Both links should point to the correct href
+ testRunsLinks.forEach((link) => {
+ expect(link).toHaveAttribute('href', '/test-runs');
+ });
- render(
-
-
-
- );
+ // Verify one is in the header navigation (desktop)
+ const headerNav = screen.getByRole('navigation', { name: 'Galasa menu bar navigation' });
+ expect(headerNav).toContainElement(testRunsLinks[0]);
- const testRunsLinks = screen.getAllByText('Test runs');
- expect(testRunsLinks.length).toBe(2);
+ // Verify one is in the side navigation (mobile)
+ const sideNav = screen.getByRole('navigation', { name: 'Side navigation' });
+ expect(sideNav).toContainElement(testRunsLinks[1]);
});
diff --git a/galasa-ui/src/tests/components/mysettings/ExperimentalFeaturesSection.test.tsx b/galasa-ui/src/tests/components/mysettings/ExperimentalFeaturesSection.test.tsx
index 202e9424..af6da285 100644
--- a/galasa-ui/src/tests/components/mysettings/ExperimentalFeaturesSection.test.tsx
+++ b/galasa-ui/src/tests/components/mysettings/ExperimentalFeaturesSection.test.tsx
@@ -14,15 +14,15 @@ jest.mock('next-intl', () => ({
title: 'Experimental Features',
description:
'Early access to new features. These are experimental and subject to change or removal.',
- 'features.testRunSearch': 'Test Run searching and viewing',
+ 'features.graph': 'Test Run Graphs',
};
return translations[key] || key;
},
}));
describe('ExperimentalFeaturesSection', () => {
- test('Renders correctly when "testRuns" flag is disabled: Checkbox is unchecked', () => {
- const mockIsFeatureEnabled = (key: string) => key !== FEATURE_FLAGS.TEST_RUNS;
+ test('Renders correctly when "graph" flag is disabled: Checkbox is unchecked', () => {
+ const mockIsFeatureEnabled = (key: string) => key !== FEATURE_FLAGS.GRAPH;
render(
{
);
- const checkbox = screen.getByLabelText(/Test Run/i);
+ const checkbox = screen.getByLabelText(/Test Run Graphs/i);
expect(checkbox).not.toBeChecked();
});
- test('Renders correctly when a "testRuns" enabled: Checkbox is checked', () => {
+ test('Renders correctly when a "graph" enabled: Checkbox is checked', () => {
const mockIsFeatureEnabled = (key: string) => {
- return key === FEATURE_FLAGS.TEST_RUNS;
+ return key === FEATURE_FLAGS.GRAPH;
};
render(
@@ -48,7 +48,7 @@ describe('ExperimentalFeaturesSection', () => {
);
- const checkbox = screen.getByLabelText(/Test Run/i);
+ const checkbox = screen.getByLabelText(/Test Run Graphs/i);
expect(checkbox).toBeChecked();
});
@@ -63,10 +63,10 @@ describe('ExperimentalFeaturesSection', () => {
);
- const checkbox = screen.getByRole('checkbox', { name: /Test Run/i });
+ const checkbox = screen.getByRole('checkbox', { name: /Test Run Graphs/i });
fireEvent.click(checkbox);
expect(mockToggle).toHaveBeenCalledTimes(1);
- expect(mockToggle).toHaveBeenCalledWith(FEATURE_FLAGS.TEST_RUNS);
+ expect(mockToggle).toHaveBeenCalledWith(FEATURE_FLAGS.GRAPH);
});
});
diff --git a/galasa-ui/src/tests/components/mysettings/ResultsTablePageSizingSetting.test.tsx b/galasa-ui/src/tests/components/mysettings/ResultsTablePageSizingSetting.test.tsx
index fa797a0c..cd387cf1 100644
--- a/galasa-ui/src/tests/components/mysettings/ResultsTablePageSizingSetting.test.tsx
+++ b/galasa-ui/src/tests/components/mysettings/ResultsTablePageSizingSetting.test.tsx
@@ -78,18 +78,4 @@ describe('ResultsTablePageSizingSetting', () => {
expect(mockSetDefaultPageSize).toHaveBeenCalledWith(50);
});
});
-
- describe('when feature flag is disabled', () => {
- beforeEach(() => {
- mockIsFeatureEnabled.mockReturnValue(false);
- });
-
- test('does not render the component', () => {
- render(
);
-
- expect(screen.queryByText('Test Run Query Results')).toBeNull();
- expect(screen.queryByText('Configure the number of results displayed per page.')).toBeNull();
- expect(screen.queryByTestId('custom-items-per-page-dropdown-test')).toBeNull();
- });
- });
});
diff --git a/galasa-ui/src/tests/contexts/feature-flag-context.test.tsx b/galasa-ui/src/tests/contexts/feature-flag-context.test.tsx
index 3bdba463..91c5287c 100644
--- a/galasa-ui/src/tests/contexts/feature-flag-context.test.tsx
+++ b/galasa-ui/src/tests/contexts/feature-flag-context.test.tsx
@@ -15,8 +15,8 @@ const TestComponent = () => {
return (
-
Test Runs Enabled: {isFeatureEnabled(FEATURE_FLAGS.TEST_RUNS).toString()}
-
+
Test Run Graphs Enabled: {isFeatureEnabled(FEATURE_FLAGS.GRAPH).toString()}
+
);
};
@@ -39,42 +39,41 @@ describe('Feature Flags Provider and useFeatureFlags Hook', () => {
);
- expect(screen.getByText('Test Runs Enabled: false')).toBeInTheDocument();
+ expect(screen.getByText('Test Run Graphs Enabled: false')).toBeInTheDocument();
});
test('initializes with provided props from the server', () => {
- const initialFlags = JSON.stringify({ [FEATURE_FLAGS.TEST_RUNS]: true });
+ const initialFlags = JSON.stringify({ [FEATURE_FLAGS.GRAPH]: true });
render(
);
- expect(screen.getByText('Test Runs Enabled: true')).toBeInTheDocument();
+ expect(screen.getByText('Test Run Graphs Enabled: true')).toBeInTheDocument();
});
test('verifies feature flag toggling and updates cookie correctly', () => {
- const initialFlags = JSON.stringify({ [FEATURE_FLAGS.TEST_RUNS]: false });
+ const initialFlags = JSON.stringify({ [FEATURE_FLAGS.GRAPH]: false });
render(
);
- expect(screen.getByText('Test Runs Enabled: false')).toBeInTheDocument();
+ expect(screen.getByText('Test Run Graphs Enabled: false')).toBeInTheDocument();
// Due to React's strict mode
cookieSpy.mockClear();
- const toggleButton = screen.getByText('Toggle Test Runs');
+ const toggleButton = screen.getByText('Toggle Test Run Graphs');
fireEvent.click(toggleButton);
- expect(screen.getByText('Test Runs Enabled: true')).toBeInTheDocument();
+ expect(screen.getByText('Test Run Graphs Enabled: true')).toBeInTheDocument();
const expectedCookieVal = JSON.stringify({
- [FEATURE_FLAGS.TEST_RUNS]: true,
- [FEATURE_FLAGS.GRAPH]: false,
+ [FEATURE_FLAGS.GRAPH]: true,
});
expect(cookieSpy).toHaveBeenCalledTimes(1);
diff --git a/galasa-ui/src/tests/mysettings.test.tsx b/galasa-ui/src/tests/mysettings.test.tsx
index e03df45b..cb62d853 100644
--- a/galasa-ui/src/tests/mysettings.test.tsx
+++ b/galasa-ui/src/tests/mysettings.test.tsx
@@ -46,7 +46,7 @@ jest.mock('next-intl', () => ({
title: 'Experimental Features',
description:
'Early access to new features. These are experimental and subject to change or removal.',
- 'features.testRunSearch': 'Test Run searching and viewing',
+ 'features.graph': 'Test Run Graphs',
errorTitle: 'Something went wrong!',
errorDescription: 'Please report the problem to your Galasa Ecosystem administrator.',
};
diff --git a/galasa-ui/src/utils/featureFlags.ts b/galasa-ui/src/utils/featureFlags.ts
index 3b803e4d..395faf81 100644
--- a/galasa-ui/src/utils/featureFlags.ts
+++ b/galasa-ui/src/utils/featureFlags.ts
@@ -6,13 +6,11 @@
// Centralized feature flags
export const FEATURE_FLAGS = {
- TEST_RUNS: 'testRuns',
GRAPH: 'graph',
// Add other feature flags here
} as const;
export const DEFAULT_FEATURE_FLAGS = {
- testRuns: false,
graph: false,
// Add other feature flags here
} as const;