Skip to content

Commit 224cbd5

Browse files
committed
Add test for verifying snapshot package count and package search functionality
1 parent d1f3dc3 commit 224cbd5

File tree

1 file changed

+69
-1
lines changed

1 file changed

+69
-1
lines changed

_playwright-tests/UI/SnapshotRepo.spec.ts

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test, expect } from '@playwright/test';
2-
import { navigateToRepositories } from './helpers/navHelpers';
2+
import { navigateToRepositories, navigateToTemplates } from './helpers/navHelpers';
33
import { deleteAllRepos } from './helpers/deleteRepositories';
44
import {
55
closePopupsIfExist,
@@ -103,3 +103,71 @@ test.describe('Snapshot Repositories', () => {
103103
});
104104
});
105105
});
106+
107+
test('Snapshot deletion', async ({ page }) => {
108+
await navigateToRepositories(page);
109+
await closePopupsIfExist(page);
110+
111+
const repoNamePrefix = 'snapshot-deletion';
112+
const randomName = () => `${(Math.random() + 1).toString(36).substring(2, 6)}`;
113+
const repoName = `${repoNamePrefix}-${randomName()}`;
114+
const templateName = `Test-template-${randomName()}`;
115+
116+
await test.step('Create a repository', async () => {
117+
await page.getByRole('button', { name: 'Add repositories' }).first().click();
118+
await expect(page.getByRole('dialog', { name: 'Add custom repositories' })).toBeVisible();
119+
await page.getByLabel('Name').fill(`${repoName}`);
120+
await page.getByLabel('Snapshotting').click();
121+
await page.getByLabel('URL').fill('https://fedorapeople.org/groups/katello/fakerepos/zoo/');
122+
await page.getByRole('button', { name: 'Save', exact: true }).click();
123+
const row = await getRowByNameOrUrl(page, repoName);
124+
await expect(row.getByText('Valid')).toBeVisible({ timeout: 60000 });
125+
});
126+
127+
// Edit the repository and create snapshots
128+
await test.step('Create a repository', async () => {
129+
const row = await getRowByNameOrUrl(page, repoName);
130+
await expect(row.getByText('Valid')).toBeVisible({ timeout: 60000 });
131+
for (let i = 2; i <= 4; i++) {
132+
await test.step(`Edit repository and create snapshot ${i}`, async () => {
133+
// Open the edit modal
134+
await row.getByLabel('Kebab toggle').click();
135+
await row.getByRole('menuitem', { name: 'Edit' }).click();
136+
await page
137+
.getByLabel('URL')
138+
.fill(`https://fedorapeople.org/groups/katello/fakerepos/zoo/${i}/`);
139+
await page.getByRole('button', { name: 'Save changes', exact: true }).click();
140+
await expect(row.getByText('Valid')).toBeVisible({ timeout: 60000 });
141+
});
142+
}
143+
// Verify the snapshot count for the repo.
144+
await row.getByTestId('snapshot_list_table').textContent();
145+
// Create a template which uses the repo and assert that is uses the latest snapshot
146+
await navigateToTemplates(page);
147+
await page.getByRole('button', { name: 'Add content template' }).click();
148+
await page.getByRole('button', { name: 'Select architecture' }).click();
149+
await page.getByRole('option', { name: 'aarch64' }).click();
150+
await page.getByRole('button', { name: 'Select version' }).click();
151+
await page.getByRole('option', { name: 'el9' }).click();
152+
await page.getByRole('button', { name: 'Next', exact: true }).click();
153+
// search for row in the add content template modal
154+
await page.getByRole('textbox', { name: 'Filter by name/url' }).fill(repoName);
155+
await page.getByRole('gridcell', { name: 'Select row' }).locator('label').click();
156+
await page.getByRole('button', { name: 'Next', exact: true }).click();
157+
await page.getByRole('radio', { name: 'Use latest content' }).check();
158+
await page.getByRole('button', { name: 'Next' }).click();
159+
await page.getByPlaceholder('Enter name').fill(``);
160+
await page.getByPlaceholder('Description').fill('Template test');
161+
await expect(page.getByText('Valid')).toBeVisible({ timeout: 60000 });
162+
// Verify the template is created and uses the latest snapshot
163+
const templateRow = await getRowByNameOrUrl(page, templateName);
164+
await expect(templateRow.getByText('Valid')).toBeVisible({ timeout: 60000 });
165+
const templateSnapshotCount = await templateRow
166+
.getByTestId('snapshot_list_table')
167+
.textContent();
168+
});
169+
170+
// Assert that the template snapshot count matches the repo snapshot count
171+
// Test deletion of a single snapshot.
172+
// Test bulk deletion of multiple snapshots.
173+
});

0 commit comments

Comments
 (0)