Skip to content
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

Stabilize workspace with parent test #23242

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

Conversation

musienko-maxim
Copy link
Contributor

@musienko-maxim musienko-maxim commented Nov 11, 2024

What does this PR do?

Stabilize the WorkspaceWithParent and implement a new solution for disabling the TrustDialog using a new method. The main idea - is to switch it off in background mode with a special JS script using JavascriptExecutor and patching the local database in the browser session. It is similar to setting up its "security.workspace.trust.enabled":false with user preferences. Handling the dialog by UI is hard because it is not easy to predict where it can appear.

Screenshot/screencast of this PR

    ✔ Check expected environment variables
          ▼ Dashboard.openDashboard
            ‣ DriverHelper.navigateToUrl
            ‣ DriverHelper.getDriver
          ▼ Dashboard.waitPage
            ‣ DriverHelper.waitVisibility - By(xpath, //div[@id="page-sidebar"]//a[contains(text(), "Workspaces (")])
            ‣ DriverHelper.waitVisibility - polling timed out attempt #1, retrying with 1000ms timeout
            ‣ DriverHelper.waitVisibility - polling timed out attempt #2, retrying with 1000ms timeout
            ‣ DriverHelper.waitVisibility - element is located and is visible.
            ‣ DriverHelper.waitVisibility - By(xpath, //div[@id="page-sidebar"]//a[text()="Create Workspace"])
            ‣ DriverHelper.waitVisibility - element is located and is visible.
            ‣ BrowserTabsUtil.closeAllTabsExceptCurrent
          ▼ BrowserTabsUtil.getAllWindowHandles
            ‣ DriverHelper.getDriver
          ▼ BrowserTabsUtil.getCurrentWindowHandle
            ‣ DriverHelper.getDriver
          ▼ BrowserTabsUtil.switchToWindow
            ‣ DriverHelper.getDriver
          ▼ TestWorkspaceUtil.stopAndDeleteWorkspaceByName
          ▼ TestWorkspaceUtil.stopWorkspaceByName - sample-using-parent
          ▼ ApiUrlResolver.obtainUserNamespace
            ‣ ApiUrlResolver.obtainUserNamespace - USER_NAMESPACE.length = 0, calling kubernetes API
            ‣ DriverHelper.getDriver
(node:526005) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
          ▼ ApiUrlResolver.obtainUserNamespace - kubeapi success: admin-devspaces
            ‣ DriverHelper.getDriver
          ▼ TestWorkspaceUtil.waitWorkspaceStatus
          ▼ ApiUrlResolver.obtainUserNamespace - admin-devspaces
            ‣ DriverHelper.getDriver
          ▼ TestWorkspaceUtil.stopWorkspaceByName - sample-using-parent stopped successfully
          ▼ TestWorkspaceUtil.deleteWorkspaceByName - sample-using-parent
          ▼ ApiUrlResolver.obtainUserNamespace - admin-devspaces
            ‣ DriverHelper.getDriver
            ‣ DriverHelper.getDriver
          ▼ TestWorkspaceUtil.deleteWorkspaceByName - sample-using-parent deleted successfully
          ▼     at /home/mmusiien/che-projects/che/tests/e2e/specs/MochaHooks.ts:39:12 - delete workspace name


  5 passing (2m)

What issues does this PR fix or reference?

How to test this PR?

Run the WorkspaceWithParent.spec.ts as usual
-->

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Copy link
Contributor

@SkorikSergey SkorikSergey left a comment

Choose a reason for hiding this comment

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

Approved. Setting security.workspace.trust.enabled: false` is much better than constantly fixing trustDialog errors.

@dmytro-ndp dmytro-ndp changed the title Stabilize workspace with parent Stabilize workspace with parent test Nov 13, 2024
let podName: string = '';

suiteSetup(function (): void {
kubernetesCommandLineToolsExecutor.loginToOcp();
kubernetesCommandLineToolsExecutor.namespace = BASE_TEST_CONSTANTS.TEST_NAMESPACE;
Copy link
Contributor

Choose a reason for hiding this comment

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

BASE_TEST_CONSTANTS.TEST_NAMESPACE could be empty, e.g. when run Dev Spaces test pipelines.

There is an example of code which handles absence of BASE_TEST_CONSTANTS.TEST_NAMESPACE: KubernetesCommandLineToolsExecutor

Copy link
Contributor Author

@musienko-maxim musienko-maxim Nov 13, 2024

Choose a reason for hiding this comment

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

I removed it. Thx for pointing! Seems, unnecessary operation after experimenting with test launching

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

Successfully merging this pull request may close these issues.

4 participants