Skip to content

Commit

Permalink
ci/ui: add os_version.spec.ts test
Browse files Browse the repository at this point in the history
* to test the In sync column
  • Loading branch information
juadk committed Aug 9, 2024
1 parent 31c322a commit 849fe27
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/sub_ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ jobs:
/workdir/e2e/unit_tests/elemental_plugin.spec.ts
/workdir/e2e/unit_tests/user.spec.ts
/workdir/e2e/unit_tests/menu.spec.ts
/workdir/e2e/unit_tests/os_version.spec.ts
/workdir/e2e/unit_tests/machine_registration.spec.ts
/workdir/e2e/unit_tests/advanced_filtering.spec.ts
UI_ACCOUNT: ${{ inputs.ui_account }}
Expand Down
75 changes: 75 additions & 0 deletions tests/cypress/latest/e2e/unit_tests/os_version.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
Copyright © 2022 - 2024 SUSE LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import '~/support/commands';
import filterTests from '~/support/filterTests.js';
import * as cypressLib from '@rancher-ecp-qa/cypress-library';
import { slowCypressDown } from 'cypress-slow-down'

// slow down each command by 500ms
slowCypressDown(500)

filterTests(['main'], () => {
Cypress.config();
describe('OS versions testing', () => {
const elementalUser = "elemental-user"
const uiAccount = Cypress.env('ui_account');
const uiPassword = "rancherpassword"

beforeEach(() => {
(uiAccount == "user") ? cy.login(elementalUser, uiPassword) : cy.login();
cy.visit('/');
cypressLib.burgerMenuToggle();
cypressLib.accesMenu('OS Management');
});

it('Check In Sync column status', () => {
cy.clickNavMenu(["Advanced", "OS Versions"]);
cy.getBySel('cluster-list-container')
.should('not.contain', 'Unavailable');
cy.getBySel('cluster-list-container')
.contains('Type')
.click();
cy.getBySel('sortable-table-0-action-button')
.click();
cy.contains('Edit YAML')
.click();
cy.contains('annotations').as('anno')
cy.get('@anno').click(0,0)
cy.get('@anno').type('{end}{enter} elemental.cattle.io/channel-no-longer-in-sync: \'true\'');
cy.getBySel('action-button-async-button')
.contains('Save')
.click();
cy.getBySel('cluster-list-container')
.contains('Type')
.click();
cy.getBySel('sortable-cell-0-4')
.should('contain', 'Out of sync');
});

it('Out of sync OS version should appear deprecated', () => {
cy.createMachReg('sample-machine-reg');
cy.contains('sample-machine-reg')
.click();
cy.getBySel('select-media-type-build-media')
.click();
cy.contains('Raw')
.click();
cy.getBySel('select-os-version-build-media')
.click();
cy.contains(new RegExp('OS.*deprecated'))
});

});
});
1 change: 1 addition & 0 deletions tests/cypress/latest/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Cypress.Commands.add('createMachReg', (

// Check Cloud configuration
// TODO: Maybe the check may be improved in one line
// Should be removed once 1.6 released (only keep what is in the if)
if (checkDefaultCloudConfig) {
if (utils.isUIVersion('dev')) {
cy.getBySel('yaml-editor-code-mirror')
Expand Down

0 comments on commit 849fe27

Please sign in to comment.