Comments (12)
Sure! Glad to help!
It looks like your file path has a space in it - could you try escaping it by putting a \
in front of that? Seems like the original example did as well.
cypress-firebase should definitely handle this case internally, but just want to see if that helps
from cypress-firebase.
I found a workaround, and this way works --
cy.tokenLoginAs("admin")
.log("Creating test case...")
.writeFile(testCaseFixturePath, testCase)
.then(() => {
cy.callFirestore("set", getTestCaseDocPath("admin", testCase._id), testCaseFixtureName)
.as("testCaseCreated")
.log("Test Case created.")
})
Then in after(), I delete the file and the database item.
So I know that this error is simply because of the path.
Also, I have now tried npx, and that works great for me.
from cypress-firebase.
Hmm... Yarn shouldn't impact the npm bin.
Do you have firebase-tools installed within your project? It is a peer-dependency as it is needed to run commands with admin privileges.
I haven't really seen this before, and not sure why it wouldn't be parsing that as expected. In the past npx
was used, so I may look into switching back to that instead of a command containing the bin reference.
Have you tried using get
in callFirestore
? Does it also produce a similar error for you?
Just so I can try replicating - which version of cypress, cypress-firebase, and firebase-tools are you using?
from cypress-firebase.
Thanks for your speedy reply!
I have firebase-tools installed:
firebase-tools: 7.8.0
cypress: 3.4.1
cypress-firebase: 0.4.1
from cypress-firebase.
I haven't tried get. I have tried set and delete commands. I will try get and let you know.
from cypress-firebase.
Hmm, I'm not sure what I did, but now this is the error I am getting. This is for get, set, and delete commands:
CypressError: cy.exec('$(npm bin)/firebase-extra firestore get companies/DevAutomation/projects/DevAutomationProject/Test Cases/1') failed because the command exited with a non-zero code.
Pass {failOnNonZeroExit: false} to ignore exit code failures.
Information about the failure:
Code: 1
Stderr:
' is not recognized as an internal or external command,
operable program or batch file.
Because this error occurred during a 'before all' hook we are skipping the remaining tests in the current suite: 'Client New Test Page'
This was the command I ran:
before(() => {
cy.tokenLoginAs("admin")
cy.log("Retrieving test case...")
.callFirestore("get", getTestCaseDocPath("admin", "1"))
.as("testCase")
})
from cypress-firebase.
Good idea! I tried to do the \
just now, but same error. I also tried changing the space to %20
(which is what we had to do for firebase rules (to be honest, I wish we could change this, but this is in production code, so I need that. However, it seems that it cannot find the command. I ran this same command in the command line, except changed $(npm bin) to ./node_modules/.bin, and it ran the command just fine. Its only when I run it in cypress that it fails.
from cypress-firebase.
That is very intesting, not sure why I haven't experienced this. What type of machine are you using to run Cypress? Windows, mac, or linux?
Looks like we may have to switch things back to npx
instead of using $(npm bin)
, so I'll look into making that change
from cypress-firebase.
I'm on Windows 10. Thanks for your help! I really like this module.
from cypress-firebase.
I changed this in constants.js on my end:
exports.FIREBASE_TOOLS_BASE_COMMAND = 'node_modules\\.bin\\firebase';
// Path to firebase-tools-extra Command Line tool (wrapper for firebase-tools)
exports.FIREBASE_EXTRA_PATH = 'node_modules\\.bin\\firebase-extra';
And it worked. However, I'm getting this error, but I don't think its related
Error: the string "(node:18408) UnhandledPromiseRejectionWarning: Error: Fixture not found at path: test\\e2e\\fixtures\\'{_id:Automation-Test-Case-1574356128828 ... }
I thought that the set command could have an object passed in (I have a function to generate my object to set the value to). Am I using it right? I'm asking in this since I'm making sure this change fixes it.
from cypress-firebase.
@dhair-seva Glad to hear switching it up worked. For passing in a fixture, you will want to have an object, but it seems like you might have passed a string since it thinks it is a fixture path?
Did you try switching them to using npx
like npx firebase-extra
? I think that might be the best path forward since it will handle local and global versions
from cypress-firebase.
@prescottprue I haven't tried npx. I will when I get a chance. I passed in an object. This is what I used:
const testCase = generateTestCase()
before(() => {
cy.tokenLoginAs("admin")
cy.log("Creating test case...")
.callFirestore("set", getTestCaseDocPath("admin", testCase._id), testCase)
.log("Test Case created.")
})
generateTestCase returns an object like:
{ _id: 'my-custom-id', ... }
from cypress-firebase.
Related Issues (20)
- publish-npm failing Error: Error [ERR_REQUIRE_ESM]: require() of ES Module HOT 1
- bug: cannot read properties of undefined (reading 'includes') HOT 4
- Login after a logout happening the application fails
- Cypress e2e test fails initialization HOT 1
- feat(build): native esm support
- fix: drop support for node pre 16 HOT 2
- Support passing user claims to cy.login() ? HOT 1
- Invalid options types are ignored, rather than erroring
- The automated release is failing 🚨
- bug(docs): README.md setup is not clear about service account HOT 6
- Retry on 401
- bug(firestore): FieldValue.delete() not handled correctly HOT 3
- feat(callFirestore): ability to use batch writes
- bug(firestore): nested Timestamp value not persisting HOT 3
- bug: callFirestore not recognized in NextJS test HOT 1
- feat: support for component testing
- feat: switch to modular firebase sdks internally HOT 2
- bug(core): Webpack error when running cypress tests with cypress-firebase HOT 10
- callFirestore task fails when running in the CI with message "PERMISSION_DENIED: Missing or insufficient permissions." HOT 1
- Problem with Token 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-firebase.