-
Notifications
You must be signed in to change notification settings - Fork 29
HMS-6006: QE-migrate iqe test_snapshot_package_count_and_list #514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
swadeley
merged 5 commits into
content-services:main
from
mayurilahane:mlahane/HMS-6006
May 15, 2025
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4e672b6
Add test for verifying snapshot package count and package search func…
mayurilahane 57d5bc4
Add test for verifying snapshot package count and package search func…
mayurilahane 86df232
Updated locators to target the specific repository row to prevent fai…
mayurilahane ae67823
Removed page reload step for snapshot list table
mayurilahane 1e45d1a
Remove: Accidently pushed another file
mayurilahane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { navigateToRepositories } from './helpers/navHelpers'; | ||
import { deleteAllRepos } from './helpers/deleteRepositories'; | ||
import { closePopupsIfExist, getRowByNameOrUrl } from './helpers/helpers'; | ||
const repoNamePrefix = 'snapshot-package-list-test'; | ||
const randomName = () => `${(Math.random() + 1).toString(36).substring(2, 6)}`; | ||
const repoName = `${repoNamePrefix}-${randomName()}`; | ||
const editedRepo = `${repoName}-Edited`; | ||
|
||
test.describe('Snapshot Package Count and List', async () => { | ||
test('Verify package count and search functionality in snapshot details', async ({ page }) => { | ||
await navigateToRepositories(page); | ||
await closePopupsIfExist(page); | ||
await deleteAllRepos(page, `&search=${repoNamePrefix}`); | ||
|
||
await test.step('Create a repository', async () => { | ||
await page.getByRole('button', { name: 'Add repositories' }).first().click(); | ||
await expect(page.getByRole('dialog', { name: 'Add custom repositories' })).toBeVisible(); | ||
await page.getByLabel('Name').fill(`${repoName}`); | ||
await page.getByLabel('Snapshotting').click(); | ||
await page.getByLabel('URL').fill('https://jlsherrill.fedorapeople.org/fake-repos/signed/'); | ||
await page.getByRole('button', { name: 'Save', exact: true }).click(); | ||
}); | ||
|
||
await test.step('Wait for status to be "Valid"', async () => { | ||
const row = await getRowByNameOrUrl(page, repoName); | ||
await expect(row.getByText('Valid')).toBeVisible({ timeout: 60000 }); | ||
}); | ||
|
||
await test.step('Verify the package count matches the snapshot', async () => { | ||
const row = await getRowByNameOrUrl(page, repoName); | ||
const packageCountValue = await row.getByTestId('package_count_button').textContent(); | ||
await page.getByRole('button', { name: 'Kebab toggle' }).click(); | ||
await page.getByRole('menuitem', { name: 'View all snapshots' }).click(); | ||
// click on the first row to view the snapshot details | ||
const snapshotPackagesColumn = await page | ||
.getByTestId('snapshot_package_count_button') | ||
.textContent(); | ||
// assert the package count matches the after snapshot packages count | ||
expect(packageCountValue).toBe(snapshotPackagesColumn); | ||
await page.getByText('Close').click(); | ||
}); | ||
|
||
// Edit the repository to change number of packages | ||
await test.step('Update the repository', async () => { | ||
const row = await getRowByNameOrUrl(page, repoName); | ||
await row.getByLabel('Kebab toggle').click(); | ||
await row.getByRole('menuitem', { name: 'Edit' }).click(); | ||
await page.getByPlaceholder('Enter name', { exact: true }).fill(editedRepo); | ||
await page | ||
.getByLabel('URL') | ||
.fill('http://jlsherrill.fedorapeople.org/fake-repos/needed-errata/'); | ||
await page.getByRole('button', { name: 'Save changes', exact: true }).click(); | ||
const editedRow = await getRowByNameOrUrl(page, editedRepo); | ||
await expect(editedRow.getByText('Valid')).toBeVisible({ timeout: 60000 }); | ||
}); | ||
|
||
await test.step('Verify the package count matches the edited snapshot', async () => { | ||
const editedRow = await getRowByNameOrUrl(page, editedRepo); | ||
const editedRepoPackageCountValue = await editedRow | ||
.getByTestId('package_count_button') | ||
.textContent(); | ||
await editedRow.getByRole('button', { name: 'Kebab toggle' }).click(); | ||
await page.getByRole('menuitem', { name: 'View all snapshots' }).click(); | ||
const editedRepoSnapshotPackagesColumn = await page | ||
.getByTestId('snapshot_package_count_button') | ||
.first() | ||
.textContent(); | ||
expect(editedRepoPackageCountValue).toBe(editedRepoSnapshotPackagesColumn); | ||
await page.getByText('Close').click(); | ||
}); | ||
|
||
// Search the random predefined package in the package list on snapshot details page modal | ||
await test.step('Search for a predefined package in the package list', async () => { | ||
const editedRow = await getRowByNameOrUrl(page, editedRepo); | ||
await editedRow.getByTestId('package_count_button').click(); | ||
await expect(page.getByRole('dialog', { name: 'Packages' })).toBeVisible(); | ||
await page.getByRole('textbox', { name: 'Filter by name' }).fill('bear'); | ||
await expect(page.getByText('bear')).toBeVisible(); | ||
// check that non exixiting package is not visible in the list | ||
await page.getByRole('textbox', { name: 'Filter by name' }).fill('non-existing-package'); | ||
await expect(page.getByText('non-existing-package')).not.toBeVisible(); | ||
await expect( | ||
page.getByRole('heading', { name: 'No packages match the filter criteria' }), | ||
).toBeVisible(); | ||
await page.getByText('Close').click(); | ||
}); | ||
await test.step('Post test cleanup', async () => { | ||
await deleteAllRepos(page, `&search=${repoNamePrefix}`); | ||
}); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.