-
Notifications
You must be signed in to change notification settings - Fork 197
test(e2e): add Github Insights plugin tests #2818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @natifridman. Thanks for your PR. I'm waiting for a redhat-developer member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
The image is available at: |
This PR is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 21 days. |
/ok-to-test |
import { Common } from "../../../utils/common"; | ||
import { UI_HELPER_ELEMENTS } from "../../../support/pageObjects/global-obj"; | ||
|
||
// Test to verify if the GitHub Insights plugin is installed - runs independently |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment has the same text of the test description.
|
||
const uiHelper = new UIhelper(page); | ||
|
||
// Navigate to the Administration in the sidebar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excessive Comments:
While comments are useful, some explain actions that are already obvious from the function names.
|
||
// Wait for the page to load | ||
await page.waitForLoadState("networkidle"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to a function into UiHelper
await uiHelper.openSidebar("Extensions"); | ||
|
||
// Wait for the page to load | ||
await page.waitForLoadState("networkidle"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using page.waitForLoadState('networkidle') and page.waitForLoadState('domcontentloaded') is not recommended for modern web applications. These methods rely on global states that can be unreliable in dynamic applications with ongoing network requests (e.g., WebSockets or API polling). Instead, it’s better to wait for specific elements or components that indicate the page is fully loaded and interactive. For example, use
page.waitForSelector('[data-testid="something"]') to ensure tests are more reliable and maintainable.
await uiHelper.openSidebar("Catalog"); | ||
await uiHelper.selectMuiBox("Kind", "Component"); | ||
await uiHelper.clickByDataTestId("user-picker-all"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a function on UiHelper openCatalogSidebar you can reuse it
https://github.com/redhat-developer/rhdh/blob/main/e2e-tests/playwright/utils/ui-helper.ts#L207
await uiHelper.clickLink(repoWithGitHubInsights); | ||
|
||
// Wait for entity page to load | ||
await page.waitForLoadState("networkidle"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue
await uiHelper.verifyTextinCard("Compliance report", "License"); | ||
await uiHelper.verifyTextinCard("Compliance report", "Apache License"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await uiHelper.verifyTextinCard("Compliance report", "License"); | |
await uiHelper.verifyTextinCard("Compliance report", "Apache License"); | |
await uiHelper.verifyMultipleTextsInCard("Compliance report", ["License", "Apache License"]); |
a1ff257
to
c6d0128
Compare
The image is available at: |
The image is available at: |
6dedea6
to
3e37596
Compare
/test e2e-tests-nightly-auth-providers |
@gustavolira: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
3e37596
to
37aba26
Compare
e2e-tests/playwright.config.ts
Outdated
testMatch: ["**/playwright/e2e/authProviders/*.spec.ts"], | ||
testMatch: [ | ||
"**/playwright/e2e/authProviders/*.spec.ts", | ||
"**/playwright/e2e/plugins/github-insights/*.spec.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The auth-providers job is not the best place to run any GitHub plugin-related test; this job is going to be refactored soon and will not include any plugin test. Also, just adding the files in testMatch list is not enough to run them in this job, as they do not run against a single RHDH instance, but multiple ones are created and deleted dynamically during the tests execution.
I would recommend to setup the Github integration and the Github auth provider in the e2e main job configuration files and run the plugins tests along with the other plugins tests.
I'm going to create the OAuth for you and provide the necessary changes to update the configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @albarbaro, any update on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created the Oauth client. You need to update the configuration with following:
- load the new environment variable from vault by adding here these lines
GITHUB_OAUTH_APP_ID=$(cat /tmp/secrets/GITHUB_OAUTH_APP_ID)
GITHUB_OAUTH_APP_SECRET=$(cat /tmp/secrets/GITHUB_OAUTH_APP_SECRET)
- update the app-config to add the github auth provider by adding this config in here
auth:
github:
production:
clientSecret: ${GITHUB_OAUTH_APP_SECRET}
clientId: ${GITHUB_OAUTH_APP_ID}
callbackUrl: ${RHDH_BASE_URL}/api/auth/github/handler/frame
- the github-org plugin is apparently already enabled: you might want to adjust the sync frequency if the users are not ingested immediately
- move **/playwright/e2e/plugins/github-insights/*.spec.ts out of the showcase-auth-providers playwright project and place them in the showcase one
The main configuration uses RHBK as the default signIn page: this means that your tests might need to be updated to login from the settings page if interactive login is required (but this is plugin specific).
cc @subhashkhileri @gustavolira please double check or raise any concern/error if you spot some.
37aba26
to
a95e1ee
Compare
73b1c53
to
e929f9d
Compare
This PR is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 21 days. |
Comment to remove stale |
/remove stale |
This PR is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 21 days. |
e929f9d
to
12f1eb1
Compare
The image is available at: |
@@ -104,6 +104,11 @@ auth: | |||
signIn: | |||
resolvers: | |||
- resolver: emailLocalPartMatchingUserEntityName | |||
github: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is already one github auth configured, lets not duplicate it. https://github.com/redhat-developer/rhdh/pull/2818/files#diff-feaa002a3b212bd3fbc10b72ef2f2cb16c8dcc1ab3f91698ffbc694281af55c2R92
@@ -17,6 +17,8 @@ data: | |||
GITHUB_URL: $GITHUB_URL | |||
GITHUB_ORG: $GITHUB_ORG | |||
GITHUB_ORG_2: $GITHUB_ORG_2 | |||
GITHUB_OAUTH_APP_SECRET: $GITHUB_OAUTH_APP_SECRET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GITHUB_OAUTH secrete and app ID is already present in secrets
@@ -57,6 +57,9 @@ QE_USER5_PASS=$(cat /tmp/secrets/QE_USER5_PASS) | |||
QE_USER6_ID=$(cat /tmp/secrets/QE_USER6_ID) | |||
QE_USER6_PASS=$(cat /tmp/secrets/QE_USER6_PASS) | |||
|
|||
GITHUB_OAUTH_APP_ID=$(cat /tmp/secrets/GITHUB_OAUTH_APP_ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GITHUB_OAUTH secrete and app ID is already present in env_variables.sh
* Navigates to the Extensions page in the Administration section | ||
* and selects the Installed tab | ||
*/ | ||
async navigateToExtensions() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is already one method for this in PR #3013
please check the quoted comments "This method is doing more than just navigation. would it make sense to move other clicks in test itself so in future someone want to use this method other than installed Tab they can use it."
* @param texts Array of strings or RegExp to verify in the card | ||
* @param exact Whether to match exact text | ||
*/ | ||
async verifyMultipleTextsInCard( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@natifridman accepting [] in verifyTextinCard is fine without a need for another method ``verifyMultipleTextsInCard`
|
||
// Click on the repo link and wait for entity page heading to appear | ||
await uiHelper.clickLink(repoWithGitHubInsights); | ||
await page.waitForSelector("h1", { state: "visible" }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have waitForTitle on UIHelper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @natifridman can you please update this one?
This PR is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 21 days. |
12f1eb1
to
dc4458c
Compare
The image is available at: |
@natifridman: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
This PR is stale because it has been open 7 days with no activity. Remove stale label or comment or this will be closed in 21 days. |
Description
Add Github Insights plugin tests
https://github.com/RoadieHQ/roadie-backstage-plugins/tree/main/plugins/frontend/backstage-plugin-github-insights
Which issue(s) does this PR fix
PR acceptance criteria
Please make sure that the following steps are complete:
How to test changes / Special notes to the reviewer