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

Bug 1923081: Improve test for checking common templates #8001

Merged
merged 1 commit into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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