Skip to content

Conversation

asirvadAbrahamVarghese
Copy link
Contributor

@asirvadAbrahamVarghese asirvadAbrahamVarghese commented Sep 16, 2025

CP4AIOPS-18919:
Validates add, edit, refresh & delete actions on all the 11 cloud provider forms:

  • VMware vCloud
  • Azure Stack
  • IBM Cloud VPC
  • BM Power Systems Virtual Servers
  • Google Compute Engine
  • Oracle Cloud
  • Azure
  • Amazon EC2
  • IBM PowerVC
  • IBM Cloud Infrastructure Center
  • OpenStack

@miq-bot assign @jrafanie
@miq-bot add-label cypress
@miq-bot add-label test
@miq-bot add-label wip

@asirvadAbrahamVarghese
Copy link
Contributor Author

asirvadAbrahamVarghese commented Sep 16, 2025

Issues to be fixed:

- When provider type is Azure Stack, adding data would throw an internal server error, but the record is still added
image
image

- Once a refresh is done, even if a provider is selected all config options except Add remains disabled:
image
image

@asirvadAbrahamVarghese asirvadAbrahamVarghese force-pushed the cloud-provider-form-automation-testing branch 5 times, most recently from 73928e3 to 4e01348 Compare September 22, 2025 05:37
@asirvadAbrahamVarghese
Copy link
Contributor Author

asirvadAbrahamVarghese commented Sep 22, 2025

TODO:

  • Integrate interceptApi once Enhance intercept api command #9623 is merged
  • Use direct APIs for data cleanup
  • Even though name and host are unique per test, if a test fails after data is created, the afterEach hook will attempt to delete the record. However, if the deletion task is still queued in the queue_worker, a retry may fail with a duplicate name or host error - not seen such a failure so far, just considering it as a potential edge case so, further refactoring is necessary to include a timestamp in provider name and host to maintain uniqueness.

@Fryguy
Copy link
Member

Fryguy commented Sep 22, 2025

This is really nice! I'd be happy to merge as is, but I want us to consider pluggability with this. If possible it would be nice it plugins could bring their own cypress tests. cc @agrare Would like your thoughts here as well.

@agrare
Copy link
Member

agrare commented Sep 22, 2025

Completely naive to cypress observation, but is there any way to split this up into smaller components? I don't know where to start reviewing almost 5k lines in one file.

Also +1 on merging as is and improving as we go though

@asirvadAbrahamVarghese
Copy link
Contributor Author

asirvadAbrahamVarghese commented Sep 24, 2025

but is there any way to split this up into smaller components?

Do you think we should do this to break the tests out?

Compute

Clouds

Providers

CloudProvider

vmware_vcloud.cy.js
azure.cy.js
azure_stack.cy.js
openstack.cy.js
.......

@jrafanie
Copy link
Member

but is there any way to split this up into smaller components?

Do you think we should do this to break the tests out?

Compute

Clouds

Providers

CloudProvider

vmware_vcloud.cy.js
azure.cy.js
azure_stack.cy.js
openstack.cy.js
.......

How much shared code would they have? How difficult would it be to create a shared helper that each test could import? I think that can be done in a followup if necessary. @asirvadAbrahamVarghese let us know if you think it would be easier to do this now or later.

TODO:

  • Integrate interceptApi once Enhance intercept api command #9623 is merged
  • Use direct APIs for data cleanup
  • Even though name and host are unique per test, if a test fails after data is created, the afterEach hook will attempt to delete the record. However, if the deletion task is still queued in the queue_worker, a retry may fail with a duplicate name or host error - not seen such a failure so far, just considering it as a potential edge case so, further refactoring is necessary to include a timestamp in provider name and host to maintain uniqueness.

I think these can be done after this PR is in.

});

// Validate elements
validateVmwareVcloudFormFields(true);
Copy link
Member

Choose a reason for hiding this comment

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

So, I can't review this whole thing because it's huge but I think creating shared helper functions could help eliminate some duplication and dry up some of the extra code here. For example, this function is defined in each of the cloud provider vendor types. A shared function should be the next step.

Maybe let's get this in and then refactor it into shared functions. If we're still at several hundreds of lines, maybe we need to split out the tests per vendor.

@asirvadAbrahamVarghese asirvadAbrahamVarghese force-pushed the cloud-provider-form-automation-testing branch from 4e01348 to af85e37 Compare October 3, 2025 06:03
@asirvadAbrahamVarghese
Copy link
Contributor Author

I'd be happy to merge as is

Also +1 on merging as is and improving as we go though

let us know if you think it would be easier to do this now or later.

Just working on cleaning this up to reuse a bunch of stuff. Better to wait for that to land and see how it looks, if I come back to it later, I’ll likely lose track...

@asirvadAbrahamVarghese asirvadAbrahamVarghese force-pushed the cloud-provider-form-automation-testing branch from af85e37 to 6f3edd0 Compare October 7, 2025 07:17
* Generates all test suites for a provider
* @param {Object} providerConfig - The provider configuration object
*/
export function generateProviderTests(providerConfig) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To maintain the current test setup, this isn’t defined as a Cypress command because it’s executed directly in the top-level describe block, rather than inside a test (it) block. Cypress commands must be used within it blocks

Copy link
Member

Choose a reason for hiding this comment

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

Ah... that makes sense. We have a similar limitation with defining methods in our rspec tests. If you try to define it at the wrong test scope, it doesn't work.

@asirvadAbrahamVarghese asirvadAbrahamVarghese force-pushed the cloud-provider-form-automation-testing branch from 6f3edd0 to 896538b Compare October 7, 2025 11:48
@asirvadAbrahamVarghese asirvadAbrahamVarghese force-pushed the cloud-provider-form-automation-testing branch from 896538b to 4d6cbf6 Compare October 7, 2025 12:39
* @param {boolean} assertDeleteFlashMessage - Whether to assert the delete flash message
*/
Cypress.Commands.add(
'selectProviderAndDeleteWithOptionalFlashMessage',
Copy link
Member

Choose a reason for hiding this comment

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

I'm looking forward to replacing all of this deletion code with:

  afterEach(() => {
    cy.appDbState('restore');
  });

from: #9633

For now, this is good... I need a reference that works first. It will be good to not have to worry about cleanup as it distracts from the test.

const uniqueId = generateUniqueIdentifier();
nameFieldValue = `${providerConfig.nameValue} - verify-edit-form-validation-error - ${uniqueId}`;
hostValue = `${slugifyWith(providerConfig.type, '-')}-${uniqueId}.com`;
if (isAzureStack) {
Copy link
Member

Choose a reason for hiding this comment

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

I can't believe you figured out all of the different pages that needed these conditionals for all the providers. Nice job. These conditionals could hopefully go away if we can standardize the pages.

@jrafanie
Copy link
Member

jrafanie commented Oct 9, 2025

@Fryguy @agrare what are you thoughts on this? I think it's a good start. I like that they have the same generic base tests with a lot of conditionals branching the places where they differ. It makes it easier to see where all of these pages are different.

@agrare
Copy link
Member

agrare commented Oct 14, 2025

Yeah still good with merging this as is and improving as we go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants