'Cypress: How to scroll AG-Grid Table

I would like to scroll to a specific column in the AG-Grid table Ag-Grid table. The cypress command scrollTo() doesn't work for me for this kind of tables. Do you have a idea how i can solve this problem?

Thank you!



Solution 1:[1]

I have found a solution for my scroll problem. Now I use the AG-Grid API link.

Example:

Cypress.Commands.add('ensureColumnVisible', (component: string, colId: string): Cypress.Chainable<void> =>{
    return cy.getGridApi(component).then(api => {
        api.ensureColumnVisible(colId);
        return cy.log(`Scrolling column: '${colId}' was successfully!`);
    })
});

cy.ensureColumnVisible('nameOfgrid', 'colID');

Solution 2:[2]

did a work around for this by using keyboard command using .type

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 CypressDog
Solution 2 Christian Lojo