-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Problem cancelling XHRs from previous test #761
Comments
Related to #686 and almost a duplicate, but I'll leave this open for now until I can confirm it is. |
Same issue. |
We no longer abort XHR's in between tests. This was actually fixed in |
@brian-mann I still have the problem in 1.0.3 (Chrome 62, Electron 53 in both)
|
I have the same problem |
I'm getting these errors when calling visit on a new url after running over from one test spec file to the next. Currently having to do something nasty like: Cypress.on('uncaught:exception', (err, runnable) => {
return err.message.indexOf('Cannot set property \'aborted\' of undefined') === -1
}); |
I'm facing the same problem with cypress 1.4.1. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I am also experiencing this with 1.4.2. I am not making any requests or even repeating |
Having the same problem with 1.4.1. Did somebody find some workaround? |
Just to add still happening for us in 2.1.0, we've added an extra |
@dracos where did you add the |
@rafaelchiti At the end of the test that caused the next test to fail, went for a 404 in the end. See the |
@brian-mann If you no longer abort XHRs between tests how come we all still get this error ? I'm using 2.1.0 and I keep having this problem. Thanks |
@rafaelchiti did you have any success with the PubNub long polling and Cypress? Some of the functionality i want to test is dependent on it so I don't really want to stub it out. |
mm I managed to get it going but seemed a bit off the stuff I had to do. Let me share the example here. I followed what dracos suggested. Either way I didn't experiment much, after this I switched to Test Cafe (due to other company requirements). My test would have this: beforeEach(() => {
cy.visit(Cypress.env("yourAppUrl"));
});
afterEach(() => {
cy.cleanUpXHR();
}); my commands.js Cypress.Commands.add("cleanUpXHR", function() {
if (Cypress.env("run_all_suite")) {
cy.visit(`${Cypress.env("yourAppUrl")}/404`, { failOnStatusCode: false });
} my make file for running them:
I only executed the clean up when running the whole suite. When working on 1 test with the visual debugger I didn't want that behavior to kick in, since that visual debugger is sort of meant for working on one test at a time (from what I understand) and not to run multiple tests. |
Also seeing this with 2.10, but the extra page visit after the tests only fixes it most of the time, plus it adds time to each test to visit the extra page. |
Same here. Similar to @rafaelchiti and @roy46, our app has long polling requests that will trigger this error on every spec. I didn't have any luck at all with an afterEach hook, so I had to add a command as the last step in every spec to route to a static 404 html page. It slows the suites down since every spec has to reload the page. |
Still an issue with 3.0.1 too. |
I was getting this too but only on test failures, which made it very hard to debug. In my case it turned out to be through using:
in an attempt to get it to retry failing tests once... this is a mocha thing that turned out never worked anyway, but I accidentally left it in. This caused the problem... maybe related upgrading to 3.0.1 but I doubt it. |
@jennifer-shehane How is the status of this, now having a reproducible example? |
@brian-mann ... thank you, Brian. |
The code for this is done, but this has yet to be released. We'll update this issue and reference the changelog when it's released. |
Released in |
Hi, I'm using rxjs and redux-obsevables in my app. There was no problem in Cypress 3.1.2 with aborting requests by
I think it's caused by solving this 🐛 |
@tomaass ... as always ... without a simple reproduction demo, it's hard to guess. |
@mlc-mlapis example of aborting request by using rxjs and redux-observables ;-) const exampleEpic = action$ =>
action$.ofType(FETCH_ACTION)
.switchMap(() =>
Observable.ajax.getJSON('example.url')
.takeUntil(action$.ofType(ANOTHER_ACTION))
.map(fetchExampleFulfilled)
|
@tomaass ... which RxJS version is used here? Because I can't see pipe-able operators. |
Hey, I can solve it with |
This issue will be closed to further comment as the exact issue here was resolved and tested. If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix. |
Current behavior:
Yep, there is an issue if you don't wait for all XHRs to finish after a test. When it tries to cancel the XHR it fails with the error: -
if I do an explicit
cy.wait(2000)
orcy.wait('@myxhr')
it worksnote it's the following test that fails, not the one with the XHR
Desired behavior:
The XHR should be cancelled correctly before the next test starts
How to reproduce:
Have a longish running XHR fire at the end of one test and have a subsequent test.
Additional Info (images, stack traces, etc)
It seems to happen when I am faking a route failure (status 500) and then make another (non-faked) XHR (to report the error to a server). e.g.: -
The text was updated successfully, but these errors were encountered: