Skip to content

Commit

Permalink
modified: pkg/qe-tests/cypress/integration/models/providerRhv.ts (ku…
Browse files Browse the repository at this point in the history
…bev2v#932)

modified:   pkg/qe-tests/cypress/integration/models/providerVmware.ts
	modified:   pkg/qe-tests/cypress/integration/tests/Rhv/config_separate_mapping_rhv.ts
	new file:   pkg/qe-tests/cypress/integration/tests/Rhv/editProvider.ts
	modified:   pkg/qe-tests/cypress/integration/tests/vmware/config_separate_mapping.ts
	new file:   pkg/qe-tests/cypress/integration/tests/vmware/editProvider.ts
	modified:   pkg/qe-tests/cypress/integration/types/types.ts

	modified:   pkg/qe-tests/cypress/integration/models/providerRhv.ts
	modified:   pkg/qe-tests/cypress/integration/models/providerVmware.ts
	modified:   pkg/qe-tests/cypress/integration/tests/Rhv/config_separate_mapping_rhv.ts
	new file:   pkg/qe-tests/cypress/integration/tests/Rhv/editProvider.ts
	modified:   pkg/qe-tests/cypress/integration/tests/vmware/config_separate_mapping.ts
	new file:   pkg/qe-tests/cypress/integration/tests/vmware/editProvider.ts
	modified:   pkg/qe-tests/cypress/integration/types/types.ts

	modified:   pkg/qe-tests/cypress/integration/models/providerRhv.ts
	modified:   pkg/qe-tests/cypress/integration/models/providerVmware.ts
	modified:   pkg/qe-tests/cypress/integration/tests/Rhv/config_separate_mapping_rhv.ts
	new file:   pkg/qe-tests/cypress/integration/tests/Rhv/editProvider.ts
	modified:   pkg/qe-tests/cypress/integration/tests/vmware/config_separate_mapping.ts
	new file:   pkg/qe-tests/cypress/integration/tests/vmware/editProvider.ts
	modified:   pkg/qe-tests/cypress/integration/types/types.ts

Co-authored-by: Igor Braginsky <ibragins@redhat.com>
  • Loading branch information
kpunwatk and ibragins committed Mar 23, 2022
1 parent 7ed0a74 commit 317d1ca
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 44 deletions.
55 changes: 40 additions & 15 deletions pkg/qe-tests/cypress/integration/models/providerRhv.ts
Expand Up @@ -11,7 +11,16 @@ import {
dataLabel,
} from '../views/providerRhv.view';
import { providerMenu } from '../views/provider.view';
import { removeButton, rhv, SEC, button, trTag } from '../types/constants';
import {
removeButton,
rhv,
SEC,
button,
trTag,
editButton,
saveButton,
incorrectRhvHostname,
} from '../types/constants';

export class providerRhv extends Provider {
protected fillName(name: string): void {
Expand Down Expand Up @@ -45,20 +54,24 @@ export class providerRhv extends Provider {
cy.contains(name)
.parent(trTag)
.within(() => {
// Validating that provider is in `Ready` state
cy.get(dataLabel.status, { timeout: 600 * SEC }).should('have.text', 'Ready');
// Validating that endpoint is in proper format and contains proper URL
cy.get(dataLabel.endpoint).should('contain.text', `https://${hostname}/ovirt-engine/api`);
// Validating that amount of clusters is not empty and is not 0
cy.get(dataLabel.clusters).should('not.be.empty').should('not.contain.text', '0');
// Validating that amount of hosts is not empty and is not 0
cy.get(dataLabel.hosts).should('not.be.empty').should('not.contain.text', '0');
// Validating that amount of VMs is not empty and is not 0
cy.get(dataLabel.vms).should('not.be.empty');
// Validating that amount of networks is not empty and is not 0
cy.get(dataLabel.networks).should('not.be.empty').should('not.contain.text', '0');
// Validating that amount of storageDomains is not empty and is not 0
cy.get(dataLabel.storageDomains).should('not.be.empty').should('not.contain.text', '0');
if (hostname == incorrectRhvHostname) {
cy.get(dataLabel.status, { timeout: 600 * SEC }).should('have.text', 'Critical');
} else {
// Validating that provider is in `Ready` state
cy.get(dataLabel.status, { timeout: 600 * SEC }).should('have.text', 'Ready');
// Validating that endpoint is in proper format and contains proper URL
cy.get(dataLabel.endpoint).should('contain.text', `https://${hostname}/ovirt-engine/api`);
// Validating that amount of clusters is not empty and is not 0
cy.get(dataLabel.clusters).should('not.be.empty').should('not.contain.text', '0');
// Validating that amount of hosts is not empty and is not 0
cy.get(dataLabel.hosts).should('not.be.empty').should('not.contain.text', '0');
// Validating that amount of VMs is not empty and is not 0
cy.get(dataLabel.vms).should('not.be.empty');
// Validating that amount of networks is not empty and is not 0
cy.get(dataLabel.networks).should('not.be.empty').should('not.contain.text', '0');
// Validating that amount of storageDomains is not empty and is not 0
cy.get(dataLabel.storageDomains).should('not.be.empty').should('not.contain.text', '0');
}
});
}
protected runWizard(providerData: RhvProviderData): void {
Expand All @@ -72,6 +85,18 @@ export class providerRhv extends Provider {
click(addButtonModal);
cy.wait(2 * SEC);
}
//Edit method RHV
edit(providerData: RhvProviderData): void {
const { name, hostname, username, password, cert } = providerData;
providerRhv.openList();
applyAction(name, editButton);
this.fillHostname(hostname);
this.fillUsername(username);
this.fillPassword(password);
this.fillCaCert(cert);
clickByText(addButtonModal, saveButton);
this.populate(providerData);
}

create(providerData: RhvProviderData): void {
const { name, hostname, username, password, cert } = providerData;
Expand Down
53 changes: 29 additions & 24 deletions pkg/qe-tests/cypress/integration/models/providerVmware.ts
Expand Up @@ -16,6 +16,7 @@ import {
vmware,
button,
tdTag,
incorrectVmwareHostname,
} from '../types/constants';
import {
addButtonModal,
Expand Down Expand Up @@ -113,30 +114,34 @@ export class ProviderVmware extends Provider {
.parent(trTag)
.within(() => {
// Validating that provider is in `Ready` state
cy.get(dataLabel.status, { timeout: 600 * SEC }).should('have.text', 'Ready');
// Validating that endpoint is in proper format and contains proper URL
cy.get(dataLabel.endpoint, { timeout: 10 * SEC }).should(
'contain.text',
`https://${hostname}/sdk`
);
// Validating that amount of clusters is not empty and is not 0
cy.get(dataLabel.clusters, { timeout: 10 * SEC })
.should('not.be.empty')
.should('not.contain.text', '0');
// Validating that amount of hosts is not empty and is not 0
cy.get(dataLabel.hosts, { timeout: 10 * SEC })
.should('not.be.empty')
.should('not.contain.text', '0');
// Validating that amount of VMs is not empty and is not 0
cy.get(dataLabel.vms, { timeout: 10 * SEC }).should('not.be.empty');
// Validating that amount of networks is not empty and is not 0
cy.get(dataLabel.networks, { timeout: 10 * SEC })
.should('not.be.empty')
.should('not.contain.text', '0');
// Validating that amount of datastores is not empty and is not 0
cy.get(dataLabel.datastores, { timeout: 10 * SEC })
.should('not.be.empty')
.should('not.contain.text', '0');
if (hostname == incorrectVmwareHostname) {
cy.get(dataLabel.status, { timeout: 600 * SEC }).should('have.text', 'Critical');
} else {
cy.get(dataLabel.status, { timeout: 600 * SEC }).should('have.text', 'Ready');
// Validating that endpoint is in proper format and contains proper URL
cy.get(dataLabel.endpoint, { timeout: 30 * SEC }).should(
'contain.text',
`https://${hostname}/sdk`
);
// Validating that amount of clusters is not empty and is not 0
cy.get(dataLabel.clusters, { timeout: 30 * SEC })
.should('not.be.empty')
.should('not.contain.text', '0');
// Validating that amount of hosts is not empty and is not 0
cy.get(dataLabel.hosts, { timeout: 30 * SEC })
.should('not.be.empty')
.should('not.contain.text', '0');
// Validating that amount of VMs is not empty and is not 0
cy.get(dataLabel.vms, { timeout: 30 * SEC }).should('not.be.empty');
// Validating that amount of networks is not empty and is not 0
cy.get(dataLabel.networks, { timeout: 30 * SEC })
.should('not.be.empty')
.should('not.contain.text', '0');
// Validating that amount of datastores is not empty and is not 0
cy.get(dataLabel.datastores, { timeout: 30 * SEC })
.should('not.be.empty')
.should('not.contain.text', '0');
}
});
}

Expand Down
Expand Up @@ -7,7 +7,7 @@ import {
RhvProviderData,
HookData,
} from '../../types/types';
import { providerType, storageType } from '../../types/constants';
import { incorrectRhvHostname, providerType, storageType } from '../../types/constants';
const url = Cypress.env('url');
const user_login = 'kubeadmin';
const user_password = Cypress.env('pass');
Expand All @@ -34,6 +34,15 @@ export const providerData: RhvProviderData = {
password: v2v_rhv_password,
cert: v2v_rhv_cert,
};
// edit rhv provider data
export const incorrectProviderData: RhvProviderData = {
type: providerType.rhv,
name: v2v_rhv_providername,
hostname: incorrectRhvHostname,
username: 'mtv@duplicate',
password: 'mtv@123!',
cert: v2v_rhv_cert,
};
export const networkMappingPeer: MappingPeer[] = [
{
sProvider: 'ovirtmgmt',
Expand Down
25 changes: 25 additions & 0 deletions pkg/qe-tests/cypress/integration/tests/Rhv/editProvider.ts
@@ -0,0 +1,25 @@
import { incorrectProviderData, testData } from './config_separate_mapping_rhv';
import { login } from '../../../utils/utils';
import { providerRhv } from '../../models/providerRhv';
import { RhvProviderData } from '../../types/types';

describe('Creating CRUD operation', () => {
const provider = new providerRhv();
const providerData: RhvProviderData = testData.planData.providerData;

beforeEach(() => {
login(testData.loginData);
});

it('Create a RHV Provider and Edit existing provider', () => {
provider.create(incorrectProviderData);
});

it('Create a RHV Provider and Edit existing provider', () => {
provider.edit(providerData);
});

it('Login to MTV, find and delete provider', () => {
provider.delete(providerData);
});
});
Expand Up @@ -8,7 +8,7 @@ import {
HookData,
esxiHostList,
} from '../../types/types';
import { providerType, storageType } from '../../types/constants';
import { incorrectVmwareHostname, providerType, storageType } from '../../types/constants';
const url = Cypress.env('url');
const user_login = 'kubeadmin';
const user_password = Cypress.env('pass');
Expand Down Expand Up @@ -49,6 +49,15 @@ export const providerData: VmwareProviderData = {
image: v2v_vmware_vddkImage,
esxiHostList: hostList,
};
// edit vmware provider data
export const incorrectProviderData: VmwareProviderData = {
type: providerType.vmware,
name: v2v_vmware_providername,
hostname: incorrectVmwareHostname,
username: 'mtv@duplicate.local',
password: 'mtv@123!',
image: v2v_vmware_vddkImage,
};

export const networkMappingPeer: MappingPeer[] = [
{
Expand Down
24 changes: 24 additions & 0 deletions pkg/qe-tests/cypress/integration/tests/vmware/editProvider.ts
@@ -0,0 +1,24 @@
import { incorrectProviderData, testData } from './config_separate_mapping';
import { login } from '../../../utils/utils';
import { ProviderVmware } from '../../models/providerVmware';
import { VmwareProviderData } from '../../types/types';

describe('Creating CRUD operation', () => {
const provider = new ProviderVmware();
const providerData: VmwareProviderData = testData.planData.providerData;

beforeEach(() => {
login(testData.loginData);
});
it('Create a vmware provider with incorrect credentials', () => {
provider.create(incorrectProviderData);
});

it('Edit the existing provider and validate', () => {
provider.edit(providerData);
});

it('Login to MTV, find and delete provider', () => {
provider.delete(providerData);
});
});
3 changes: 3 additions & 0 deletions pkg/qe-tests/cypress/integration/types/constants.ts
Expand Up @@ -44,6 +44,9 @@ export const downloadLogsButton = 'Download logs';
export const selectMigrationNetwork = 'Select migration network';
export const podNetwork = 'Pod network';
export const differentNetwork = 'Select a different network';
export const incorrectVmwareHostname = '10.8.58.136';
export const incorrectRhvHostname = 'rhev-green-03.rdu2.scalelab.redhat.com';

export enum hooks {
image = 'Custom container image',
ansiblePlaybook = 'Ansible Playbook',
Expand Down
6 changes: 3 additions & 3 deletions pkg/qe-tests/cypress/integration/types/types.ts
Expand Up @@ -24,7 +24,7 @@ export type esxiHostList = {

export type VmwareProviderData = {
type: string;
name: string;
name?: string;
hostname?: string;
username?: string;
password?: string;
Expand All @@ -34,7 +34,7 @@ export type VmwareProviderData = {

export type RhvProviderData = {
type: string;
name: string;
name?: string;
hostname?: string;
username?: string;
password?: string;
Expand All @@ -43,7 +43,7 @@ export type RhvProviderData = {

export type OcpVirtData = {
type: string;
name: string;
name?: string;
url?: string;
saToken?: string;
migrationNetwork?: string;
Expand Down

0 comments on commit 317d1ca

Please sign in to comment.