Skip to content

Commit

Permalink
chore: fix net_stubbing flake (#30276)
Browse files Browse the repository at this point in the history
* chore: fix net_stubbing flake

* different fix

* fix flake
  • Loading branch information
ryanthemanuel authored Sep 25, 2024
1 parent 88900e7 commit fbe51fc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/driver/cypress/e2e/commands/net_stubbing.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ describe('network stubbing', { retries: 15 }, function () {
})
})

it('can modify the request body', function () {
it('can modify the request body', function (done) {
const body = '{"foo":"bar"}'

cy.intercept('/post-only', function (req) {
Expand All @@ -1630,24 +1630,27 @@ describe('network stubbing', { retries: 15 }, function () {
}).then(function () {
$.post('/post-only', 'quuz').done((responseText) => {
expect(responseText).to.contain(body)

done()
})
})
})

// TODO: fix flaky test https://github.com/cypress-io/cypress/issues/23422
it('can add a body to a request that does not have one', { retries: 15 }, function () {
it('can add a body to a request that does not have one', { retries: 15 }, function (done) {
const body = '{"foo":"bar"}'

cy.intercept('/post-only', function (req) {
cy.intercept('/post-only*', function (req) {
expect(req.body).to.eq('')
expect(req.method).to.eq('GET')
req.method = 'POST'
req.headers['content-type'] = 'application/json'

req.body = body
}).then(function () {
$.get('/post-only').done((responseText) => {
$.get('/post-only').then((responseText) => {
expect(responseText).to.contain(body)
done()
})
})
})
Expand Down

5 comments on commit fbe51fc

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on fbe51fc Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.14.3/linux-x64/develop-fbe51fc0ab976f2dfd078edd7197717570e4af55/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on fbe51fc Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.14.3/linux-arm64/develop-fbe51fc0ab976f2dfd078edd7197717570e4af55/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on fbe51fc Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.14.3/darwin-arm64/develop-fbe51fc0ab976f2dfd078edd7197717570e4af55/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on fbe51fc Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.14.3/win32-x64/develop-fbe51fc0ab976f2dfd078edd7197717570e4af55/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on fbe51fc Sep 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/13.14.3/darwin-x64/develop-fbe51fc0ab976f2dfd078edd7197717570e4af55/cypress.tgz

Please sign in to comment.