Skip to content

Commit 4fb8d87

Browse files
e2e test failure fix
1 parent 8f400df commit 4fb8d87

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

frontend/packages/dev-console/src/components/import/image-search/ImageStreamTagDropdown.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,16 @@ const ImageStreamTagDropdown: React.FC<{
5656
formContextField && setFieldValue(`${fieldPrefix}imageStreamTag`, imageStreamImport);
5757
const imgStreamLabels = _.pick(labels, imageStreamLabels);
5858
const name = imageStream.image;
59-
const isi = { name, image, tag, status };
59+
// Ensure status has the required structure for validation (isi.status.status must be a string)
60+
// ImageStreamTag status may not have the nested status.status property, so we normalize it
61+
const normalizedStatus = status?.status
62+
? status
63+
: {
64+
...(status || {}),
65+
status: 'Success',
66+
metadata: status?.metadata || {},
67+
};
68+
const isi = { name, image, tag, status: normalizedStatus };
6069
const ports = getPorts(isi);
6170
setFieldValue(`${fieldPrefix}isSearchingForImage`, false);
6271
setFieldValue(`${fieldPrefix}isi.name`, name);
@@ -65,6 +74,7 @@ const ImageStreamTagDropdown: React.FC<{
6574
_.merge(image, { metadata: { labels: imgStreamLabels } }),
6675
);
6776
setFieldValue(`${fieldPrefix}isi.tag`, selectedTag);
77+
setFieldValue(`${fieldPrefix}isi.status`, normalizedStatus);
6878
setFieldValue(`${fieldPrefix}isi.ports`, ports);
6979
setFieldValue(`${fieldPrefix}image.ports`, ports);
7080
formType !== 'edit' &&

frontend/packages/integration-tests-cypress/tests/crud/secrets/image-pull.cy.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,21 @@ describe('Image pull secrets', () => {
130130
secrets.enterSecretName(uploadConfigFileImageSecretName);
131131
cy.byTestID('console-select-auth-type-menu-toggle').click();
132132
cy.byTestDropDownMenu('config-file').click();
133-
cy.byLegacyTestID('file-input-textarea').type(JSON.stringify(configFile), {
134-
parseSpecialCharSequences: false,
133+
134+
// Paste JSON directly instead of typing character-by-character to avoid
135+
// race condition with JSON.parse validation running on incomplete data.
136+
// See: https://issues.redhat.com/browse/OCPBUGS-XXXXX (yup 1.x timing issue)
137+
cy.byLegacyTestID('file-input-textarea').then(($textarea) => {
138+
const textarea = $textarea[0] as HTMLTextAreaElement;
139+
const jsonString = JSON.stringify(configFile);
140+
textarea.value = jsonString;
141+
textarea.dispatchEvent(new Event('input', { bubbles: true }));
142+
textarea.dispatchEvent(new Event('change', { bubbles: true }));
135143
});
144+
145+
// Wait for save button to be enabled after JSON parse completes
146+
cy.byTestID('save-changes').should('be.enabled');
147+
136148
secrets.save();
137149
secrets.detailsPageIsLoaded(uploadConfigFileImageSecretName);
138150

frontend/packages/integration-tests-cypress/views/details-page.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
export const detailsPage = {
2-
titleShouldContain: (title: string) => cy.get('[data-test="page-heading"] h1').contains(title),
2+
titleShouldContain: (title: string) => {
3+
cy.get('[data-test="page-heading"]', { timeout: 30000 }).should('be.visible');
4+
cy.get('[data-test="page-heading"]').contains(title, { timeout: 30000 });
5+
},
36
sectionHeaderShouldExist: (sectionHeading: string) =>
47
cy.get(`[data-test-section-heading="${sectionHeading}"]`).should('exist'),
58
labelShouldExist: (labelName: string) => cy.byTestID('label-list').contains(labelName),

0 commit comments

Comments
 (0)