Comments (7)
I'm not seeing the same error using your example. It runs seemingly fine, aside from the first test which fails (expectedly) with ENOENT: no such file or directory, scandir 'cypress/downloads'
.
FYI, your example doesn't even contain @cypress/browserify-preprocessor
as a dependency. Have you actually tried to run the example you're providing me?
from cypress-cucumber-preprocessor.
Hi! I am not sure about the @cypress/browserify-preprocessor
dependency but just to make sure I just copied an example from your repo. The failure of the first test should not be related to the fact of a missing folder (I don't know why it got deleted after my push to the repo because I added a .gitkeep
to make sure it wasn't deleted.
Of course I run the example, actually the error codes were copied from that run. I have just push an update adding the dependency and I attach an screenshot of the run failure (the downloads folder is existing):
from cypress-cucumber-preprocessor.
This happens because you're hogging the plugin thread with sync calls to fs for 100s. Do the calls asynchronously, add some time between each check and reduce 100s to something more appropriate. Then you'll see the errors go away.
from cypress-cucumber-preprocessor.
--- a/cypress.config.ts
+++ b/cypress.config.ts
@@ -59,7 +59,7 @@ export default defineConfig({
});
cypressOn('task', {
- getDownloadedFileName() {
+ async getDownloadedFileName() {
let files;
let start = Date.now();
let elapsed = Date.now();
@@ -70,7 +70,8 @@ export default defineConfig({
return str.endsWith('.xlsx') || str.endsWith('.ris') || str.endsWith('.csv');
});
elapsed = Date.now() - start;
- } while (files.length < 1 && elapsed < 100000);
+ await sleep(100);
+ } while (files.length < 1 && elapsed < 1000);
if (files.length > 0) {
// It's an array but will/should have only one element
@@ -86,3 +87,7 @@ export default defineConfig({
}
},
});
+
+function sleep (ms) {
+ return new Promise(resolve => setTimeout(resolve, ms))
+}
from cypress-cucumber-preprocessor.
I agree with the point of using the async call to be able to sleep, I will make that change to be more efficient.
I also understand that it might seem a lot of wait time, but the thing is that in my particular case the file is generated on the fly and may take up to 5m to be ready to be read.
Also, I don't the thinks the time waiting is a reason to make the state to be in something unexpected.
One could always configure the cy.task timeout to be 100s instead of the standard 30s or 1s if you want and IMHO that shouldn't raise an exception other than a timeout if there is any internal limitation, but not an unexpected behaviour, isn't it?
from cypress-cucumber-preprocessor.
Also, I don't the thinks the time waiting is a reason to make the state to be in something unexpected.
You can wait for whatever amount you want, but don't hog the plugin thread with sync calls. It makes Cypress behave incorrectly, as shown by timing out on screenshot, as well as on the internal task named cypress-cucumber-preprocessor:test-step-finished
.
Said task doesn't actually take up any time. You can set a timeout for as long as you want, but as long as you hog the plugin thread it won't matter. By hogging the thread, you prevent the plugin from doing its job and that's why there's a state error.
from cypress-cucumber-preprocessor.
Understood. I will try to apply you recommendations and see how it behaves
from cypress-cucumber-preprocessor.
Related Issues (20)
- Run with tag is not working on Windows 11 but in MacOs yes HOT 2
- Allure result is failed to be generated when use allure-cypress HOT 1
- Unexpected state in afterSpecHandler after an AssertionError and after each hook throws CypressError when trying to invoke cy.task() HOT 2
- explicit user configuration is not loaded in 20.0.5 HOT 6
- Stack trace is not working HOT 1
- Cypress-cucumber-preprocessor with Cypress-split HOT 3
- Enhancement request: remove reversal of After hooks order HOT 2
- @bahmutov/cypress-esbuild-preprocessor not installed with v20.0.5, 'Quick start' guide out of date? HOT 2
- [filepath] not including subfolders in resolution HOT 2
- Error on node_modules/@badeball/cypress-cucumber-preprocessor/dist/registry.js: HOT 7
- Incompatible types with esbuild 0.21.5 HOT 6
- Remove deprecated Browserify Preprocessor HOT 1
- Display Tests as 'Pending' in Command Line When Using '@only' or '@skip' Tags HOT 1
- Expected there to be a timestamp for current step HOT 4
- Unexpected state in beforeSpecHandler: uninitialized while running .feature file through terminal in Cypress HOT 2
- Only the first feature is executed in mode inprivate, when executing from command line HOT 1
- Import createEsbuildPlugin not working HOT 1
- Step implementation missing HOT 1
- Bug - Cucumber reports getting overwritten when a new feature file is executed HOT 4
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-cucumber-preprocessor.