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
4 changes: 2 additions & 2 deletions frontend/e2e/pages/base-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,14 @@ export default abstract class BasePage {
Administrator: ['Administrator', 'Core platform'],
Developer: ['Developer'],
};
const toggle = this.page.locator('[data-test-id="perspective-switcher-toggle"]');
const toggle = this.page.getByTestId('perspective-switcher-toggle');
const labels = labelMap[target] || [target];
const currentText = (await toggle.textContent()) || '';
if (labels.some((label) => currentText.includes(label))) {
return;
}
await this.robustClick(toggle);
const menuOption = this.page.locator('[data-test-id="perspective-switcher-menu-option"]');
const menuOption = this.page.getByTestId('perspective-switcher-menu-option');
for (const label of labels) {
const option = menuOption.filter({ hasText: label });
if ((await option.count()) > 0) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/e2e/pages/cluster-settings-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class ClusterSettingsPage extends BasePage {
* Open the channel dropdown and select a channel (for "Select channel" modal)
*/
async selectChannelFromDropdown(channelName: string): Promise<void> {
const dropdownToggle = this.channelModal.locator('[data-test="console-select-menu-toggle"]');
const dropdownToggle = this.channelModal.getByTestId('console-select-menu-toggle');
await this.robustClick(dropdownToggle);

const channelOption = this.page.locator(`[data-test-dropdown-menu="${channelName}"]`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function navigateAndWaitForInit(page: Page) {

try {
await page.goto('/');
await expect(page.locator('[data-test-id="dashboard"]').first()).toBeVisible({
await expect(page.getByTestId('dashboard').first()).toBeVisible({
timeout: 60_000,
});
await initPromise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,13 @@ test.describe('Alertmanager', { tag: ['@admin'] }, () => {

await page.getByTestId('edit-alert-routing-btn').click();

// Edit routing values (using legacy test IDs)
await page.locator('[data-test-id="input-group-by"]').fill(', cluster');
await page.locator('[data-test-id="input-group-wait"]').clear();
await page.locator('[data-test-id="input-group-wait"]').fill('60s');
await page.locator('[data-test-id="input-group-interval"]').clear();
await page.locator('[data-test-id="input-group-interval"]').fill('10m');
await page.locator('[data-test-id="input-repeat-interval"]').clear();
await page.locator('[data-test-id="input-repeat-interval"]').fill('24h');
await page.getByTestId('input-group-by').fill(', cluster');
await page.getByTestId('input-group-wait').clear();
await page.getByTestId('input-group-wait').fill('60s');
await page.getByTestId('input-group-interval').clear();
await page.getByTestId('input-group-interval').fill('10m');
await page.getByTestId('input-repeat-interval').clear();
await page.getByTestId('input-repeat-interval').fill('24h');

await page.getByTestId('confirm-action').click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test.describe('Cluster Settings channel modal', { tag: ['@admin', '@smoke'] }, (

const dropdown = clusterSettings
.getChannelModal()
.locator('[data-test="console-select-menu-toggle"]');
.getByTestId('console-select-menu-toggle');
await expect(dropdown).toBeVisible();

await clusterSettings.page.keyboard.press('Escape');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test.describe(`${crd} CRD`, { tag: ['@admin'] }, () => {

await test.step('Verify instance appears on Command Line Tools page', async () => {
await page.goto('/command-line-tools');
await expect(page.locator(`[data-test-id="${name}"]`)).toContainText(name);
await expect(page.getByTestId(name)).toContainText(name);
});

await test.step('Delete the ConsoleCLIDownload instance', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,16 @@ test.describe(`${crd} CRD`, { tag: ['@admin'] }, () => {
await expect(page.getByRole('heading', { name })).toBeVisible();

await expect(page.getByTestId('additional-printer-columns')).toBeVisible();
await expect(page.locator('[data-test-selector="details-item-label__Text"]')).toHaveText(
'Text',
);
await expect(page.locator('[data-test-selector="details-item-value__Text"]')).toHaveText(
text,
);
await expect(
page.locator('[data-test-selector="details-item-label__Location"]'),
).toHaveText('Location');
await expect(
page.locator('[data-test-selector="details-item-value__Location"]'),
).toHaveText(location);
await expect(page.locator('[data-test-selector="details-item-label__Age"]')).toHaveText(
'Age',
);
await expect(page.locator('[data-test-selector="details-item-value__Age"]')).toBeVisible();
await expect(page.getByTestId('details-item-label__Text')).toHaveText('Text');
await expect(page.getByTestId('details-item-value__Text')).toHaveText(text);
await expect(page.getByTestId('details-item-label__Location')).toHaveText('Location');
await expect(page.getByTestId('details-item-value__Location')).toHaveText(location);
await expect(page.getByTestId('details-item-label__Age')).toHaveText('Age');
await expect(page.getByTestId('details-item-value__Age')).toBeVisible();
});

await test.step('Verify notification banner appears', async () => {
const notification = page.locator(`[data-test="${name}-${location}"]`);
const notification = page.getByTestId(`${name}-${location}`);
await expect(notification).toBeVisible();
await expect(notification).toContainText(text);
});
Expand All @@ -110,7 +100,7 @@ test.describe(`${crd} CRD`, { tag: ['@admin'] }, () => {
});

await test.step('Verify modified notification banner appears', async () => {
const altNotification = page.locator(`[data-test="${name}-${altLocation}"]`);
const altNotification = page.getByTestId(`${name}-${altLocation}`);
await expect(altNotification).toBeVisible();
await expect(altNotification).toContainText(altText);
});
Expand Down
2 changes: 1 addition & 1 deletion frontend/e2e/tests/smoke/developer/smoke-test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { test, expect } from '../../../fixtures';
test('console loads in developer perspective', async ({ page }) => {
await page.goto('/');
await expect(
page.locator('[data-test-id="perspective-switcher-toggle"]'),
page.getByTestId('perspective-switcher-toggle'),
).toContainText('Developer', { timeout: 60_000 });
});
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const DetailsCard: FC = () => {
const nodeGroups = useMemo(() => getNodeGroups(obj).sort().join(', ') || DASH, [obj]);

return (
<Card data-test-id="details-card">
<Card data-test="details-card" data-test-id="details-card">
<CardHeader
actions={{
actions: (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { OverviewProps } from '@console/dynamic-plugin-sdk';
import './dashboard.scss';

const Dashboard: FC<OverviewProps> = ({ className, children }) => (
<PageSection data-test-id="dashboard" className={className}>
<PageSection data-test="dashboard" data-test-id="dashboard" className={className}>
{children}
</PageSection>
);
Expand Down
4 changes: 3 additions & 1 deletion frontend/public/components/command-line-tools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export const CommandLineTools: FC<CommandLineToolsProps> = ({ obj }) => {
return (
<Fragment key={tool.metadata.uid}>
{index > 0 && <Divider className="co-divider" />}
<SecondaryHeading data-test-id={displayName}>{displayName}</SecondaryHeading>
<SecondaryHeading data-test={displayName} data-test-id={displayName}>
{displayName}
</SecondaryHeading>
<MarkdownView content={tool.spec.description} exactHeight />
{sortedLinks.length === 1 && (
<p>
Expand Down
4 changes: 4 additions & 0 deletions frontend/public/components/modals/alert-routing-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const AlertRoutingModal: FC<AlertRoutingModalProps> = ({ config, secret, cancel,
defaultValue={_.get(config, ['route', 'group_by'], []).join(', ')}
placeholder="cluster, alertname"
aria-describedby="input-group-by-help"
data-test="input-group-by"
data-test-id="input-group-by"
/>
</FormGroup>
Expand All @@ -90,6 +91,7 @@ const AlertRoutingModal: FC<AlertRoutingModalProps> = ({ config, secret, cancel,
defaultValue={_.get(config, ['route', 'group_wait'], '')}
placeholder="30s"
aria-describedby="input-group-wait-help"
data-test="input-group-wait"
data-test-id="input-group-wait"
/>
</FormGroup>
Expand All @@ -101,6 +103,7 @@ const AlertRoutingModal: FC<AlertRoutingModalProps> = ({ config, secret, cancel,
defaultValue={_.get(config, ['route', 'group_interval'], '')}
placeholder="5m"
aria-describedby="input-group-interval-help"
data-test="input-group-interval"
data-test-id="input-group-interval"
/>
</FormGroup>
Expand All @@ -112,6 +115,7 @@ const AlertRoutingModal: FC<AlertRoutingModalProps> = ({ config, secret, cancel,
defaultValue={_.get(config, ['route', 'repeat_interval'], '')}
placeholder="3h"
aria-describedby="input-repeat-interval-help"
data-test="input-repeat-interval"
data-test-id="input-repeat-interval"
/>
</FormGroup>
Expand Down
1 change: 1 addition & 0 deletions frontend/public/components/utils/details-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const DetailsItem: FC<DetailsItemProps> = ({
return hide ? null : (
<DescriptionListGroup>
<DescriptionListTermHelpText
data-test={`details-item-label__${label}`}
data-test-selector={`details-item-label__${label}`}
className={labelClassName}
>
Expand Down