Skip to content

Commit

Permalink
Merge pull request #8001 from gouyang/common_template
Browse files Browse the repository at this point in the history
Bug 1923081: Improve test for checking common templates
  • Loading branch information
openshift-merge-robot committed Feb 2, 2021
2 parents b8554ee + 9754720 commit 9bcdef5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/* eslint-disable max-nested-callbacks */
import { isEqual } from 'lodash';
import { execSync } from 'child_process';
import { browser } from 'protractor';
import { appHost, testName } from '@console/internal-integration-tests/protractor.conf';
import { resourceTitle, isLoaded } from '@console/internal-integration-tests/views/crud.view';
import { browser, ExpectedConditions as until } from 'protractor';
import { testName } from '@console/internal-integration-tests/protractor.conf';
import { resourceTitle } from '@console/internal-integration-tests/views/crud.view';
import * as detailView from '../views/virtualMachine.view';
import * as templateView from '../views/template.view';
import {
removeLeakedResources,
withResource,
Expand Down Expand Up @@ -70,10 +71,23 @@ describe('Create VM from Template using wizard', () => {
);
}

it('ID(CNV=5655) [ui] verify os has default template with workload/flavor pre-define', async () => {
await browser.get(`${appHost}/k8s/ns/openshift/vmtemplates/rhel6-server-small`);
await isLoaded();
expect(detailView.defaultOS.getText()).toBe('template.kubevirt.io/default-os-variant');
it('ID(CNV-5655) Verify common template has workload/flavor pre-defined', async () => {
const vmTemplate = new VMTemplateBuilder(getBasicVMTBuilder())
.setName(TemplateByName.RHEL7)
.setProvisionSource(ProvisionSource.URL)
.build();

const vmtName = await vmTemplate.getResourceName();
const workload = vmtName.split('-')[1];
const flavor = vmtName.split('-')[2];

await browser.wait(until.presenceOf(templateView.defaultOSLabel));
expect(await (templateView.workload(`openshift-${vmtName}`) as any).getText()).toContain(
workload,
);
const detailFlavor = await (templateView.flavor(`openshift-${vmtName}`) as any).getText();
const flavorText = detailFlavor.toLowerCase();
expect(flavorText).toContain(flavor);
});

it('ID(CNV-1847) Displays correct data on VM Template Details page', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ export const vmtLinkByName = (vmtName: string) => element(by.linkText(vmtName));
export const detailViewDropdown = $('[data-test-id="actions-menu-button"]');
export const createVMButton = $('[data-test-action="Create Virtual Machine"]');
export const vmtTopLink = $('[data-test-id="breadcrumb-link-1"]');
export const defaultOSLabel = element(
by.cssContainingText('.co-m-label__key', 'template.kubevirt.io/default-os-variant'),
);
export const workload = (prefix: string) => $(`#${prefix}-workload-profile`);
export const flavor = (prefix: string) => $(`#${prefix}-flavor`);
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ export const consoleNetworkInterfaceDropdownId = '#nic-dropdown';
const manualConnectionValues = $$('.manual-connection-pf-value');
export const rdpIpAddress = manualConnectionValues.first();
export const rdpPort = manualConnectionValues.last();
// Templates view
export const defaultOS = element(
by.xpath('//*[contains(text(),"template.kubevirt.io/default-os-variant")]'),
);

// VM detail view
export const vmDetailItemId = (namespace, vmName, itemName) =>
Expand Down

0 comments on commit 9bcdef5

Please sign in to comment.