cypress-firebase: bug(callFirestore): calling callFirestore with an object does not work on Windows (only fixtures do)
I tried calling:
cy.callFirestore("update", "companies/my-id", { creditsRemaining: 1000 })
and
cy.callFirestore("set", "companies/my-id", { creditsRemaining: 1000 })
But receive this error:
Error: the string "(node:25288) UnhandledPromiseRejectionWarning: Error: Fixture not found at path: test\\e2e\\fixtures\\'{creditsRemaining:1000}' or cypress\\fixtures\\'{creditsRemaining:1000}'\n at readFixture (C:\\Users\\I20649\\Workspace\\testramp-ng8\\node_modules\\firebase-tools-extra\\lib\\commands\\firestore.js:26:19)\n at C:\\Users\\I20649\\Workspace\\testramp-ng8\\node_modules\\firebase-tools-extra\\lib\\commands\\firestore.js:96:39\n at step (C:\\Users\\I20649\\Workspace\\testramp-ng8\\node_modules\\tslib\\tslib.js:136:27)\n at Object.next (C:\\Users\\I20649\\Workspace\\testramp-ng8\\node_modules\\tslib\\tslib.js:117:57)\n at C:\\Users\\I20649\\Workspace\\testramp-ng8\\node_modules\\tslib\\tslib.js:110:75\n at new Promise (<anonymous>)\n at Object.__awaiter (C:\\Users\\I20649\\Workspace\\testramp-ng8\\node_modules\\tslib\\tslib.js:106:16)\n at firestoreAction (C:\\Users\\I20649\\Workspace\\testramp-ng8\\node_modules\\firebase-tools-extra\\lib\\commands\\firestore.js:87:20)\n at runFirebaseExtra (C:\\Users\\I20649\\Workspace\\testramp-ng8\\node_modules\\firebase-tools-extra\\bin\\firebase-tools-extra:57:12)\n at Object.<anonymous> (C:\\Users\\I20649\\Workspace\\testramp-ng8\\node_modules\\firebase-tools-extra\\bin\\firebase-tools-extra:66:2)\n(node:25288) 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)\n(node:25288) [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." was thrown, throw an Error :)
Because this error occurred during a 'before all' hook we are skipping the remaining tests in the current suite: 'Client New Test Run Page'
It looks like it won’t allow an object like your documentation states:
cy.callFirestore('set', `testCollection/${TEST_UID}`, {
name: 'axa',
age: 8,
})
Versions: cypress-firebase: “0.4.1” cypress: “3.4.1” firebase-tools: “^7.8.0”
This seems like a bug.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 28 (27 by maintainers)
Commits related to this issue
- feat(core): add tasks support through pluginWithTasks * fix(callFirestore): fix windows support for passing a fixture (through use of tasks) - #71 — committed to prescottprue/cypress-firebase by deleted user 4 years ago
- v0.11.0-alpha.2 (#95) * feat(core): add tasks support through `pluginWithTasks` * feat(ci): add support for publishing to alpha tag * fix(callFirestore): fix windows support for passing a fixture (... — committed to prescottprue/cypress-firebase by prescottprue 4 years ago
- v0.11.0-beta (#99) * fix(callRtdb): add support for "delete" as remove alias in `callRtdb` task * fix(types): update `cy.login` arguments to include customClaims * chore(tasks): add initial unit te... — committed to prescottprue/cypress-firebase by prescottprue 4 years ago
- v0.11.0 (#100) * feat(core): add tasks support through `pluginWithTasks` * fix(callFirestore): fix windows support for passing a fixture (through use of tasks) - #71 * feat(ci): add support for pub... — committed to prescottprue/cypress-firebase by prescottprue 4 years ago
I have started work on a new method of doing things (through tasks instead of passing through the firebase-tools-extra cli). This should help fix things, but it is definetly a work in progress
To try it out do the following:
npm i --save-dev cypress-firebase@alpha firebase-admin
(currently at 0.11.0-alpha.2)pluginWithTasks
like so:Full example
I have a temporary workaround. Basically we save the object and then use that as a fixture. It works for our use case and we have used over 50 e2e tests with it. Obviously its not ideal, but it works for now.
@prescottprue Okay, so I tried this same command on my MAC, and it works just fine. This is a Windows-specific bug.
Actually, looks like the error is displayed here. https://github.com/prescottprue/firebase-tools-extra/blob/master/src/commands/firestore.ts I’m trying to look into this bug, because my workaround is really making a lot of code. (writing a file everytime I need to update an object in firestore.