bug(types): callFirestore produces an error when using querying options in typescript
abouman76 opened this issue · 5 comments
Describe the bug
- I am using the callFirestore() command.
- I am passing in an object with the "where" option in order to query the collection of documents.
- I am giving it an array with the following values:
["uid", "==", "L6l35k13fpYIYVW6DeouSqxhu4h2"]
- This produces the following error:
tslib_1.__spreadArray is not a function
To Reproduce
Steps to reproduce the behavior:
I called the firestore command in the following way.
cy.callFirestore("get", "userAdvertisement", {
where: ["uid", "==", "L6l35k13fpYIYVW6DeouSqxhu4h2"],
}).then((response) => {
cy.log("get add", response);
});
Expected behavior/code
A clear and concise description of what you expected to happen (or code).
- I expect to get documents from the firestore with a specific uid value.
- My documents in the firestore are structured like this:
{
choice: "string",
date: "01-01-2020",
description: "description ad",
title: "title ad",
uid: "L6l35k13fpYIYVW6DeouSqxhu4h2"
}
Possible Solution
- Perhaps i am using the where option in a wrong way
- Maybe the tslib version needs to be updated? (i am not an expert on dependencies)
I read the following issue with a similar error which was resolved by bumping or changing the tslib version:
Additional Context/Screenshots
I took a screenshot of the error and stack trace.
(Hi Prescott,
I am learning e2e testing and i am new to web development.
This is my first github issue if i am missing some information, please let me know!
Thanks for writing this library.)
Same issue for me. Try passing an empty string as 3rd argument like
cy.callFirestore("get", "userAdvertisement", "", { where: ["uid", "==", "L6l35k13fpYIYVW6DeouSqxhu4h2"], }).then((response) => { cy.log("get add", response); });
Same issue for me. Try passing an empty string as 3rd argument like
cy.callFirestore("get", "userAdvertisement", "", { where: ["uid", "==", "L6l35k13fpYIYVW6DeouSqxhu4h2"], }).then((response) => { cy.log("get add", response); });
Thank you Chris for responding. I tried this and does stop the test from crashing, however is simply get all the records from the database. Not the ones where the "uid" matches.
Looks like putting the options as the 4th argument ignores the options all together.
Hey, thanks for reporting! I'll look into replicating - what is weird is that I thought there was a number of tests covering this 🤔
I was not able to replicate this in the updated Typescript example (updated to Typescript in Cypress folder as well as part of v2.2.0). From the looks of it the build doesn't even include tslib_1.__spreadArray
anymore.
Could everyone give version 2.2.0 a try and see if you are still seeing the issue? If so, I'm wondering if it has to do with typescript config of some kind somewhere else within your project. If you are still able to reproduce please respond with your setup
Updated to 2.2.5 from 1.x on my side and it fix the problem :)