components icon indicating copy to clipboard operation
components copied to clipboard

bug(mat-autocomplete): async mat-autocomplete drop-down items do not render when using Cypress

Open alxmrtn opened this issue 3 years ago • 5 comments

Is this a regression?

  • [ ] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When using mat-autocomplete in our application normally, everything works as expected. When running our e2e tests in a cypress chrome runner, the options fail to render in the HTML, and the autocomplete presents no options.

Sorry if this isn't the right place to file this bug, but we're very unsure of the cause.

Reproduction

Steps to reproduce:

  1. Have mat-autocomplete that loads async data for it's mat-options
  2. Run cypress e2e test that focuses the input that triggers the mat-autocomplete
  3. Notice that the mat-autocomplete drop down does not show
  4. Notice that the mat-options are not rendered when inspecting the HTML

Expected Behavior

We expect to see the dropdown as pictured below, with content in it

ships-blurred

Actual Behavior

When in the cypress test runner, the drop down does not render.

image

image (2)

Environment

  • Angular: 14.2.1
  • CDK/Material: 14.2.1
  • Browser(s): Cypress Chrome 108
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS

alxmrtn avatar Dec 09 '22 16:12 alxmrtn

me too

bankwitthawat avatar May 22 '23 07:05 bankwitthawat

Same error here when calling <mat-options *ngFor="let item of list | async" [value]="item">

DanJH avatar May 25 '23 17:05 DanJH

me too in v16

lixaotec avatar Jun 23 '23 18:06 lixaotec

any workaround?

lixaotec avatar Jun 23 '23 18:06 lixaotec

Hey! I had similar issue but with mat-select So i made it working by adding cy.wait(5000); // some seconds before clicking on the mat-select

example

cy.url().should('include', 'dashboard/routes/create');
cy.wait(5000); // hack to wait until dropdown finishes with rendering inside view component
cy.get('[data-rj-create="waste-type"]').click(); // render of async option has finished and we can click now
cy.get('#waste-type-87').click(); // click on available mat-options`

truekubas avatar Feb 10 '24 14:02 truekubas