Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RequestMock does not send response #2336

Closed
flec opened this issue Apr 21, 2018 · 2 comments
Closed

RequestMock does not send response #2336

flec opened this issue Apr 21, 2018 · 2 comments
Assignees
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot. SYSTEM: hammerhead
Milestone

Comments

@flec
Copy link

flec commented Apr 21, 2018

Are you requesting a feature or reporting a bug?

Bug

What is the current behavior?

The RequestMock does not send a response by using respond, there is a unhandled promise rejection.

(node:1812) UnhandledPromiseRejectionWarning: TypeError: ctx.destRes.pipe is not a function
    at Object.decideOnProcessingStrategy (C:\dev\tc\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:172:33)
    at next (C:\dev\tc\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:386:38)
    at Object.checkSameOriginPolicyCompliance (C:\dev\tc\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:148:9)
    at next (C:\dev\tc\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:386:38)
    at Object.sendDestinationRequest (C:\dev\tc\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:135:17)
    at next (C:\dev\tc\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:386:38)
    at Object.<anonymous> (C:\dev\tc\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:106:13)
    at Generator.next (<anonymous>)
    at step (C:\dev\tc\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:94:191)
    at C:\dev\tc\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:94:361
(node:1812) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1812) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

What is the expected behavior?

The response should be sent

How would you reproduce the current behavior (if this is a bug)?

Using the code below with testcafe chrome

Provide the test code and the tested page URL (if applicable)

Tested page URL: https://phppot.com/demo/jquery-ajax-autocomplete-country-example/

Test code

import { Selector, RequestMock } from 'testcafe'

const requestMock = RequestMock()
    .onRequestTo('https://phppot.com/demo/jquery-ajax-autocomplete-country-example/readCountry.php')
    .respond(`<ul id="country-list"><li onClick="selectCountry('Sweden')">Sweden</li><li onClick="selectCountry('Switzerland')">Switzerland</li></ul>`)

fixture`Getting Started`
    .page`https://phppot.com/demo/jquery-ajax-autocomplete-country-example/`
    .requestHooks(requestMock)

test('My first test', async t => {
    await t
        .typeText('#search-box', 's')
        .expect(Selector('#country-list li:first-child').innerText).eql('Sweden')
})

Specify your

  • operating system: Windows 10.0.0
  • browser and version: Chrome 65.0.3325
  • testcafe version: 0.20.0-alpha.1
  • node.js version: 8.11.1
@miherlosev
Copy link
Collaborator

I'm working on this

@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot. SYSTEM: hammerhead
Projects
None yet
Development

No branches or pull requests

2 participants