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

"DevConsole integration" regression test case automation #22181

Merged
merged 4 commits into from
May 3, 2023

Conversation

nallikaea
Copy link
Contributor

@nallikaea nallikaea commented Apr 26, 2023

What does this PR do?

  • Test suite for automation pre-release "DevConsole integration".
  • Updated loginToOcp() method.

Screenshot/screencast of this PR

Screencast.from.26.04.23.20.18.41.webm

What issues does this PR fix or reference?

https://issues.redhat.com/browse/CRW-4199
test-case

How to test this PR?

export USERSTORY=DevConsoleIntegration && npm run test

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.

@che-bot che-bot added status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. target/branch Indicates that a PR will be merged into a branch other than master. labels Apr 26, 2023
@nallikaea nallikaea changed the title "DevConsole integration" regression test case automation WIP: "DevConsole integration" regression test case automation Apr 26, 2023
@nallikaea nallikaea self-assigned this Apr 26, 2023
@nallikaea
Copy link
Contributor Author

/usr/bin/npm test

> @eclipse-che/[email protected] test
> ./configs/sh-scripts/initDefaultValues.sh npm run lint && npm run tsc && export USERSTORY=$USERSTORY && mocha --config dist/configs/mocharc.js

Initialized default values

TS_SELENIUM_VALUE_TLS_SUPPORT =       
TS_SELENIUM_VALUE_OPENSHIFT_OAUTH =   true
TS_OCP_LOGIN_PAGE_PROVIDER_TITLE =    htpasswd
E2E_OCP_CLUSTER_VERSION =             4.x
TS_SELENIUM_LOG_LEVEL =               DEBUG
TS_SELENIUM_OCP_USERNAME =            user
TS_SELENIUM_W3C_CHROME_OPTION =       true
NODE_TLS_REJECT_UNAUTHORIZED =        0
TS_SELENIUM_EDITOR =                  che-code

> @eclipse-che/[email protected] tsc
> rm -rf ./dist && ./configs/sh-scripts/generateIndex.sh && tsc -p .

Generating index.ts file...
Warning: Cannot find any files matching pattern "dist/specs/DevConsoleIntegration.spec.js"

################## Launch Information ##################

      TS_SELENIUM_BASE_URL: https://devspaces.apps.ocp410-mdolhal.crw-qe.com
      TS_SELENIUM_HEADLESS: false
      TS_SELENIUM_OCP_USERNAME: user
      TS_SELENIUM_EDITOR:   che-code

      TS_SELENIUM_HAPPY_PATH_WORKSPACE_NAME: petclinic-dev-environment
      TS_SELENIUM_DELAY_BETWEEN_SCREENSHOTS: 1000
      TS_SELENIUM_REPORT_FOLDER: ./report
      TS_SELENIUM_EXECUTION_SCREENCAST: false
      DELETE_SCREENCAST_IF_TEST_PASS: true
      TS_SELENIUM_REMOTE_DRIVER_URL: 
      DELETE_WORKSPACE_ON_FAILED_TEST: true
      TS_SELENIUM_LOG_LEVEL: DEBUG
      TS_SELENIUM_LAUNCH_FULLSCREEN: true

      TS_COMMON_DASHBOARD_WAIT_TIMEOUT: 5000
      TS_SELENIUM_START_WORKSPACE_TIMEOUT: 360000
      TS_WAIT_LOADER_PRESENCE_TIMEOUT: 60000

      TS_SAMPLE_LIST: Node.js MongoDB,Node.js Express

      MOCHA_DRIRECTORY is not set
      USERSTORY: DevConsoleIntegration

      to output timeout variables, set TS_SELENIUM_PRINT_TIMEOUT_VARIABLES to true
 ######################################################## 


  DevConsole Integration
          ▼ KubernetesCommandLineToolsExecutor.loginToOcp - oc: Login to the "OC" client.
          ▼ KubernetesCommandLineToolsExecutor.getServerUrl - oc: Get server api url.
oc whoami && oc whoami --show-server=true
Error from server (Forbidden): users.user.openshift.io "~" is forbidden: User "system:anonymous" cannot get resource "users" in API group "user.openshift.io" at the cluster scope
          ▼ KubernetesCommandLineToolsExecutor.loginToOcp - oc: https://api.ocp410-mdolhal.crw-qe.com:6443, user
Login successful.

You have access to the following projects and can switch between them with 'oc project <projectname>':

  * project
    user-devspaces

Using project "project".
          ▼ KubernetesCommandLineToolsExecutor.deleteProject - oc: Delete "devconsole-integration-test".
oc delete project devconsole-integration-test -n user-devspaces && sleep 5s
warning: deleting cluster-scoped resources, not scoped to the provided namespace
Error from server (Forbidden): projects.project.openshift.io "devconsole-integration-test" is forbidden: User "user" cannot delete resource "projects" in API group "project.openshift.io" in the namespace "devconsole-integration-test"
          ▼ KubernetesCommandLineToolsExecutor.createProject - oc: Create new project "devconsole-integration-test".
oc new-project devconsole-integration-test -n user-devspaces
Now using project "devconsole-integration-test" on server "https://api.ocp410-mdolhal.crw-qe.com:6443".

You can add applications to this project with the 'new-app' command. For example, try:

    oc new-app rails-postgresql-example

to build a new example application in Ruby. Or use kubectl to deploy a simple Kubernetes application:

    kubectl create deployment hello-node --image=k8s.gcr.io/e2e-test-images/agnhost:2.33 -- /agnhost serve-hostname

          ▼ BrowserTabsUtil.navigateTo https://console-openshift-console.apps.ocp410-mdolhal.crw-qe.com
          ▼ OcpUserLoginPage.login
          ▼ OcpLoginPage.clickOnLoginProviderTitle
  [ERROR] DriverHelper.waitVisibility - failed with exception, out of attempts - TimeoutError: Waiting for element to be located By(xpath, //a[text()='htpasswd'])
  Wait timed out after 1077ms
  [ERROR] DriverHelper.waitVisibility - failed with exception, out of attempts - TimeoutError: Waiting for element to be located By(xpath, //a[text()='htpasswd'])
  Wait timed out after 1098ms
  [ERROR] DriverHelper.waitVisibility - failed with exception, out of attempts - TimeoutError: Waiting for element to be located By(xpath, //a[text()='htpasswd'])
  Wait timed out after 1068ms
          ▼ OcpLoginPage.waitOpenShiftLoginWelcomePage
          ▼ OcpLoginPage.enterUserNameOpenShift "user"
          ▼ OcpLoginPage.enterPasswordOpenShift"
          ▼ OcpLoginPage.clickOnLoginButton
          ▼ OcpLoginPage.waitDisappearanceOpenShiftLoginWelcomePage
          ▼ TS_SELENIUM_LAUNCH_FULLSCREEN is set to true, maximizing window.
    ✔ Login into ocp console (22425ms)
          ▼ OcpMainPage.selectProject
  [ERROR] DriverHelper.waitVisibility - failed with exception, out of attempts - TimeoutError: Waiting for element to be located By(xpath, //div[@class="co-namespace-dropdown"]//button)
  Wait timed out after 1015ms
  [ERROR] DriverHelper.waitVisibility - failed with exception, out of attempts - TimeoutError: Waiting for element to be located By(xpath, //div[@class="co-namespace-dropdown"]//button)
  Wait timed out after 1077ms
  [ERROR] DriverHelper.waitVisibility - failed with exception, out of attempts - TimeoutError: Waiting for element to be located By(xpath, //div[@class="co-namespace-dropdown"]//button)
  Wait timed out after 1026ms
  [ERROR] DriverHelper.waitVisibility - failed with exception, out of attempts - TimeoutError: Waiting for element to be located By(xpath, //div[@class="co-namespace-dropdown"]//button)
  Wait timed out after 1057ms
    ✔ Select test project on DevConsole (4905ms)
          ▼ OcpMainPage.waitOpenMainPage
          ▼ OcpMainPage.clickOnSelectRoleButton
          ▼ OcpMainPage.selectDeveloperRole
          ▼ OcpMainPage.clickAddToProjectButton
          ▼ OcpMainPage.selectImportFromGitMethod
    ✔ Open import from git project page as Developer (914ms)
          ▼ OcpImportFromGitPage.fitAndSubmitConfiguration
          ▼ OcpImportFromGitPage.enterGitRepoUrl "https://github.com/musienko-maxim/summit-lab-spring-music"
          ▼ OcpImportFromGitPage.clickOnAdvancedOptionsButton
          ▼ OcpImportFromGitPage.enterGitReference "pipeline"
          ▼ OcpImportFromGitPage.selectBuilderImageImportStrategy
          ▼ OcpImportFromGitPage.addLabel "app.openshift.io/runtime=spring"
          ▼ OcpImportFromGitPage.submitConfiguration
    ✔ Fill and submit import data (9486ms)
          ▼ OcpApplicationPage.waitApplicationIcon
    ✔ Wait until application creates (19580ms)
          ▼ OcpApplicationPage.waitAndOpenEditSourceCodeIcon
          ▼ BrowserTabsUtil.getCurrentWindowHandle
          ▼ BrowserTabsUtil.waitAndSwitchToAnotherWindow
          ▼ BrowserTabsUtil.getAllWindowHandles
          ▼ BrowserTabsUtil.getAllWindowHandles
          ▼ BrowserTabsUtil.switchToWindow
    ✔ Check if application has worked link "Open Source Code" (144ms)
          ▼ RegularUserOcpCheLoginPage.login
          ▼ RegularUserOcpCheLoginPage.login wait for LogInWithOpenShift page and click button
          ▼ OcpLoginPage.isIdentityProviderLinkVisible
          ▼ OcpLoginPage.clickOnLoginProviderTitle
          ▼ OcpLoginPage.waitOpenShiftLoginWelcomePage
          ▼ OcpLoginPage.enterUserNameOpenShift "user"
          ▼ OcpLoginPage.enterPasswordOpenShift"
          ▼ OcpLoginPage.clickOnLoginButton
          ▼ OcpLoginPage.waitDisappearanceOpenShiftLoginWelcomePage
          ▼ OcpLoginPage.isAuthorizeOpenShiftIdentityProviderPageVisible
          ▼ TS_SELENIUM_LAUNCH_FULLSCREEN is set to true, maximizing window.
          ▼ Dashboard.waitStartingPageLoaderDisappearance
    ✔ Login (21075ms)
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
  [WARN] WorkspaceHandlingTests.obtainWorkspaceNameFromStartingPage Failed to obtain name from workspace start page, element not visible yet. Retrying.
      • Obtained workspace name from workspace loader page: spring-music-lsdp
    ✔ Obtain workspace name from workspace loader page (11253ms)
          ▼ MochaHooks.registerRunningWorkspace with workspaceName:spring-music-lsdp
    ✔ Registering the running workspace
    ✔ Check if application source code opens in workspace (38581ms)
    ✔ Check if project and files imported (138ms)
          ▼ Dashboard.logout
          ▼ Dashboard.openDashboard
          ▼ Dashboard.waitPage
          ▼ Dashboard.getUserDropdownMenuButtonLocator: get current user.
          ▼ Dashboard.getUserDropdownMenuButtonLocator: user.
          ▼ Dashboard.getUserDropdownMenuButtonLocator: get current user.
          ▼ Dashboard.getUserDropdownMenuButtonLocator: user.
    ✔ Logout (12769ms)
          ▼ KubernetesCommandLineToolsExecutor.deleteProject - oc: Delete "devconsole-integration-test".
oc delete project devconsole-integration-test -n user-devspaces && sleep 5s
warning: deleting cluster-scoped resources, not scoped to the provided namespace
project.project.openshift.io "devconsole-integration-test" deleted

      • Property DELETE_WORKSPACE_ON_FAILED_TEST is true - trying to stop and delete running workspace with API.
          ▼ TestWorkspaceUtil.stopAndDeleteWorkspaceByName
          ▼ TestWorkspaceUtil.stopWorkspaceByName
          ▼ ApiUrlResolver.obtainUserNamespace 
      • Chrome driver session stopped.

  12 passing (3m)


Process finished with exit code 0

@nallikaea nallikaea changed the title WIP: "DevConsole integration" regression test case automation "DevConsole integration" regression test case automation Apr 26, 2023
@nallikaea nallikaea force-pushed the devconsole branch 2 times, most recently from fd5bc9c to a58133a Compare April 26, 2023 18:27
mdolhalo added 2 commits April 26, 2023 20:28
Copy link
Member

@ScrewTSW ScrewTSW left a comment

Choose a reason for hiding this comment

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

Impresive fix! LGTM

…stAttempt(), deleted "as unknown as string", lint fixups

Signed-off-by: mdolhalo <[email protected]>
@nallikaea
Copy link
Contributor Author

nallikaea commented May 2, 2023

test run after fixes

  12 passing (4m)


Process finished with exit code 0

Copy link
Contributor

@dmytro-ndp dmytro-ndp left a comment

Choose a reason for hiding this comment

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

Looks good to merge.

@dmytro-ndp dmytro-ndp merged commit 2c79499 into eclipse-che:main May 3, 2023
@che-bot che-bot removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label May 3, 2023
nallikaea added a commit to nallikaea/che that referenced this pull request May 9, 2023
nallikaea added a commit to nallikaea/che that referenced this pull request Jun 6, 2023
@nallikaea nallikaea deleted the devconsole branch August 24, 2023 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target/branch Indicates that a PR will be merged into a branch other than master.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants