Skip to content

Cypress 15 angular testing: componentProperties don't seem to be set anymore when mounting. #32391

@jcompagner

Description

@jcompagner

Current behavior

All our test are failing when we move from Cypress 14 to Cypress 15

This looks like because componentProperties in the mount call are not set on the component.

so we have a wrapper component:

class WrapperComponent {
text = 'MyButton';
}

then we have:
const configWrapper: MountConfig = {
declarations: [XXXX],
imports: [ YYYY]
}
and

configWrapper.componentProperties = {
text: 'MyButton2'
}

then we do

cy.mount(WrapperComponent, configWrapper).then((wrapper) => {

but the text is still "MyButton" not "MyButton2"

we have that will all the properties that we set, the things we init directly in the class are there but the componentProperties are not set over it.

after that if we do:

wrapper.component.text = 'MyButton2';
wrapper.fixture.detectChanges();

then it works
then the component that is wrapped by the component that gets that text property as its own, the onChanges() is called with that change. The initial onchanges of angular is always the class defined values. never the componentProperties defined values.

Desired behavior

that it works like Cypress 14

Test code to reproduce

see here:
https://github.com/Servoy/bootstrapcomponents/blob/master/components/projects/bootstrapcomponents/src/button/button.cy.ts#L65

checking out that project you can run that with npm run cy:open (or run)

that "servoyApi" object has to be set before the component is constructed but we do want to spy on it, so the mound should use the servoyApi object that is set and spyed on in the componentProperties.servoyApi
But that doesn't work anymore so a lot of stuff goes wrong

Cypress Version

15

Node version

v22.15.0

Operating System

windows

Debug Logs

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions