-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/// <reference path="../../src/index.d.ts" /> | ||
// @ts-check | ||
|
||
import '../../src' | ||
|
||
// fails the test on 401 response code | ||
it('fails the test when a request receives 401 status code', () => { | ||
cy.on('fail', (e) => { | ||
if (e.message.includes('failed with 401')) { | ||
console.log('expected error') | ||
return false | ||
} else { | ||
throw e | ||
} | ||
}) | ||
|
||
// fail the test if any of the matching calls | ||
// returns a 4xx status code | ||
cy.waitForNetworkIdlePrepare({ | ||
method: '*', | ||
alias: 'all', | ||
pattern: '**', | ||
failOn4xx: true, | ||
}) | ||
|
||
cy.visit('/fail-500') | ||
.wait(2000) | ||
.then(() => { | ||
// the network should have caught an 5xx error | ||
throw new Error('Should never get here') | ||
}) | ||
}) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters