Skip to content

Commit c3a3177

Browse files
PR changes
1 parent 4f1b670 commit c3a3177

File tree

3 files changed

+17
-22
lines changed

3 files changed

+17
-22
lines changed

src/components/ControlPlane/ManagedResources.cy.tsx

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ describe('ManagedResources - Edit Resource', () => {
212212
const fakeUseHandleResourcePatch: typeof useHandleResourcePatch = () => {
213213
patchHandlerCreated = true;
214214
return async (item: any) => {
215-
cy.log('Patch handler called!');
216215
patchCalled = true;
217216
patchedItem = item;
218217
return true;
@@ -271,11 +270,15 @@ describe('ManagedResources - Edit Resource', () => {
271270
];
272271

273272
before(() => {
274-
// Ignore Monaco Editor disposal errors
275273
cy.on('uncaught:exception', (err) => {
274+
// Ignore Monaco Editor errors
276275
if (err.message.includes('TextModel got disposed')) {
277276
return false;
278277
}
278+
// Ignore DiffEditorWidget errors
279+
if (err.message.includes('DiffEditorWidget')) {
280+
return false;
281+
}
279282
return true;
280283
});
281284
});
@@ -314,31 +317,23 @@ describe('ManagedResources - Edit Resource', () => {
314317

315318
// Verify YAML panel opened
316319
cy.contains('YAML').should('be.visible');
317-
cy.contains('test-subaccount').should('be.visible');
318320

319321
// Verify patch not called yet
320-
cy.then(() => {
321-
cy.log(`patchCalled before Apply: ${patchCalled}`);
322-
cy.wrap(patchCalled).should('equal', false);
323-
});
322+
cy.then(() => cy.wrap(patchCalled).should('equal', false));
324323

325324
// Click Apply button
326-
cy.contains('Apply changes').click();
325+
cy.get('[data-testid="yaml-apply-button"]').should('be.visible').click();
327326

328-
// Wait for dialog and confirm
329-
cy.get('ui5-dialog', { timeout: 10000 }).should('exist');
330-
cy.contains('Yes').click({ force: true });
327+
// Confirm in dialog
328+
cy.get('[data-testid="yaml-confirm-button"]', { timeout: 10000 }).should('be.visible').click({ force: true });
331329

332-
// Give it time to process
333-
cy.wait(2000);
330+
// Wait for success message
331+
cy.contains('Update submitted', { timeout: 10000 }).should('be.visible');
334332

335333
// Verify patch was called
336334
cy.then(() => {
337-
cy.log(`patchCalled after Apply: ${patchCalled}`);
338-
cy.log(`patchedItem: ${JSON.stringify(patchedItem)}`);
335+
expect(patchCalled).to.equal(true);
336+
expect(patchedItem).to.not.be.null;
339337
});
340-
341-
cy.then(() => cy.wrap(patchCalled).should('equal', true));
342-
cy.then(() => cy.wrap(patchedItem).should('not.be.null'));
343338
});
344-
});
339+
});

src/components/Yaml/YamlSidePanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ export function YamlSidePanel({ resource, filename, onApply, isEdit }: YamlSideP
142142
<p className={styles.diffConfirmMessage}>{t('yaml.diffConfirmMessage')}</p>
143143
</div>
144144
<FlexBox className={styles.reviewButtons}>
145-
<Button design="Transparent" data-testid="yaml-cancel-confirmation-button" onClick={handleGoBack}>
145+
<Button design="Transparent" onClick={handleGoBack} data-testid="yaml-cancel-confirmation-button">
146146
{t('yaml.diffNo')}
147147
</Button>
148-
<Button design="Emphasized" data-testid="yaml-confirm-button" onClick={handleConfirmPatch}>
148+
<Button design="Emphasized" onClick={handleConfirmPatch} data-testid="yaml-confirm-button">
149149
{t('yaml.diffYes', 'Yes')}
150150
</Button>
151151
</FlexBox>

src/components/YamlEditor/YamlEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const YamlEditor = (props: YamlEditorProps) => {
8585
<Toolbar design="Solid">
8686
<Title>{t('yaml.editorTitle')}</Title>
8787
<ToolbarSpacer />
88-
<Button design="Emphasized" onClick={handleApply}>
88+
<Button design="Emphasized" onClick={handleApply} data-testid="yaml-apply-button">
8989
{t('buttons.applyChanges', 'Apply changes')}
9090
</Button>
9191
</Toolbar>

0 commit comments

Comments
 (0)