Skip to content

bug(COMPONENT): MatAutocompleteHarness - Unable to retrieve options for autocomplete. Autocomplete panel is closed. #29720

@incy-tron

Description

@incy-tron

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

I am testing a large application using the Angular Test Suite with karma - jasmine. I have 164 test cases and when I run all of the test cases, one of the test cases that always fails is one where I'm using MatAutocompleteHarness. However, if I rerun that test individually it always passes.

The failure message I'm getting is: Error: Unable to retrieve options for autocomplete. Autocomplete panel is closed.

Reproduction

Cannot provide a StackBlitz, since as I mention above, it only happens when running all of the test cases for a large application. The specific test case that fails is:

component.showModifications = true;
fixture.detectChanges();
await fixture.whenStable();

const loader = TestbedHarnessEnvironment.loader(fixture);
const autocompletes = await loader.getAllHarnesses(MatAutocompleteHarness);
expect(autocompletes.length).toBe(1);

Expected Behavior

Expect the test to pass when running with many other tests.

Actual Behavior

Fails every time when running multiple tests

Environment

  • Angular: 17.3
  • CDK/Material: "@angular/cdk": "^17.3.0", "@angular/material": "^17.3.0"
  • Browser(s): Chrome
  • Operating System : Windows and MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions