1
1
import { test , expect , Page } from "@playwright/test" ;
2
- import { UIhelper } from "../utils/ui-helper" ;
3
- import { Common , setupBrowser } from "../utils/common" ;
4
- import { RESOURCES } from "../support/testData/resources" ;
2
+ import { UIhelper } from "../../ utils/ui-helper" ;
3
+ import { Common , setupBrowser } from "../../ utils/common" ;
4
+ import { RESOURCES } from "../../ support/testData/resources" ;
5
5
import {
6
6
BackstageShowcase ,
7
7
CatalogImport ,
8
- } from "../support/pages/catalog-import" ;
9
- import { TEMPLATES } from "../support/testData/templates" ;
8
+ } from "../../support/pages/catalog-import" ;
9
+ import { TEMPLATES } from "../../support/testData/templates" ;
10
+ import { HelmActions } from "../../utils/helm" ;
11
+ import * as constants from "../../utils/authenticationProviders/constants" ;
12
+ import { LOGGER } from "../../utils/logger" ;
13
+ import { waitForNextSync } from "../../utils/helper" ;
10
14
11
15
let page : Page ;
12
16
13
17
// TODO: replace skip with serial
14
- test . describe . skip ( "GitHub Happy path" , ( ) => {
18
+ test . describe . serial ( "GitHub Happy path" , ( ) => {
15
19
//TODO: skipping due to RHIDP-4992
16
20
let common : Common ;
17
21
let uiHelper : UIhelper ;
18
22
let catalogImport : CatalogImport ;
19
23
let backstageShowcase : BackstageShowcase ;
24
+ const syncTime = 60 ;
20
25
21
26
const component =
22
27
"https://github.com/redhat-developer/rhdh/blob/main/catalog-entities/all.yaml" ;
@@ -28,12 +33,92 @@ test.describe.skip("GitHub Happy path", () => {
28
33
common = new Common ( page ) ;
29
34
catalogImport = new CatalogImport ( page ) ;
30
35
backstageShowcase = new BackstageShowcase ( page ) ;
31
- await common . loginAsGithubUser ( ) ;
32
36
} ) ;
33
37
34
- test . beforeEach (
35
- async ( ) => await new Common ( page ) . checkAndClickOnGHloginPopup ( ) ,
36
- ) ;
38
+ test ( "Setup Github authentication provider and wait for first sync" , async ( ) => {
39
+ test . setTimeout ( 300 * 1000 ) ;
40
+
41
+ LOGGER . info ( `Base Url is ${ process . env . BASE_URL } ` ) ;
42
+ LOGGER . info (
43
+ "Execute testcase: Setup Github authentication provider and wait for first sync" ,
44
+ ) ;
45
+
46
+ await HelmActions . upgradeHelmChartWithWait (
47
+ constants . AUTH_PROVIDERS_RELEASE ,
48
+ constants . AUTH_PROVIDERS_CHART ,
49
+ constants . AUTH_PROVIDERS_NAMESPACE ,
50
+ constants . AUTH_PROVIDERS_VALUES_FILE ,
51
+ constants . CHART_VERSION ,
52
+ constants . QUAY_REPO ,
53
+ constants . TAG_NAME ,
54
+ [
55
+ "--set upstream.backstage.appConfig.signInPage=github" ,
56
+ "--set upstream.backstage.appConfig.auth.environment=production" ,
57
+ "--set upstream.backstage.appConfig.catalog.providers.githubOrg[0].orgs[0]=janus-qe" ,
58
+ "--set upstream.backstage.appConfig.catalog.providers.microsoftGraphOrg=null" ,
59
+ "--set upstream.backstage.appConfig.catalog.providers.keycloakOrg=null" ,
60
+ "--set upstream.backstage.appConfig.auth.providers.microsoft=null" ,
61
+ "--set upstream.backstage.appConfig.auth.providers.oidc=null" ,
62
+ "--set upstream.backstage.appConfig.permission.enabled=false" ,
63
+ "--set upstream.postgresql.primary.persistence.enabled=false" ,
64
+ `--set-json global.dynamic.plugins='[
65
+ {
66
+ "package": "./dynamic-plugins/dist/backstage-plugin-scaffolder-backend-module-github-dynamic",
67
+ "disabled": false
68
+ },
69
+ {
70
+ "package": "./dynamic-plugins/dist/backstage-plugin-catalog-backend-module-github-dynamic",
71
+ "disabled": false,
72
+ "pluginConfig": {
73
+ "catalog": {
74
+ "providers": {
75
+ "github": {
76
+ "my-test-org": {
77
+ "organization": "janus-qe",
78
+ "catalogPath": "/catalog-info.yaml",
79
+ "schedule": {
80
+ "frequency": {
81
+ "minutes": 1
82
+ },
83
+ "timeout": {
84
+ "minutes": 1
85
+ },
86
+ "initialDelay": {
87
+ "seconds": 15
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ },
96
+ {
97
+ "package": "./dynamic-plugins/dist/backstage-community-plugin-github-issues",
98
+ "disabled": false
99
+ },
100
+ {
101
+ "package": "./dynamic-plugins/dist/roadiehq-backstage-plugin-github-pull-requests",
102
+ "disabled": false
103
+ },
104
+ {
105
+ "package": "./dynamic-plugins/dist/backstage-community-plugin-github-actions",
106
+ "disabled": false
107
+ },
108
+ {
109
+ "package": "./dynamic-plugins/dist/backstage-plugin-catalog-backend-module-github-org-dynamic",
110
+ "disabled": false
111
+ }
112
+ ]'` ,
113
+ ] ,
114
+ ) ;
115
+
116
+ await waitForNextSync ( "github" , syncTime ) ;
117
+ } ) ;
118
+
119
+ test ( "Login as a Github user." , async ( ) => {
120
+ await common . loginAsGithubUser ( ) ;
121
+ } ) ;
37
122
38
123
test ( "Verify Profile is Github Account Name in the Settings page" , async ( ) => {
39
124
await uiHelper . goToSettingsPage ( ) ;
@@ -71,7 +156,7 @@ test.describe.skip("GitHub Happy path", () => {
71
156
72
157
await uiHelper . openSidebar ( "Catalog" ) ;
73
158
await uiHelper . selectMuiBox ( "Kind" , "User" ) ;
74
- await uiHelper . searchInputAriaLabel ( "rhdh" ) ;
159
+ await uiHelper . searchInputPlaceholder ( "rhdh" ) ;
75
160
await uiHelper . verifyRowsInTable ( [ "rhdh-qe" ] ) ;
76
161
} ) ;
77
162
@@ -111,8 +196,10 @@ test.describe.skip("GitHub Happy path", () => {
111
196
await common . clickOnGHloginPopup ( ) ;
112
197
const openIssues = await backstageShowcase . getGithubOpenIssues ( ) ;
113
198
114
- const issuesCountText = `All repositories (${ openIssues . length } Issues)*` ;
115
- await expect ( page . locator ( `text=${ issuesCountText } ` ) ) . toBeVisible ( ) ;
199
+ const issuesCountText = new RegExp (
200
+ `All repositories \\(${ openIssues . length } Issue.*\\)` ,
201
+ ) ;
202
+ await expect ( page . getByText ( issuesCountText ) ) . toBeVisible ( ) ;
116
203
117
204
for ( const issue of openIssues . slice ( 0 , 5 ) ) {
118
205
await uiHelper . verifyText ( issue . title . replace ( / \s + / g, " " ) ) ;
@@ -132,8 +219,7 @@ test.describe.skip("GitHub Happy path", () => {
132
219
await backstageShowcase . verifyPRRows ( closedPRs , 0 , 5 ) ;
133
220
} ) ;
134
221
135
- // TODO https://issues.redhat.com/browse/RHIDP-3159 The last ~10 GitHub Pull Requests are missing from the list
136
- test . skip ( "Click on the arrows to verify that the next/previous/first/last pages of PRs are loaded" , async ( ) => {
222
+ test ( "Click on the arrows to verify that the next/previous/first/last pages of PRs are loaded" , async ( ) => {
137
223
console . log ( "Fetching all PRs from GitHub" ) ;
138
224
const allPRs = await BackstageShowcase . getShowcasePRs ( "all" , true ) ;
139
225
@@ -145,32 +231,37 @@ test.describe.skip("GitHub Happy path", () => {
145
231
await backstageShowcase . clickNextPage ( ) ;
146
232
await backstageShowcase . verifyPRRows ( allPRs , 5 , 10 ) ;
147
233
148
- const lastPagePRs = Math . floor ( ( allPRs . length - 1 ) / 5 ) * 5 ;
234
+ // const lastPagePRs = Math.floor((allPRs.length - 1) / 5) * 5;
235
+ const lastPagePRs = 996 ; // redhat-developer/rhdh have more than 1000 PRs open/closed and by default the latest 1000 PR results are displayed.
149
236
150
237
console . log ( "Clicking on Last Page button" ) ;
151
238
await backstageShowcase . clickLastPage ( ) ;
152
- await backstageShowcase . verifyPRRows ( allPRs , lastPagePRs , allPRs . length ) ;
239
+ await backstageShowcase . verifyPRRows ( allPRs , lastPagePRs , 1000 ) ;
153
240
154
241
console . log ( "Clicking on Previous Page button" ) ;
155
242
await backstageShowcase . clickPreviousPage ( ) ;
156
- await backstageShowcase . verifyPRRows ( allPRs , lastPagePRs - 5 , lastPagePRs ) ;
243
+ await common . waitForLoad ( ) ;
244
+ await backstageShowcase . verifyPRRows (
245
+ allPRs ,
246
+ lastPagePRs - 5 ,
247
+ lastPagePRs - 1 ,
248
+ ) ;
157
249
} ) ;
158
250
159
- //FIXME
160
- test . skip ( "Verify that the 5, 10, 20 items per page option properly displays the correct number of PRs" , async ( ) => {
251
+ test ( "Verify that the 5, 10, 20 items per page option properly displays the correct number of PRs" , async ( ) => {
161
252
await uiHelper . openSidebar ( "Catalog" ) ;
253
+ await uiHelper . clickByDataTestId ( "user-picker-all" ) ;
162
254
await uiHelper . clickLink ( "Backstage Showcase" ) ;
163
255
await common . clickOnGHloginPopup ( ) ;
164
256
await uiHelper . clickTab ( "Pull/Merge Requests" ) ;
165
- await uiHelper . clickButton ( "ALL" , { force : false } ) ;
166
- const allPRs = await BackstageShowcase . getShowcasePRs ( "all" ) ;
257
+ const allPRs = await BackstageShowcase . getShowcasePRs ( "open" ) ;
167
258
await backstageShowcase . verifyPRRowsPerPage ( 5 , allPRs ) ;
168
259
await backstageShowcase . verifyPRRowsPerPage ( 10 , allPRs ) ;
169
260
await backstageShowcase . verifyPRRowsPerPage ( 20 , allPRs ) ;
170
261
} ) ;
171
262
172
263
test ( "Verify that the CI tab renders 5 most recent github actions and verify the table properly displays the actions when page sizes are changed and filters are applied" , async ( ) => {
173
- await uiHelper . clickTab ( " CI") ;
264
+ await page . locator ( "a" ) . getByText ( " CI", { exact : true } ) . first ( ) . click ( ) ;
174
265
await common . checkAndClickOnGHloginPopup ( ) ;
175
266
176
267
const workflowRuns = await backstageShowcase . getWorkflowRuns ( ) ;
0 commit comments