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

Add Cypress Rancher import Harvester test cases #907

Merged

Conversation

TachunLin
Copy link
Contributor

This the initial commit of Rancher import Harvester for Cypress automation test
For better review and update, split the original Cypress Rancher integration PR #502 into smaller part to proceed.

Test Cases

  1. Prepare Harvester Image
  2. Prepare Harvester VLAN network
  3. Rancher import Harvester
  4. Harvester import Rancher
  5. Check Harvester Cluster Statu

Purpose

Develop Cypress test for Harvester Rancher integration related test cases.
Plan to fulfill the requirement to automated basic regression and KDM release test.

Development Environment

The development based on the following SUT version and UI

  • Rancher version: v2.7.5
  • Harvester version: v1.2.0-rc4
  • Cypress version: 10.8

Prepare Test Environment

We can prepare the Rancher integration test environment in the following manner to provision Harvester with Rancher,

  1. Use vagrant ipxe-example pull request 45, set
  • harvester_network_config.offline: false
  • rancher_config.run_single_node_rancher: true
  • rancher_config.run_single_node_air_gapped_rancher: false
  1. Create separate VMs, one for Harvester and another for Rancher, make sure the network connectivity
  2. Install Harvester and Rancher on bare machines and ensure the connectivity

About Rancher First Time Login

Please be noted
In every test, while login Rancher, it will automatically check whether it's the first time login
The test function rancher.rancherLogin() support bootstrap login in the following scenarios.

  1. Use vagrant ipxe-example to prepare Harvester and Rancher and install sshpass on your local test runner environment
  2. You can also use regular VM or bare machine while you already setup the following
  • ssh root permission to Rancher host VM or bare machine
  • Install sshpass on your local test runner environment

If your environment did not fulfill above requirement, we would suggest you finishing the Rancher bootstrap on your own before running the rancher integration test

Cypress setup

  1. Execute npm install
  2. Execute npm ci
  3. Rename cypress.env.json.example to cypress.env.json file, update and add the following content
"username": "admin",
"password": "passwdpasswd",
"baseUrl": "https://192.168.122.149", 
"rancherUrl": "https://192.168.122.224",
"rancher_user": "admin",
"rancher_password": "passwdpasswd",
"rancher_vm_user": "vagrant",  
"rancher_vm_password": "vagrant",   
 "vagrant_pxe_path": "../ipxe-examples/vagrant-pxe-harvester",

Check test data

You can check and modify all related rancher integration test data in ../cypress/fixtures/rancher.json
The test data here is suitable for Rancher v2.6.7 along with the current KDM release version
Please be noted, on new KDM release, you may need to update these value accordingly.

    "rke2_latest": "1.24.4",
    "rke2_stable": "1.23.10",
    "k3s_latest": "1.24.4",
    "k3s_stable": "1.23.10", 
    "rke1_latest": "1.24.4",
    "rke1_stable": "1.23.10",

And also need to check the image and ssh user name to fulfill what you used in the Prepare Harvester Image and Prepare Harvester VLAN network test case, here I use focal-server and default vlan1

    "image": "focal-server",
    "network_name": "default/vlan1",
    "ssh_user": "ubuntu",

I use ubuntu 20.04 cloud focal by settings the image name and url in cypress.env.json

"image":
  {
    "name": "openSUSE-Leap-15.3-3-DVD-x86_64-Build38.1-Media.iso",
    "url": "https://download.opensuse.org/distribution/leap/15.3/iso/openSUSE-Leap-15.3-3-DVD-x86_64-Build38.1-Media.iso"
  }

Execute Test case

Execute npx cypress open or npx cypress run for the test

Test case list

  1. Prepare Harvester Image (On Harvester)
  2. Prepare Harvester VLAN network (On Harvester)
  3. Rancher import Harvester
  4. Harvester import Rancher (On Harvester)
  5. Check Harvester Cluster Status (On Rancher)

More test case will be added later on other PR

@TachunLin TachunLin marked this pull request as draft August 3, 2023 14:22
@TachunLin TachunLin force-pushed the rancher-integrate-harvester-cypress branch from 00c74a3 to 8eabf32 Compare August 3, 2023 14:45
@n313893254 n313893254 self-requested a review August 10, 2023 09:07
Copy link
Contributor

@n313893254 n313893254 left a comment

Choose a reason for hiding this comment

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

Minor fixes, Others LGTM

image

private home_page_mainMenu = '.menu';
private home_page_virtualManagement = ':nth-child(7) > .option > div';

private virtual_page_importButton = '.btn';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private virtual_page_importButton = '.btn';
private virtual_page_importButton = '.actions > .btn';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the check and reminder.
I have updated the page object entry and tested can pass the entire Harvester test suite.

1. Prepare Harvester Image
2. Prepare Harvester VLAN network
3. Rancher import Harvester
4. Harvester import Rancher
5. Check Harvester Cluster Status
1. Prepare Harvester Image
  - Set basic url
  - Save the setting
2. Check Harvester Cluster Status
  - use correct uri for virtual_page_importButton page oject item
@TachunLin TachunLin force-pushed the rancher-integrate-harvester-cypress branch from 8eabf32 to bf0a9e1 Compare August 11, 2023 10:58
@TachunLin
Copy link
Contributor Author

Verified can pass the following test cases on Rancher v2.7.6-rc2 with Harvester v1.1.2-rc5.
Thanks for the review.

image

Copy link
Contributor

@n313893254 n313893254 left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks!

@n313893254 n313893254 marked this pull request as ready for review August 14, 2023 02:36
@n313893254 n313893254 merged commit 67d13c4 into harvester:main Aug 14, 2023
2 checks passed
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.

2 participants