Skip to content

Commit 1427c04

Browse files
committed
CONSOLE-4912: update machine config tests
1 parent b25299c commit 1427c04

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

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

Lines changed: 32 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="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, 30),
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,20 @@ 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+
expect(mcContents).to.have.property('contents');
50+
expect(mcContents).to.have.property('mode');
51+
expect(mcContents).to.have.property('overwrite');
52+
const {
53+
contents: { source },
54+
mode,
55+
overwrite,
56+
} = mcContents;
57+
checkMachineConfigDetails(mode, overwrite, source);
58+
},
59+
);
2860
});
2961

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

frontend/public/components/machine-config.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const MachineConfigDetails: React.FCC<MachineConfigDetailsProps> = ({ obj }) =>
101101
<Button
102102
icon={<BlueInfoCircleIcon />}
103103
variant={ButtonVariant.plain}
104-
aria-label={'public~Info'}
104+
aria-label={t('public~Info')}
105105
className="pf-v6-u-ml-sm pf-v6-u-p-0"
106106
/>
107107
</Popover>

frontend/public/locales/en/public.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@
730730
"Properties": "Properties",
731731
"Mode": "Mode",
732732
"Overwrite": "Overwrite",
733+
"Info": "Info",
733734
"Generated by controller": "Generated by controller",
734735
"Ignition version": "Ignition version",
735736
"Unhealthy conditions": "Unhealthy conditions",
@@ -1746,7 +1747,6 @@
17461747
"prometheusBaseURL not set": "prometheusBaseURL not set",
17471748
"alertManagerBaseURL not set": "alertManagerBaseURL not set",
17481749
"Critical": "Critical",
1749-
"Info": "Info",
17501750
"Loading {{title}} status": "Loading {{title}} status",
17511751
"Waiting for the build": "Waiting for the build",
17521752
"graph timespan": "graph timespan",

0 commit comments

Comments
 (0)