forked from janus-idp/backstage-showcase
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[e2e-tests] Add security scan check to quay plugin suite (janus-idp#1021
- Loading branch information
Showing
2 changed files
with
71 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,28 +1,50 @@ | ||
import { test } from '@playwright/test'; | ||
import { expect, test } from '@playwright/test'; | ||
import { UIhelper } from '../../../utils/UIhelper'; | ||
import { Common } from '../../../utils/Common'; | ||
import { ImageRegistry } from '../../../utils/quay/quay'; | ||
|
||
test.describe('Test Quay.io plugin', () => { | ||
const QUAY_REPOSITORY = 'janus-idp/backstage-showcase'; | ||
let uiHelper: UIhelper; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
const common = new Common(page); | ||
await common.loginAsGuest(); | ||
}); | ||
|
||
test('Check if Image Registry is present', async ({ page }) => { | ||
const uiHelper = new UIhelper(page); | ||
uiHelper = new UIhelper(page); | ||
await uiHelper.openSidebar('Catalog'); | ||
await uiHelper.selectMuiBox('Kind', 'Component'); | ||
await uiHelper.clickLink('backstage-janus'); | ||
await uiHelper.clickTab('Image Registry'); | ||
}); | ||
|
||
test('Check if Image Registry is present', async () => { | ||
const allGridColumnsText = ImageRegistry.getAllGridColumnsText(); | ||
await uiHelper.verifyColumnHeading(allGridColumnsText); | ||
await uiHelper.verifyHeading(`Quay repository: ${QUAY_REPOSITORY}`); | ||
|
||
const allCellsIdentifier = ImageRegistry.getAllCellsIdentifier(); | ||
await uiHelper.verifyCellsInTable(allCellsIdentifier); | ||
}); | ||
|
||
test('Check Security Scan details', async ({ page }) => { | ||
const cell = await ImageRegistry.getScanCell(page); | ||
const resultText = await cell.textContent(); | ||
|
||
if (resultText.includes('unsupported')) { | ||
await expect(cell.getByRole('link')).toHaveCount(0); | ||
} else { | ||
await cell.getByRole('link').click(); | ||
await uiHelper.verifyHeading('Vulnerabilities for sha256:'); | ||
await uiHelper.verifyColumnHeading(ImageRegistry.getAllScanColumnsText()); | ||
|
||
if (resultText.includes('Passed')) { | ||
await uiHelper.verifyCellsInTable(['No records to display']); | ||
} else { | ||
await uiHelper.verifyCellsInTable( | ||
ImageRegistry.getScanCellsIdentifier(), | ||
); | ||
} | ||
} | ||
}); | ||
}); |
This file contains 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