Skip to content

Add ui test for Oauth (AST-89331) #1080

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

cx-elchanan-arbiv
Copy link
Contributor

@cx-elchanan-arbiv cx-elchanan-arbiv commented Mar 30, 2025

Description

Add ui test for Oauth
and fix

  1. sign in to checkmarx -> cancel -> operation is still running
  2. login error messages are not disapearing

References

https://checkmarx.atlassian.net/browse/AST-89331

Testing

Describe how this change was tested. Be specific about anything not tested and reasons why. If this solution has unit and/or integration testing, tests should be added for new functionality and existing tests should complete without errors.

Please include any manual steps for testing end-to-end or functionality not covered by unit/integration tests.

Checklist

  • I have added documentation for new/changed functionality in this PR (if applicable).
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

Copy link
Contributor

Logo
Checkmarx One – Scan Summary & Detailsae426b42-a6a4-4a25-a59b-55ca4a0870ce

Great job, no security vulnerabilities found in this Pull Request

const radioButtons = await webView.findWebElements(By.css("input[type='radio']"));
console.log(`Found ${radioButtons.length} radio buttons`);

// Additional test code...
Copy link
Contributor

Choose a reason for hiding this comment

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

where is the test code?
what exactly are we testing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It tests the logout button, meaning it clicks on it and then clicks "yes" in the dialog message that appears.
Additionally, after logging out, it checks that there are two buttons:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added to the test that if the user wasn't logged in, it should first log in and then perform a logout to test this process.

The test also verifies the fields for both OAuth and API Key authentication methods.

await new EditorView().closeAllEditors();
});

it("should open OAuth authentication panel and verify UI elements", retryTest(async function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

refactor this test and extract code to separate function in order to make it shorter and more readble.
You also have some duplicate code that you can extract into separate function.
example for duplicated code:
await new EditorView().closeAllEditors();
await bench.executeCommand(CX_AUTHENTICATION_COMMAND);
await sleep(3000);
await new EditorView().openEditor("Checkmarx One Authentication");
await webView.switchToFrame(5000);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i Split into multiple tests and manage the duplicate code

cx-ben-alvo
cx-ben-alvo previously approved these changes Mar 31, 2025
Copy link
Contributor

@cx-ben-alvo cx-ben-alvo left a comment

Choose a reason for hiding this comment

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

Nice!

cx-ben-alvo
cx-ben-alvo previously approved these changes Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants