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

Attribute Command not working #60

Closed
cubanx opened this issue Aug 30, 2021 · 2 comments · Fixed by #61
Closed

Attribute Command not working #60

cubanx opened this issue Aug 30, 2021 · 2 comments · Fixed by #61
Labels
bug Something isn't working

Comments

@cubanx
Copy link

cubanx commented Aug 30, 2021

Describe the bug

When you try to use the .attribute command, you get:
queue.filter is not a function

It looks like Cypress removed the .filter method in version 8.3. I played with this locally and it seems to work if I just switch it to use .find

However, I think I'm missing something with the invoked

To Reproduce

Write any test that uses the .attribute command

Expected behavior

The .attribute command should not throw an error.

Versions and such:

  • OS: Windows 10
  • Cypress version: > 8.2
  • Cypress browser: Any
  • Cypress-commands version: 1.1.0

Additional context

The problem line is here:

.filter({ name: commandName })

I cannot seem to find any info on the .filter method on Cypress docs or in the issues list.

I've seen the problem in Cypress 8.3 and 8.3.1

I can try to do a PR to fix it if that would help.

Thanks!

Ricardo Diaz

@cubanx cubanx added the bug Something isn't working label Aug 30, 2021
@Lakitna
Copy link
Owner

Lakitna commented Sep 4, 2021

I ran into this one too myself. In 8.3.0 they updated an internal thing that I depended on to make retry work as expected.

I need this fix myself too ;) Though I am very busy this month so please bear with me.

@Lakitna Lakitna mentioned this issue Sep 4, 2021
4 tasks
@Lakitna
Copy link
Owner

Lakitna commented Sep 4, 2021

However, I think I'm missing something with the invoked

The invoked bit is essentially a way to mark a command in the command queue so that it can be found again later on. We need this for the retry behavior of .attribute. Specifically when you do something like:

cy.get(<multiple divs>)
  .attribute('class')
  .should('not.exist');

I managed to fix it with queue.get().filter(...) which is a bit more flexible than find is ;)

@Lakitna Lakitna added this to the cypress-commands@2 milestone Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants