Skip to content

Commit

Permalink
Merge pull request #1264 from avivtur/fix-tests
Browse files Browse the repository at this point in the history
Update cypress tests
  • Loading branch information
openshift-merge-robot committed Apr 19, 2023
2 parents ed3dfcf + 143a4c3 commit 4291cd2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cypress/support/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Cypress.Commands.add('visitOverview', () => {

Cypress.Commands.add('visitCatalog', () => {
cy.clickVirtLink(catalogNav);
cy.contains('Create VirtualMachine from catalog').should('be.visible');
cy.contains('Create new VirtualMachine').should('be.visible');
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(1000);
});
Expand Down
10 changes: 5 additions & 5 deletions cypress/tests/catalog/filter.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import * as catalogView from '../../views/catalog';
describe('Test VM catalog filter', () => {
before(() => {
cy.login();
cy.visit('/k8s/ns/default/templatescatalog');
cy.visitCatalog();
});

it('ID(CNV-8464) Filter VM catalog by OS name', () => {
cy.get(catalogView.RHEL).find(catalogView.checkbox).check();
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.RHEL8.name);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.RHEL7.name);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.RHEL6.name);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.RHEL9.metadataName);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.RHEL8.metadataName);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.RHEL7.metadataName);
cy.get(catalogView.RHEL).find(catalogView.checkbox).uncheck();

cy.get(catalogView.WINDOWS).find(catalogView.checkbox).check();
Expand All @@ -22,7 +22,7 @@ describe('Test VM catalog filter', () => {
cy.get(catalogView.WINDOWS).find(catalogView.checkbox).uncheck();

cy.get(catalogView.FEDORA).find(catalogView.checkbox).check();
cy.get(catalogView.GRID).find('a').should('have.length', 1);
cy.get(catalogView.GRID).find('a').should('contain', TEMPLATE.FEDORA.metadataName);
cy.get(catalogView.FEDORA).find(catalogView.checkbox).uncheck();
});

Expand Down
12 changes: 6 additions & 6 deletions cypress/tests/check-tabs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import { vm } from '../views/vm';
describe('Check all virtualization pages can be loaded', () => {
before(() => {
cy.login();
cy.deleteResource(K8S_KIND.VM, 'vm-example', 'default');
cy.deleteResource(K8S_KIND.TEMPLATE, 'vm-template-example', 'default');
cy.deleteResource(K8S_KIND.VM, 'example', 'default');
cy.deleteResource(K8S_KIND.TEMPLATE, 'example', 'default');
});

after(() => {
cy.deleteResource(K8S_KIND.VM, 'vm-example', 'default');
cy.deleteResource(K8S_KIND.TEMPLATE, 'vm-template-example', 'default');
cy.deleteResource(K8S_KIND.VM, 'example', 'default');
cy.deleteResource(K8S_KIND.TEMPLATE, 'example', 'default');
});

describe('Check VM list and tabs', () => {
it('create vm-example', () => {
it('create example VM', () => {
cy.visitVMs();
vm.createVMFromYAML();
cy.contains('Hostname').should('be.visible');
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('Check all virtualization pages can be loaded', () => {
cy.contains('centos7-desktop-large').click();

cy.contains('Display name').should('be.visible');
cy.contains('Templates provided by KubeVirt are not editable').should('be.visible');
cy.byTestID('common-template-alert').should('be.visible');

tab.navigateToYAML();
cy.contains('Download').should('be.visible');
Expand Down
1 change: 1 addition & 0 deletions src/views/templates/details/CommonTemplateAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const CommonTemplateAlert: React.FC<CommonTemplateAlertProps> = ({ template }) =
title={t('Templates provided by {{providerName}} are not editable.', {
providerName,
})}
data-test="common-template-alert"
>
<Trans ns="plugin__kubevirt-plugin">
{{ osName }} VirtualMachine can not be edited because it is provided by OpenShift
Expand Down

0 comments on commit 4291cd2

Please sign in to comment.