Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
import { checkErrors } from '../../support';
import { detailsPage } from '../../views/details-page';
import { guidedTour } from '../../views/guided-tour';

const MC_WITH_CONFIG_FILES = '00-master';
const MC_WITHOUT_CONFIG_FILES = '99-master-ssh';
const MC_DETAILS_PAGE_URL = '/k8s/cluster/machineconfiguration.openshift.io~v1~MachineConfig/';
const MC_SECTION_HEADING = 'Configuration files';
const MC_CONFIG_FILE_PATH_ID = 'config-file-path-0';
const MC_C2C = '.co-copy-to-clipboard__text';
const checkMachineConfigDetails = (mode, overwrite, content) => {
cy.byTestID(MC_CONFIG_FILE_PATH_ID).scrollIntoView();
cy.get('button[aria-label="Info"]').first().click();
cy.contains(mode).should('exist');
cy.contains(overwrite.toString()).should('exist');
cy.get('code')
.first()
.should(($code) => {
const text = $code.text();
expect(text).to.include(
decodeURIComponent(content)
.replace(/^(data:,)/, '')
.slice(0, 30),
);
});
};

describe('MachineConfig resource details page', () => {
before(() => {
cy.login();
guidedTour.close();
cy.initAdmin();
});

Expand All @@ -25,6 +43,20 @@ describe('MachineConfig resource details page', () => {
cy.byTestSectionHeading(MC_SECTION_HEADING).should('exist');
cy.byTestID(MC_CONFIG_FILE_PATH_ID).should('exist');
cy.get(MC_C2C).should('exist');
cy.exec(`oc get mc ${MC_WITH_CONFIG_FILES} -o jsonpath='{.spec.config.storage.files[0]}'`).then(
(result) => {
const mcContents = JSON.parse(result.stdout);
expect(mcContents).to.have.property('contents');
expect(mcContents).to.have.property('mode');
expect(mcContents).to.have.property('overwrite');
const {
contents: { source },
mode,
overwrite,
} = mcContents;
checkMachineConfigDetails(mode, overwrite, source);
},
);
});

it(`${MC_WITHOUT_CONFIG_FILES} does not display configuration files`, () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/components/machine-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const MachineConfigDetails: React.FCC<MachineConfigDetailsProps> = ({ obj }) =>
<Button
icon={<BlueInfoCircleIcon />}
variant={ButtonVariant.plain}
aria-label={'public~Info'}
aria-label={t('public~Info')}
className="pf-v6-u-ml-sm pf-v6-u-p-0"
/>
</Popover>
Expand Down
2 changes: 1 addition & 1 deletion frontend/public/locales/en/public.json
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@
"Properties": "Properties",
"Mode": "Mode",
"Overwrite": "Overwrite",
"Info": "Info",
"Generated by controller": "Generated by controller",
"Ignition version": "Ignition version",
"Unhealthy conditions": "Unhealthy conditions",
Expand Down Expand Up @@ -1746,7 +1747,6 @@
"prometheusBaseURL not set": "prometheusBaseURL not set",
"alertManagerBaseURL not set": "alertManagerBaseURL not set",
"Critical": "Critical",
"Info": "Info",
"Loading {{title}} status": "Loading {{title}} status",
"Waiting for the build": "Waiting for the build",
"graph timespan": "graph timespan",
Expand Down