forked from DevExpress/testcafe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add clear message about failed CORS validation requests (close DevExp…
- Loading branch information
1 parent
4b5547a
commit 31ddb8b
Showing
12 changed files
with
74 additions
and
12 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
24 changes: 24 additions & 0 deletions
24
test/functional/fixtures/api/es-next/request-hooks/pages/failed-cors-validation.html
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,24 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
<button id="btnSendFetch">Send fetch request</button> | ||
<span>Request status:</span><span id="requestStatusText">Not send</span> | ||
<script> | ||
var btnSendFetch = document.getElementById('btnSendFetch'); | ||
|
||
btnSendFetch.addEventListener('click', function () { | ||
fetch('http://dummy-url.com/get') | ||
.then(res => { | ||
return res.text(); | ||
}) | ||
.then(() => { | ||
document.getElementById('requestStatusText').textContent = 'Sent'; | ||
}); | ||
}); | ||
</script> | ||
</body> | ||
</html> |
15 changes: 13 additions & 2 deletions
15
test/functional/fixtures/api/es-next/request-hooks/test.js
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
15 changes: 15 additions & 0 deletions
15
...xtures/api/es-next/request-hooks/testcafe-fixtures/request-mock/failed-cors-validation.js
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,15 @@ | ||
import { Selector, RequestMock } from 'testcafe'; | ||
|
||
const mock = RequestMock() | ||
.onRequestTo('http://dummy-url.com/get') | ||
.respond({ prop: 'value' }, 200, { 'not-specify-cors-headers': true }); | ||
|
||
fixture `Failed CORS validation` | ||
.page('http://localhost:3000/fixtures/api/es-next/request-hooks/pages/failed-cors-validation.html') | ||
.requestHooks(mock); | ||
|
||
test('Failed CORS validation', async t => { | ||
await t | ||
.click('#btnSendFetch') | ||
.expect(Selector('#requestStatusText').textContent).eql('Sent'); | ||
}); |
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