eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.99k stars 1.19k forks source link

Stabilize workspace with parent test #23242

Closed musienko-maxim closed 1 week ago

musienko-maxim commented 1 week ago

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.