File tree 6 files changed +95
-3
lines changed
.ibm/pipelines/value_files
6 files changed +95
-3
lines changed Original file line number Diff line number Diff line change @@ -98,6 +98,8 @@ global:
98
98
disabled : false
99
99
- package : ./dynamic-plugins/dist/janus-idp-backstage-plugin-rbac
100
100
disabled : false
101
+ - package : ' ./dynamic-plugins/dist/janus-idp-backstage-plugin-analytics-provider-segment'
102
+ disabled : true
101
103
102
104
103
105
# this value will be overriden by 'helm install .... --set global.clusterRouterBase=value'
Original file line number Diff line number Diff line change @@ -41,12 +41,18 @@ export default defineConfig({
41
41
{
42
42
name : 'showcase' ,
43
43
use : { ...devices [ 'Desktop Chrome' ] } ,
44
- testIgnore : '**/playwright/e2e/plugins/rbac/**/*.spec.ts' ,
44
+ testIgnore : [
45
+ '**/playwright/e2e/plugins/rbac/**/*.spec.ts' ,
46
+ '**/playwright/e2e/plugins/analytics/analytics-disabled-rbac.spec.ts' ,
47
+ ] ,
45
48
} ,
46
49
{
47
50
name : 'showcase-rbac' ,
48
51
use : { ...devices [ 'Desktop Chrome' ] } ,
49
- testMatch : '**/playwright/e2e/plugins/rbac/**/*.spec.ts' ,
52
+ testMatch : [
53
+ '**/playwright/e2e/plugins/rbac/**/*.spec.ts' ,
54
+ '**/playwright/e2e/plugins/analytics/analytics-disabled-rbac.spec.ts' ,
55
+ ] ,
50
56
} ,
51
57
52
58
// {
Original file line number Diff line number Diff line change
1
+ import { test , expect } from '@playwright/test' ;
2
+ import { Common } from '../../../utils/Common' ;
3
+ import { UIhelper } from '../../../utils/UIhelper' ;
4
+ import { UIhelperPO } from '../../../support/pageObjects/global-obj' ;
5
+
6
+ test . describe ( 'Check RBAC "analytics-provider-segment" plugin' , ( ) => {
7
+ let common : Common ;
8
+ let uiHelper : UIhelper ;
9
+
10
+ test . beforeEach ( async ( { page } ) => {
11
+ uiHelper = new UIhelper ( page ) ;
12
+ common = new Common ( page ) ;
13
+ await common . loginAsGithubUser ( ) ;
14
+ await uiHelper . openSidebar ( 'Administration' ) ;
15
+ await uiHelper . verifyHeading ( 'Administration' ) ;
16
+ await uiHelper . verifyLink ( 'Plugins' ) ;
17
+ await uiHelper . clickTab ( 'Plugins' ) ;
18
+ } ) ;
19
+
20
+ test ( 'is disabled' , async ( { page } ) => {
21
+ await page
22
+ . getByPlaceholder ( 'Filter' )
23
+ . pressSequentially ( 'backstage-plugin-analytics-provider-segment\n' , {
24
+ delay : 300 ,
25
+ } ) ;
26
+ const row = await page . locator (
27
+ UIhelperPO . rowByText (
28
+ '@janus-idp/backstage-plugin-analytics-provider-segment' ,
29
+ ) ,
30
+ ) ;
31
+ expect ( await row . locator ( 'td' ) . nth ( 2 ) . innerText ( ) ) . toBe ( 'No' ) ; // not enabled
32
+ } ) ;
33
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { test , expect } from '@playwright/test' ;
2
+ import { Analytics } from '../../../utils/analytics/analytics' ;
3
+ import { APIHelper } from '../../../utils/APIHelper' ;
4
+
5
+ test ( 'Check "analytics-provider-segment" plugin is enabled' , async ( ) => {
6
+ const analytics = new Analytics ( ) ;
7
+ const apihelper = new APIHelper ( ) ;
8
+
9
+ const authHeader = await apihelper . getGuestAuthHeader ( ) ;
10
+ const pluginsList = await analytics . getDynamicPluginsList ( authHeader ) ;
11
+ const isPluginListed = analytics . checkPluginListed (
12
+ pluginsList ,
13
+ '@janus-idp/backstage-plugin-analytics-provider-segment' ,
14
+ ) ;
15
+
16
+ expect ( isPluginListed ) . toBe ( true ) ;
17
+ } ) ;
Original file line number Diff line number Diff line change 1
- import { request , APIResponse } from '@playwright/test' ;
1
+ import { request , APIResponse , expect } from '@playwright/test' ;
2
2
3
3
export class APIHelper {
4
4
private static githubAPIVersion = '2022-11-28' ;
@@ -38,4 +38,20 @@ export class APIHelper {
38
38
response = [ ...response , ...body ] ;
39
39
return await this . getGithubPaginatedRequest ( url , pageNo + 1 , response ) ;
40
40
}
41
+
42
+ async getGuestToken ( ) : Promise < string > {
43
+ const context = await request . newContext ( ) ;
44
+ const response = await context . post ( '/api/auth/guest/refresh' ) ;
45
+ expect ( response . status ( ) ) . toBe ( 200 ) ;
46
+ const data = await response . json ( ) ;
47
+ return data . backstageIdentity . token ;
48
+ }
49
+
50
+ async getGuestAuthHeader ( ) : Promise < { [ key : string ] : string } > {
51
+ const token = await this . getGuestToken ( ) ;
52
+ const headers = {
53
+ Authorization : `Bearer ${ token } ` ,
54
+ } ;
55
+ return headers ;
56
+ }
41
57
}
Original file line number Diff line number Diff line change
1
+ import { expect , request } from '@playwright/test' ;
2
+
3
+ export class Analytics {
4
+ async getDynamicPluginsList ( authHeader : { [ key : string ] : string } ) {
5
+ const context = await request . newContext ( ) ;
6
+ const loadedPluginsEndpoint = '/api/dynamic-plugins-info/loaded-plugins' ;
7
+ const response = await context . get ( loadedPluginsEndpoint , {
8
+ headers : authHeader ,
9
+ } ) ;
10
+ expect ( response . status ( ) ) . toBe ( 200 ) ;
11
+ const plugins = await response . json ( ) ;
12
+ return plugins ;
13
+ }
14
+
15
+ checkPluginListed ( plugins : any , expected : string ) {
16
+ return plugins . some ( ( plugin : { name : string } ) => plugin . name === expected ) ;
17
+ }
18
+ }
You can’t perform that action at this time.
0 commit comments