Skip to content

Dialog is not removed during tests, leading to order-dependent tests #23385

Open
@jbeder

Description

@jbeder

I have a set of screenshot tests using Angular Catalyst that pass when run A, B but fail when run B, A; the failure is that the screenshot for A, when run after B, shows the shadow of the dialog that was created for B. (I'm not linking to them because they're internal to Google.)

If I add:

afterEach(async () => {
  const dialog = await getHarness(MatDialogHarness, {useDocumentRoot: true});
  await dialog.close();
});

to test B, then they pass in either order. The test infrastructure should clean this up automatically to keep the tests hermetic.

@josephperrott indicated that "it is created by an injector which doesn't belong to a specific NgModule so it isn't torn down".

Metadata

Metadata

Assignees

No one assigned

    Labels

    GThis is is related to a Google internal issueP2The issue is important to a large percentage of users, with a workaroundarea: material/dialog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions