Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(types): callFirestore produces an error when using querying options in typescript #396

Open
abouman76 opened this issue Jun 11, 2021 · 5 comments
Labels
bug Something isn't working needs-repro Needs reproduction steps

Comments

@abouman76
Copy link

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:

formatjs/formatjs#2645

Additional Context/Screenshots
I took a screenshot of the error and stack trace.

Schermafbeelding 2021-06-11 om 12 09 42

(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.)

@ChrisvdLeij
Copy link

ChrisvdLeij commented Jun 23, 2021

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); });

@abouman76
Copy link
Author

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.

@prescottprue
Copy link
Owner

Hey, thanks for reporting! I'll look into replicating - what is weird is that I thought there was a number of tests covering this 🤔

@prescottprue prescottprue changed the title callFirestore produces an error when querying documents: tslib_1.__spreadArray is not a function bug(types): callFirestore produces an error when using querying options in typescript Nov 29, 2021
@prescottprue prescottprue added the bug Something isn't working label Nov 29, 2021
@prescottprue
Copy link
Owner

prescottprue commented Dec 2, 2021

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

@prescottprue prescottprue added the needs-repro Needs reproduction steps label Dec 2, 2021
@Justin2997
Copy link

Updated to 2.2.5 from 1.x on my side and it fix the problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-repro Needs reproduction steps
Projects
None yet
Development

No branches or pull requests

4 participants