Skip to content

Commit 681df50

Browse files
committed
CONSOLE-4912: update machine config tests
1 parent 409d0c4 commit 681df50

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

frontend/packages/integration-tests-cypress/tests/app/machine-config.cy.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
11
import { checkErrors } from '../../support';
22
import { detailsPage } from '../../views/details-page';
3+
import { guidedTour } from '../../views/guided-tour';
34

45
const MC_WITH_CONFIG_FILES = '00-master';
56
const MC_WITHOUT_CONFIG_FILES = '99-master-ssh';
67
const MC_DETAILS_PAGE_URL = '/k8s/cluster/machineconfiguration.openshift.io~v1~MachineConfig/';
78
const MC_SECTION_HEADING = 'Configuration files';
89
const MC_CONFIG_FILE_PATH_ID = 'config-file-path-0';
910
const MC_C2C = '.co-copy-to-clipboard__text';
11+
const checkMachineConfigDetails = (mode, overwrite, content) => {
12+
cy.byTestID(MC_CONFIG_FILE_PATH_ID).scrollIntoView();
13+
cy.get('button[aria-label="public~Info"]').first().click();
14+
cy.contains(mode).should('exist');
15+
cy.contains(overwrite.toString()).should('exist');
16+
cy.get('code')
17+
.first()
18+
.should(($code) => {
19+
const text = $code.text();
20+
expect(text).to.include(
21+
decodeURIComponent(content)
22+
.replace(/^(data:,)/, '')
23+
.slice(0, 5),
24+
);
25+
});
26+
};
1027

1128
describe('MachineConfig resource details page', () => {
1229
before(() => {
1330
cy.login();
31+
guidedTour.close();
1432
cy.initAdmin();
1533
});
1634

@@ -25,6 +43,17 @@ describe('MachineConfig resource details page', () => {
2543
cy.byTestSectionHeading(MC_SECTION_HEADING).should('exist');
2644
cy.byTestID(MC_CONFIG_FILE_PATH_ID).should('exist');
2745
cy.get(MC_C2C).should('exist');
46+
cy.exec(`oc get mc ${MC_WITH_CONFIG_FILES} -o jsonpath='{.spec.config.storage.files[0]}'`).then(
47+
(result) => {
48+
const mcContents = JSON.parse(result.stdout);
49+
const {
50+
contents: { source },
51+
mode,
52+
overwrite,
53+
} = mcContents;
54+
checkMachineConfigDetails(mode, overwrite, source);
55+
},
56+
);
2857
});
2958

3059
it(`${MC_WITHOUT_CONFIG_FILES} does not display configuration files`, () => {

0 commit comments

Comments
 (0)