-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1678 from Azure/fix/1624
UI Tests : skip grafana if not installed
- Loading branch information
Showing
1 changed file
with
22 additions
and
48 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,58 +1,32 @@ | ||
import {test, expect} from '@playwright/test'; | ||
|
||
// test('Grafana', async ({browser}) => { | ||
// // create context with HTTP credentials | ||
// const context = await browser.newContext(); | ||
|
||
// // Open Grafana | ||
// const page = await context.newPage(); | ||
// await page.goto('/rnode/grafana/3000', { waitUntil: 'networkidle' }); | ||
|
||
// // Click [aria-label="Dashboards"] div | ||
// //await page.click('[aria-label="Dashboards"] div'); | ||
// // Click text=Browse >> [data-testid="dropdown-child-icon"] | ||
// //await page.click('text=Browse >> [data-testid="dropdown-child-icon"]'); | ||
|
||
// await page.goto('/rnode/grafana/3000/dashboards', { waitUntil: 'networkidle' }); | ||
// // Click text=dashboards| Go to folder | ||
// await page.click('text=dashboards| Go to folder'); | ||
|
||
// // Click text=azhop - Infra Servers | ||
// await Promise.all([ | ||
// page.waitForNavigation({ waitUntil: 'networkidle' }), | ||
// page.click('text=azhop - Infra Servers') | ||
// ]); | ||
|
||
// await page.close() | ||
|
||
// // Close the browser | ||
// await context.close(); | ||
// }); | ||
|
||
import azhopConfig from './azhop.config'; | ||
|
||
test('Grafana', async ({ browser }) => { | ||
|
||
// create context with HTTP credentials | ||
const context = await browser.newContext(); | ||
// Create a page | ||
const page = await context.newPage(); | ||
await page.goto('/', { waitUntil: 'networkidle' }); | ||
|
||
await page.getByRole('button', { name: 'Monitoring' }).click(); | ||
const page1Promise = page.waitForEvent('popup'); | ||
await page.getByRole('link', { name: 'Grafana Dashboard' }).click(); | ||
const page1 = await page1Promise; | ||
await page1.getByRole('button', { name: 'Toggle menu' }).click(); | ||
await page1.getByTestId('navbarmenu').getByRole('link', { name: 'Dashboards' }).click(); | ||
await page1.getByTestId('data-testid Folder header dashboards').getByText('dashboards').click(); | ||
await page1.getByRole('link', { name: 'azhop - Infra Servers' }).click(); | ||
await page1.waitForLoadState('networkidle'); | ||
await page1.getByTestId('data-testid Dashboard template variables Variable Value DropDown value link text ondemand').click(); | ||
await page1.getByRole('checkbox', { name: 'ccportal' }).click(); | ||
|
||
await page1.waitForLoadState('networkidle'); | ||
await page1.close() | ||
|
||
// if grafan is enabled then browse to the UI | ||
if (azhopConfig.monitoring.grafana) { | ||
// Create a page | ||
const page = await context.newPage(); | ||
await page.goto('/', { waitUntil: 'networkidle' }); | ||
|
||
await page.getByRole('button', { name: 'Monitoring' }).click(); | ||
const page1Promise = page.waitForEvent('popup'); | ||
await page.getByRole('link', { name: 'Grafana Dashboard' }).click(); | ||
const page1 = await page1Promise; | ||
await page1.getByRole('button', { name: 'Toggle menu' }).click(); | ||
await page1.getByTestId('navbarmenu').getByRole('link', { name: 'Dashboards' }).click(); | ||
await page1.getByTestId('data-testid Folder header dashboards').getByText('dashboards').click(); | ||
await page1.getByRole('link', { name: 'azhop - Infra Servers' }).click(); | ||
await page1.waitForLoadState('networkidle'); | ||
await page1.getByTestId('data-testid Dashboard template variables Variable Value DropDown value link text ondemand').click(); | ||
await page1.getByRole('checkbox', { name: 'ccportal' }).click(); | ||
|
||
await page1.waitForLoadState('networkidle'); | ||
await page1.close() | ||
} | ||
// Close the browser | ||
await context.close(); | ||
}); |