Skip to content

Commit 61091a9

Browse files
author
“khandrew-redhat”
committed
e2e test edits
Signed-off-by: “khandrew-redhat” <“khandrew@redhat.com”>
1 parent a8bc3d3 commit 61091a9

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

frontend/cypress/e2e/error-handling.cy.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
* Error Handling Validation Tests
33
*
44
* Validates the enhanced axios interceptor error handling:
5-
* - Different FastAPI error response formats
5+
* - Different FastAPI error response formats
66
* - Toast notifications for errors
77
* - UI remains operational after errors
8-
* - Fallback messages for malformed responses
8+
* - Error messages for 500 and 503 errors
99
* - Centralized error handling in Axios layer
1010
*
1111
* Uses mocked API responses - no backend required.
@@ -108,7 +108,7 @@ describe('Error Handling Validation', () => {
108108
cy.contains('string detail format').should('be.visible');
109109
});
110110

111-
it('Format 4: {"error": "..."} - shows Internal Server Error toast', () => {
111+
it('Format 4: {"error": "..."} - shows enhanced 500 error message', () => {
112112
cy.intercept('GET', '**/test-errors/format4*', {
113113
statusCode: 500,
114114
body: { error: 'This is a test error with direct error key' },
@@ -119,10 +119,10 @@ describe('Error Handling Validation', () => {
119119

120120
cy.wait('@format4');
121121
cy.contains('Internal Server Error', { timeout: 10000 }).should('be.visible');
122-
cy.contains('direct error key').should('be.visible');
122+
cy.contains('A backend service is temporarily unavailable').should('be.visible');
123123
});
124124

125-
it('Malformed Response - shows fallback message when JSON cannot be parsed', () => {
125+
it('Malformed Response - shows enhanced 503 error message', () => {
126126
cy.intercept('GET', '**/test-errors/malformed*', {
127127
statusCode: 503,
128128
body: 'This is not valid JSON',
@@ -133,16 +133,8 @@ describe('Error Handling Validation', () => {
133133
});
134134

135135
cy.wait('@malformed');
136-
// Malformed returns 503 - should show Server Error or Request Error fallback
137-
cy.get('body', { timeout: 10000 }).should(($body) => {
138-
const text = $body.text();
139-
expect(
140-
text.includes('Server Error') ||
141-
text.includes('Request Error') ||
142-
text.includes('Service Unavailable') ||
143-
text.includes('issue with your request')
144-
).to.be.true;
145-
});
136+
// Status 503 now returns enhanced message regardless of response format
137+
cy.contains('The service is temporarily overloaded or under maintenance', { timeout: 10000 }).should('be.visible');
146138
});
147139

148140
it('Validation Errors - combines multiple validation errors in toast', () => {

0 commit comments

Comments
 (0)