Skip to content

Commit 4773f4d

Browse files
committed
QE - migrate iqe test_snapshot_deletion
1 parent 9b603a2 commit 4773f4d

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed

_playwright-tests/UI/SnapshotRepo.spec.ts

+63-1
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,65 @@ test.describe('Snapshot Repositories', () => {
103103
});
104104
});
105105
});
106+
107+
test('Snapshot deletion', async ({ page }) => {
108+
await navigateToRepositories(page);
109+
await closePopupsIfExist(page);
110+
const repoNamePrefix = 'snapshot-deletion';
111+
const randomName = () => `${(Math.random() + 1).toString(36).substring(2, 6)}`;
112+
const repoName = `${repoNamePrefix}-${randomName()}`;
113+
const templateName = `Test-template-${randomName()}`;
114+
115+
await test.step('Create a repository', async () => {
116+
await page.getByRole('button', { name: 'Add repositories' }).first().click();
117+
await expect(page.getByRole('dialog', { name: 'Add custom repositories' })).toBeVisible();
118+
await page.getByLabel('Name').fill(`${repoName}`);
119+
await page.getByLabel('Snapshotting').click();
120+
await page.getByLabel('URL').fill('https://fedorapeople.org/groups/katello/fakerepos/zoo/');
121+
await page.getByRole('button', { name: 'Save', exact: true }).click();
122+
const row = await getRowByNameOrUrl(page, repoName);
123+
await expect(row.getByText('Valid')).toBeVisible({ timeout: 60000 });
124+
});
125+
126+
await test.step('Edit the repository', async () => {
127+
const row = await getRowByNameOrUrl(page, repoName);
128+
await expect(row.getByText('Valid')).toBeVisible({ timeout: 60000 });
129+
for (let i = 2; i <= 4; i++) {
130+
await test.step(`Edit repository and create snapshot ${i}`, async () => {
131+
// Open the edit modal
132+
await row.getByLabel('Kebab toggle').click();
133+
await row.getByRole('menuitem', { name: 'Edit' }).click();
134+
await page
135+
.getByLabel('URL')
136+
.fill(`https://fedorapeople.org/groups/katello/fakerepos/zoo${i}/`);
137+
await page.getByRole('button', { name: 'Save changes', exact: true }).click();
138+
await expect(row.getByText('Valid')).toBeVisible({ timeout: 60000 });
139+
});
140+
}
141+
});
142+
143+
await test.step('Verify the snapshot count for the repo.', async () => {
144+
const row = await getRowByNameOrUrl(page, repoName);
145+
await expect(row.getByText('Valid')).toBeVisible({ timeout: 60000 });
146+
// const snapshotCount = await row.getByTestId('snapshot_list_table').textContent();
147+
// Create a template which uses the repo and assert that is uses the latest snapshot
148+
await navigateToTemplates(page);
149+
await page.getByRole('button', { name: 'Add templates' }).first().click();
150+
await expect(page.getByRole('dialog', { name: 'Add custom templates' })).toBeVisible();
151+
await page.getByLabel('Name').fill(templateName);
152+
await page.getByLabel('Repository').click();
153+
await page.getByRole('option', { name: repoName }).locator('label').click();
154+
await page.getByRole('button', { name: 'Save', exact: true }).click();
155+
await expect(page.getByText('Valid')).toBeVisible({ timeout: 60000 });
156+
// Verify the template is created and uses the latest snapshot
157+
const templateRow = await getRowByNameOrUrl(page, templateName);
158+
await expect(templateRow.getByText('Valid')).toBeVisible({ timeout: 60000 });
159+
const templateSnapshotCount = await templateRow
160+
.getByTestId('snapshot_list_table')
161+
.textContent();
162+
// Assert that the template snapshot count matches the repo snapshot count
163+
// Test deletion of a single snapshot.
164+
// Test bulk deletion of multiple snapshots.
165+
});
166+
await deleteAllRepos(page, `&search=${repoNamePrefix}`);
167+
});

0 commit comments

Comments
 (0)