Rayrun
โ† Back to Discord Forum

Tips for working with ag-grid

jennifer0419posted in #help-playwright
Open in Discord
jennifer0419
jennifer0419

I'm starting to write tests for a new feature that uses ag-grid. If anyone has done this and has learned lessons the hard way, I'd appreciate tips so I don't make the same mistakes. I'm new to both ag-grid and Playwright; I've worked with custom table implementations and Selenium in the past.

My primary concern with ag-grid is that it loads and unloads cells as you scroll around the table. This makes finding cells in a test complex as you can't use a simple locator with row and column indexes unless you know with absolute certainty that the rows and columns are in the viewport at those exact positions. In practice, this means a small table that always fits in the viewport and no scrolling. For larger tables I've been getting around entering data with scrolling using tab navigation but I do need to verify values in the cells later in the test. The load/unload means that I can't get all cells as an array then use a list assertion because not all cells will be present. Playwright can't tell us how many cells are displayed, so I can't break this into chunks.

I'm currently thinking of using a hotkey to navigate to the first column with a value, then tab to each cell and check the value. That's inefficient, but might work. Said hotkey is not yet implemented so I can't test it.

Does anyone have a better approach?

This thread is trying to answer question "What are some effective strategies for testing a new feature using ag-grid and Playwright?"

7 replies

As with any table like that, I would always use the column filtering to limit the rows and verify the data I am expecting is present. Do you have filtering enabled?

If you have configured infinite scroll not sure how you will be able to validate data. My suggestion is do what you did in selenium and go it working!

Other option if ag-grid provided option to export as csv or json ? If it does export and read file and compare

jennifer0419
jennifer0419

@jaratlanta Good suggestion, but due to some complexities in the app export won't work.

jennifer0419
jennifer0419

@.gleedo I like that. We don't have column filtering enabled, and it's not on the roadmap. But maybe I can get that squeezed in as a feature. ๐Ÿ™‚

jennifer0419
jennifer0419

Thank you both!

Filtering certainly makes a massive difference when checking values exist in a table. I'd hate to not have filtering. I can only imagine how difficult this can get, especially in the scenario you described @jennifer0419 eeeek!

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.