Comments (8)
Have you loaded your app via cy.visit
before hand?
That's what the error is saying. Sinon is dynamically injected into your page after you cy.visit
it.
Is there any code above the describe
block? If so paste it in please!
from cypress.
Interesting. No I didn't load it first because it calls the server
immediately and I want it mocked first. Trying it now...
On Saturday, April 4, 2015, Brian Mann [email protected] wrote:
Have you loaded your app via cy.visit before hand?
That's what the error is saying. Sinon is dynamically injected into your
page after you cy.visit it.—
Reply to this email directly or view it on GitHub
#12 (comment).
from cypress.
Yeah it works now. I'll report a typo in the error message instead:
if you testing a page
👍
from cypress.
Yah that error message needs work.
from cypress.
I think this does bring up an interesting point.
The way visit
works is that it doesn't resolve until your page fires the load
event. By the time the page does that, it's possible you had scripts that immediately made AJAX requests when they first loaded.
If that's the case, those requests would go out, since they'd happen before visit
resolves, and therefore before the server
command was even processed.
I'll need to set up a scenario where I can cause this to happen. visit
does take some options like onLoad
and onBeforeLoad
, but that wouldn't help starting a server because that's async anyway.
I may have to expand visit
to allow for immediately starting a server prior to any scripts being parsed or loaded.
I think the situation works in your case because you're either not firing anything immediately on load, or because you're using angular, it doesn't fire off the requests until much later. Though its possible due to a timing issue sometimes it may request faster than server
can be booted.
When are your requests being made?
from cypress.
We're using UI Router and there are requests in the resolve block. I
believe that means that Angular loads fully and fires the event, then it
starts the navigation cycle which leads to the request being made. I really
don't know what I'm talking about, though.
Maybe you could make .server() hold its state until the appropriate time
then slip it in in the case where visit() hasn't been called yet? Even if
not, maybe you can better detect this situation and improve the error
message, "you called .server() before you called .visit()", because when
you start mentioning sinon and iframes you break the magic barrier and I
have to understand the entire system suddenly.
Instead of accepting that I was wrong, I assumed something was broken.
Because I'm an asshole. And so is everyone else.
On Sat, Apr 4, 2015 at 4:38 PM, Brian Mann [email protected] wrote:
I think this does bring up an interesting point.
The way visit works is that it doesn't resolve until your page fires the
load event. By the time the page does that, it's possible you had scripts
that immediately made AJAX requests when they first loaded.If that's the case, those requests would go out, since they'd happen
before visit resolves, and therefore before the server command was even
processed.I'll need to set up a scenario where I can cause this to happen. visit
does take some options like onLoad and onBeforeLoad, but that wouldn't
help starting a server because that's async anyway.I may have to expand visit to allow for immediately starting a server
prior to any scripts being parsed or loaded.I think the situation works in your case because you're either not firing
anything immediately on load, or because you're using angular, it doesn't
fire off the requests until much later. Though its possible due to a timing
issue sometimes it may request faster than server can be booted.When are your requests being made?
—
Reply to this email directly or view it on GitHub
#12 (comment).
from cypress.
Such wise words.
Yah I'll make some adjustments for sure.
Starting the server before visit should be possible. I can create some hooks when the page initially loads to enable the server prior to anything else loading.
from cypress.
This is fixed in 0.4.3
. Changelog
from cypress.
Related Issues (20)
- Webpack Compilation Error HOT 2
- In JetBrain Aqua could not find number alias declaration HOT 3
- Cannot find name '$localize' when using Angular i18n directive
- Warning: We failed to remove old browser profiles from previous runs. This error will not affect or change the exit code. HOT 1
- Latest Docker image not compatible with ESM, failing with "configFile is invalid ... Unexpected identifier 'assert'" HOT 6
- yarn start FATAL:setuid_sandbox_host for contributors on ubuntu 24.04 HOT 1
- Windows OS cypress remains on second screen no matter what you do HOT 3
- Flaky test: cy.request / cy.api POST call returns 400 on Cypress but successful on POSTMAN
- null should be replaced with default timeout HOT 2
- Cesium <> Cypress Gitlab Pipeline HOT 1
- I can't execute tests in Chrome headless mode
- Add real Global Before and After hooks HOT 3
- Getting RangeError when trying to load application and get an element HOT 1
- An error occurs when adding vite-plugin-cypress-esm
- `experimentalSourceRewriting` performance bottleneck HOT 3
- Cypress Cloud tests hanging on specs- and timeout HOT 1
- DOMException: Failed to set the 'domain' property on 'Document': 'azure.com' is a top-level domain.
- `navigator.webdriver` is evaluated as `false` in Webkit browser
- Element is being covered by another element ({force: true} is not working)
- Restore ability to open a tab in the cypress testing window HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cypress.