Skip to content

Commit 4dd4e35

Browse files
authored
chore: remove httpstat.us dependency, add utility route for cy-in-cy (#31961)
1 parent a20aa3b commit 4dd4e35

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

packages/server/lib/routes.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,15 @@ export const createCommonRoutes = ({
104104
})
105105

106106
// If we are in cypress in cypress we need to pass along the studio routes
107-
// to the child project.
107+
// to the child project. We also add a utility route for testing HTTP status code UI
108108
if (process.env.CYPRESS_INTERNAL_E2E_TESTING_SELF_PARENT_PROJECT) {
109109
router.get('/__cypress-studio/*', async (req, res) => {
110110
await networkProxy.handleHttpRequest(req, res)
111111
})
112+
113+
router.get('/status-code-test/:num', (req, res) => {
114+
res.sendStatus(Number(req.params.num))
115+
})
112116
} else {
113117
// express matches routes in order. since this callback executes after the
114118
// router has already been defined, we need to create a new router to use

system-tests/project-fixtures/runner-specs/cypress/e2e/runner/ui-states/errors.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ describe('Errors', () => {
66
})
77

88
it('long error', () => {
9-
cy.request('http://httpstat.us/500')
9+
cy.request('/status-code-test/500')
1010
})
1111
})

system-tests/project-fixtures/runner-specs/cypress/e2e/runner/ui-states/status-codes.cy.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
describe('Status Codes', () => {
22
it('Request Statuses', () => {
3-
cy.request('https://httpstat.us/200')
4-
cy.request('https://httpstat.us/304')
3+
cy.request('/status-code-test/200')
4+
cy.request('/status-code-test/304')
55

66
cy.request({
7-
url: 'https://httpstat.us/400',
7+
url: '/status-code-test/400',
88
failOnStatusCode: false,
99
})
1010

1111
cy.request({
12-
url: 'https://httpstat.us/502',
12+
url: '/status-code-test/502',
1313
failOnStatusCode: false,
1414
})
1515

1616
cy.request({
17-
url: 'https://httpstat.us/103',
17+
url: '/status-code-test/103',
1818
timeout: 2000,
1919
})
2020
})

0 commit comments

Comments
 (0)