Skip to content

Commit fbe51fc

Browse files
chore: fix net_stubbing flake (#30276)
* chore: fix net_stubbing flake * different fix * fix flake
1 parent 88900e7 commit fbe51fc

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/driver/cypress/e2e/commands/net_stubbing.cy.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ describe('network stubbing', { retries: 15 }, function () {
16191619
})
16201620
})
16211621

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

16251625
cy.intercept('/post-only', function (req) {
@@ -1630,24 +1630,27 @@ describe('network stubbing', { retries: 15 }, function () {
16301630
}).then(function () {
16311631
$.post('/post-only', 'quuz').done((responseText) => {
16321632
expect(responseText).to.contain(body)
1633+
1634+
done()
16331635
})
16341636
})
16351637
})
16361638

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

1641-
cy.intercept('/post-only', function (req) {
1643+
cy.intercept('/post-only*', function (req) {
16421644
expect(req.body).to.eq('')
16431645
expect(req.method).to.eq('GET')
16441646
req.method = 'POST'
16451647
req.headers['content-type'] = 'application/json'
16461648

16471649
req.body = body
16481650
}).then(function () {
1649-
$.get('/post-only').done((responseText) => {
1651+
$.get('/post-only').then((responseText) => {
16501652
expect(responseText).to.contain(body)
1653+
done()
16511654
})
16521655
})
16531656
})

0 commit comments

Comments
 (0)