@@ -102,18 +102,25 @@ test.describe('Snapshot Repositories', () => {
102
102
await expect ( row ) . not . toBeVisible ( ) ;
103
103
} ) ;
104
104
} ) ;
105
- } ) ;
106
105
107
- test . describe ( 'Snapshot Deletion with Template creation' , ( ) => {
108
106
test ( 'Snapshot deletion' , async ( { page } ) => {
109
107
await navigateToRepositories ( page ) ;
110
108
await closePopupsIfExist ( page ) ;
111
109
const repoNamePrefix = 'snapshot-deletion' ;
112
110
const randomName = ( ) => `${ ( Math . random ( ) + 1 ) . toString ( 36 ) . substring ( 2 , 6 ) } ` ;
113
111
const repoName = `${ repoNamePrefix } -${ randomName ( ) } ` ;
114
112
const templateName = `Test-template-for-snapshot-deletion-${ randomName ( ) } ` ;
115
- await test . step ( 'Cleanup repositories using "zoo" URL' , async ( ) => {
116
- await deleteAllRepos ( page , `&url=zoo` ) ;
113
+
114
+ await test . step ( 'Cleanup repositories using "zoo" URLs' , async ( ) => {
115
+ const zooUrls = [
116
+ 'https://fedorapeople.org/groups/katello/fakerepos/zoo' ,
117
+ 'https://fedorapeople.org/groups/katello/fakerepos/zoo2' ,
118
+ 'https://fedorapeople.org/groups/katello/fakerepos/zoo3' ,
119
+ 'https://fedorapeople.org/groups/katello/fakerepos/zoo4' ,
120
+ ] ;
121
+ for ( const url of zooUrls ) {
122
+ await deleteAllRepos ( page , `&url=${ url } ` ) ;
123
+ }
117
124
} ) ;
118
125
119
126
await test . step ( 'Create a repository' , async ( ) => {
@@ -144,19 +151,16 @@ test.describe('Snapshot Deletion with Template creation', () => {
144
151
}
145
152
} ) ;
146
153
147
- await test . step ( 'Verify the snapshot count for the repo. ' , async ( ) => {
154
+ await test . step ( 'Create a template ' , async ( ) => {
148
155
const row = await getRowByNameOrUrl ( page , repoName ) ;
149
156
await expect ( row . getByText ( 'Valid' ) ) . toBeVisible ( { timeout : 60000 } ) ;
150
- await page . getByRole ( 'button' , { name : 'Kebab toggle' } ) . click ( ) ;
157
+ await row . getByRole ( 'button' , { name : 'Kebab toggle' } ) . click ( ) ;
151
158
await page . getByRole ( 'menuitem' , { name : 'View all snapshots' } ) . click ( ) ;
152
159
// Count the number of rows in the snapshot list table
153
- // const snapshotCount =
154
- // (await page.getByTestId('snapshot_list_table').locator('tr').count()) - 1; // Subtract 1 for the header row
160
+ const snapshotCount =
161
+ ( await page . getByTestId ( 'snapshot_list_table' ) . locator ( 'tr' ) . count ( ) ) - 1 ; // Subtract 1 for the header row
155
162
await page . getByLabel ( 'Close' , { exact : true } ) . click ( ) ;
156
- } ) ;
157
- await test . step ( 'Create a template' , async ( ) => {
158
163
// Create a template which uses the repo and assert that is uses the latest snapshot
159
- const row = await getRowByNameOrUrl ( page , repoName ) ;
160
164
await navigateToTemplates ( page ) ;
161
165
await page . getByRole ( 'button' , { name : 'Add content template' } ) . click ( ) ;
162
166
await page . getByRole ( 'button' , { name : 'Select architecture' } ) . click ( ) ;
@@ -178,10 +182,11 @@ test.describe('Snapshot Deletion with Template creation', () => {
178
182
const templateRow = await getRowByNameOrUrl ( page , templateName ) ;
179
183
await expect ( templateRow . getByText ( 'Valid' ) ) . toBeVisible ( { timeout : 60000 } ) ;
180
184
// Verify the template is created and uses the latest snapshot
181
- // const snapshotDateElement = await templateRow.getByTitle('Snapshot date' );
182
- // expect(await snapshotDateElement.textContent()).toBe('Use latest');
185
+ await expect ( templateRow . getByText ( 'Use latest' ) ) . toBeVisible ( ) ;
186
+
183
187
// Assert that the template snapshot count matches the repo snapshot count
184
- // expect(snapshotCount).toBe(4);
188
+ // add timeout in below step
189
+ expect ( snapshotCount ) . toBe ( 4 ) ;
185
190
} ) ;
186
191
187
192
// Test deletion of a single snapshot.
0 commit comments