Skip to content

test(e2e): add Github actions plugin tests #2838

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

Conversation

prabinovRedhat
Copy link

@prabinovRedhat prabinovRedhat commented May 5, 2025

Description

Add Github actions plugin tests
Plugin reference https://www.npmjs.com/package/@backstage-community/plugin-github-actions

Which issue(s) does this PR fix

Fixes RHIDP-6710

PR acceptance criteria

Please make sure that the following steps are complete:

  • GitHub Actions are completed and successful
  • Unit Tests are updated and passing
  • E2E Tests are updated and passing
  • Documentation is updated if necessary (requirement for new features)
  • Add a screenshot if the change is UX/UI related

How to test changes / Special notes to the reviewer

@openshift-ci openshift-ci bot requested review from psrna and zdrapela May 5, 2025 10:11
Copy link

openshift-ci bot commented May 5, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign subhashkhileri for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

openshift-ci bot commented May 5, 2025

Hi @prabinovRedhat. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@prabinovRedhat
Copy link
Author

/cc @subhashkhileri @gustavolira

@prabinovRedhat prabinovRedhat force-pushed the rhdh-github-actions branch 3 times, most recently from 6a6c876 to a113db5 Compare May 5, 2025 10:56
Copy link
Contributor

github-actions bot commented May 5, 2025

@subhashkhileri
Copy link
Member

/ok-to-test

@gustavolira
Copy link
Member

/ok-to-test

Comment on lines 41 to 42
await page.waitForSelector('table, div[role="grid"], [data-testid="plugins-table"]', { timeout: 30000 });
await page.waitForTimeout(3000); // Add a delay to ensure the table is fully rendered
Copy link
Member

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="plugins-table"]') to ensure tests are more reliable and maintainable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

console.log(`Searching for plugin with term: ${searchTerm}`);

// Wait for search results
await page.waitForTimeout(2000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using await page.waitForTimeout(2000); is generally not a best practice as it introduces arbitrary delays that can make tests slower and less reliable. Instead, it’s better to wait for specific elements or conditions that indicate the page or component is ready. For example:
await page.waitForSelector('[data-testid="expected-element"]', { timeout: 10000 });

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 84 to 85
await page.waitForLoadState('domcontentloaded', { timeout: 60000 });
await page.waitForLoadState('networkidle', { timeout: 60000 });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@prabinovRedhat prabinovRedhat force-pushed the rhdh-github-actions branch 2 times, most recently from b2e4e67 to 4c5d838 Compare May 11, 2025 09:40
@prabinovRedhat
Copy link
Author

@gustavolira Please take a look again, after my fixes

Copy link
Contributor


test("Verify backstage-community-plugin-github-actions in Extensions page", async ({ page }) => {
// Navigate to Extensions page through Administration
await uiHelper.openSidebarButton("Administration");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, when Shelly's or Nati's PR will be merged I'll use their function, is it ok?
@gustavolira

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except of this comment, I fixed all the rest

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if it looks ok for you?


test.beforeEach(async ({ page }) => {
// Increase default timeout to account for slower responses
test.setTimeout(180000); // 3 minutes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this timeout

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

await expect(nameCell).toContainText("github-actions");

// Verify plugin status (Enabled and Preinstalled should both be "Yes")
const enabledCell = pluginRow.locator('td').nth(2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please check UiHelper.ts? I think there's some methods which you can reuse for it, for example verifyPluginRow

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 69 to 71
await uiHelper.openSidebar("Catalog");
await uiHelper.selectMuiBox("Kind", "Component");
await uiHelper.clickByDataTestId("user-picker-all");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use UiHelper.openCatalogSidebar function

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@prabinovRedhat prabinovRedhat force-pushed the rhdh-github-actions branch 2 times, most recently from 8044de6 to 056d7cc Compare May 13, 2025 11:49
Copy link
Contributor

@kadel
Copy link
Member

kadel commented May 14, 2025

/test e2e-tests

await uiHelper.searchInputPlaceholder(searchTerm);
console.log(`Searching for plugin with term: ${searchTerm}`);

// Use UIHelper to verify the plugin row instead of manual cell checking
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to keep comments that were used as instruction for AI in the code?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right! I missed this one, I'll fix

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed all comments

Copy link
Contributor

Copy link

openshift-ci bot commented May 21, 2025

@prabinovRedhat: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-tests 8353660 link true /test e2e-tests

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.

Copy link
Contributor

Copy link
Contributor

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.

@github-actions github-actions bot added the Stale label May 29, 2025
@github-actions github-actions bot closed this Jun 19, 2025
@prabinovRedhat prabinovRedhat changed the title test(e2e): add Github actions plugin tests test(e2e): add Github actions plugin test Jun 19, 2025
@prabinovRedhat prabinovRedhat changed the title test(e2e): add Github actions plugin test test(e2e): add Github actions plugin tests Jun 19, 2025
@prabinovRedhat
Copy link
Author

My PR was closed, I didn't succeed to re-open it, so I opened a new one - #3012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants