Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cypress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ ManageIQ implements the following cypress extensions:
* `cy.validateFormFields(fieldConfigs)` - validates form input fields based on provided configurations. `fieldConfigs` is an array of field configuration objects with properties: `id` (required) - the ID of the form field, `fieldType` (optional, default: 'input') - the type of field ('input', 'select', 'textarea'), `inputFieldType` (optional, default: 'text') - the type of input field ('text', 'password', 'number'), `shouldBeDisabled` (optional, default: false) - whether the field should be disabled, `expectedValue` (optional) - the expected value of the field. e.g. `cy.validateFormFields([{ id: 'name', shouldBeDisabled: true }, { id: 'role', fieldType: 'select', expectedValue: 'admin' }]);` or using constants: `cy.validateFormFields([{ [FIELD_CONFIG_KEYS.ID]: 'email', [FIELD_CONFIG_KEYS.INPUT_FIELD_TYPE]: 'email' }, { [FIELD_CONFIG_KEYS.ID]: 'name', [FIELD_CONFIG_KEYS.SHOULD_BE_DISABLED]: true }]);`
* `cy.validateFormButtons(buttonConfigs)` - validates form buttons based on provided configurations. `buttonConfigs` is an array of button configuration objects with properties: `buttonText` (required) - the text of the button, `buttonType` (optional, default: 'button') - the type of button (e.g., 'submit', 'reset'), `shouldBeDisabled` (optional, default: false) - whether the button should be disabled. e.g. `cy.validateFormButtons([{ buttonText: 'Cancel' }, { buttonText: 'Submit', buttonType: 'submit', shouldBeDisabled: true }]);` or using constants: `cy.validateFormButtons([{ [BUTTON_CONFIG_KEYS.TEXT]: 'Cancel', [BUTTON_CONFIG_KEYS.BUTTON_WRAPPER_CLASS]: 'custom-button-wrapper' }]);`

##### provider_helper_commands

* `cy.fillProviderForm(providerConfig, nameValue, hostValue)` - fills a provider form based on provider configuration. `providerConfig` is the provider configuration object. `nameValue` is the name to use for the provider. `hostValue` is the hostname to use for the provider.
* `cy.validateProviderFormFields(providerConfig, isEdit)` - validates a provider form based on provider configuration. `providerConfig` is the provider configuration object. `isEdit` is whether the form is in edit mode.
* `cy.interceptAddProviderApi()` - This command intercepts the POST request to '/api/providers' that occurs when adding a provider. For Azure Stack providers, it allows the request to reach the server (so data is created) and forces a successful response.
* `cy.providerValidation({ stubErrorResponse, errorMessage })` - performs validation with optional error response stubbing. `stubErrorResponse` is whether to stub an error response. `errorMessage` is the error message to show.
* `generateProviderTests(providerConfig)` - generates all test suites for a provider. `providerConfig` is the provider configuration object.

#### Assertions

* `cy.expect_explorer_title(title)` - check that the title on an explorer screen matches the provided title. `title`: String for the title.
Expand Down
57 changes: 57 additions & 0 deletions cypress/e2e/ui/Compute/Clouds/Providers/cloud_provider.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/* eslint-disable no-undef */
import { generateProviderTests } from '../../../../../support/commands/provider_helper_commands';
import { getProviderConfig, PROVIDER_TYPES } from './provider-factory';

describe('Automate Cloud Provider form operations: Compute > Clouds > Providers > Configuration > Add a New Cloud Provider', () => {
beforeEach(() => {
cy.login();
cy.menu('Compute', 'Clouds', 'Providers');
cy.toolbar('Configuration', 'Add a New Cloud Provider');
});

// Generate tests for VMware vCloud provider
const vmwareVcloudConfig = getProviderConfig(PROVIDER_TYPES.VMWARE_VCLOUD);
generateProviderTests(vmwareVcloudConfig);

// Generate tests for Amazon EC2 provider
const amazonEC2Config = getProviderConfig(PROVIDER_TYPES.AMAZON_EC2);
generateProviderTests(amazonEC2Config);

// Generate tests for Azure provider
const azureConfig = getProviderConfig(PROVIDER_TYPES.AZURE);
generateProviderTests(azureConfig);

// Generate tests for Azure Stack provider (requires special handling)
const azureStackConfig = getProviderConfig(PROVIDER_TYPES.AZURE_STACK);
generateProviderTests(azureStackConfig);

// Generate tests for Google Compute Engine provider
const googleComputeConfig = getProviderConfig(PROVIDER_TYPES.GOOGLE_COMPUTE);
generateProviderTests(googleComputeConfig);

// Generate tests for IBM Cloud VPC provider
const ibmCloudVpcConfig = getProviderConfig(PROVIDER_TYPES.IBM_CLOUD_VPC);
generateProviderTests(ibmCloudVpcConfig);

// Generate tests for IBM Power Systems Virtual Servers provider
const ibmPowerSystemsConfig = getProviderConfig(
PROVIDER_TYPES.IBM_POWER_SYSTEMS
);
generateProviderTests(ibmPowerSystemsConfig);

// Generate tests for IBM PowerVC provider
const ibmPowerVcConfig = getProviderConfig(PROVIDER_TYPES.IBM_POWERVC);
generateProviderTests(ibmPowerVcConfig);

// Generate tests for IBM Cloud Infrastructure Center provider
const ibmCicConfig = getProviderConfig(PROVIDER_TYPES.IBM_CIC);
generateProviderTests(ibmCicConfig);

// Generate tests for Oracle Cloud provider
const oracleCloudConfig = getProviderConfig(PROVIDER_TYPES.ORACLE_CLOUD);
generateProviderTests(oracleCloudConfig);

// Generate tests for OpenStack provider
const openstackConfig = getProviderConfig(PROVIDER_TYPES.OPENSTACK);
generateProviderTests(openstackConfig);
});
Loading