-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RHIDP-2065: [QE] Automate Scenario - Telemetry (#1268)
* RHIDP-2065: [QE] Automate Scenario - Telemetry * Add skip to RBAC test, TODO * Revert "Add skip to RBAC test, TODO" This reverts commit 1c1d07c. * Add guest login for RBAC * Fix beforeEach * GithubUser * Update analytics-disabled-rbac.spec.ts * Update analytics-disabled-rbac.spec.ts * Verify plugin disabled RBAC in UI * Fix before each * Move to APIHelper
- Loading branch information
Showing
6 changed files
with
95 additions
and
3 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
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
33 changes: 33 additions & 0 deletions
33
e2e-tests/playwright/e2e/plugins/analytics/analytics-disabled-rbac.spec.ts
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { Common } from '../../../utils/Common'; | ||
import { UIhelper } from '../../../utils/UIhelper'; | ||
import { UIhelperPO } from '../../../support/pageObjects/global-obj'; | ||
|
||
test.describe('Check RBAC "analytics-provider-segment" plugin', () => { | ||
let common: Common; | ||
let uiHelper: UIhelper; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
uiHelper = new UIhelper(page); | ||
common = new Common(page); | ||
await common.loginAsGithubUser(); | ||
await uiHelper.openSidebar('Administration'); | ||
await uiHelper.verifyHeading('Administration'); | ||
await uiHelper.verifyLink('Plugins'); | ||
await uiHelper.clickTab('Plugins'); | ||
}); | ||
|
||
test('is disabled', async ({ page }) => { | ||
await page | ||
.getByPlaceholder('Filter') | ||
.pressSequentially('backstage-plugin-analytics-provider-segment\n', { | ||
delay: 300, | ||
}); | ||
const row = await page.locator( | ||
UIhelperPO.rowByText( | ||
'@janus-idp/backstage-plugin-analytics-provider-segment', | ||
), | ||
); | ||
expect(await row.locator('td').nth(2).innerText()).toBe('No'); // not enabled | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
e2e-tests/playwright/e2e/plugins/analytics/analytics-enabled.spec.ts
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { Analytics } from '../../../utils/analytics/analytics'; | ||
import { APIHelper } from '../../../utils/APIHelper'; | ||
|
||
test('Check "analytics-provider-segment" plugin is enabled', async () => { | ||
const analytics = new Analytics(); | ||
const apihelper = new APIHelper(); | ||
|
||
const authHeader = await apihelper.getGuestAuthHeader(); | ||
const pluginsList = await analytics.getDynamicPluginsList(authHeader); | ||
const isPluginListed = analytics.checkPluginListed( | ||
pluginsList, | ||
'@janus-idp/backstage-plugin-analytics-provider-segment', | ||
); | ||
|
||
expect(isPluginListed).toBe(true); | ||
}); |
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { expect, request } from '@playwright/test'; | ||
|
||
export class Analytics { | ||
async getDynamicPluginsList(authHeader: { [key: string]: string }) { | ||
const context = await request.newContext(); | ||
const loadedPluginsEndpoint = '/api/dynamic-plugins-info/loaded-plugins'; | ||
const response = await context.get(loadedPluginsEndpoint, { | ||
headers: authHeader, | ||
}); | ||
expect(response.status()).toBe(200); | ||
const plugins = await response.json(); | ||
return plugins; | ||
} | ||
|
||
checkPluginListed(plugins: any, expected: string) { | ||
return plugins.some((plugin: { name: string }) => plugin.name === expected); | ||
} | ||
} |