← Back to Discord Forum

Slow Mo or waitForLoadState()? Which is better to use?

For tests that run locally but fail without slow mo or waitForLoadState, is it better to user slow mo or use the below waits?

Just to note, I use locators in all my tests.

await page.waitForLoadState('domcontentloaded', { timeout: 15000 });
      await page.waitForLoadState('load', { timeout: 30000 });
      await page.waitForLoadState('networkidle', { timeout: 5000 });

This thread is trying to answer question "For tests that run locally but fail without slow mo or waitForLoadState, is it better to use slow mo or the below waits?"

6 replies

we absolutely discourage both. To be able to assist you we need to know how your tests look like, what the errors are etc. Also make sure to follow our best practises: https://playwright.dev/docs/best-practices

Here is a portion of my tests. I am not using live data but mocks for the api calls.

it('should display the total patients number requiring rec', async ({ page }) => {
      const el = page.getByText('15 patients require reconcillation');
    describe('When viewing tables', function() {
      it('should have columns', async ({ page }) => {
        const el = page.getByRole('columnheader');
        const text = ['EMR MRN', 'Name', 'DOB', 'Gender', 'Address', 'Match'];
      it('should have rows', async ({ page }) => {
        const el = page.locator('tr');
        // 2 rows + header row
      it('should show patient data', async ({ page }) => {
        const el = page.getByRole('cell');
        const text = [
          '5 Balling Hill Ave, Beltsville MD, 12324',
          'Doe, John',                                    

You have no await at the toHaveText, toHaveCount and toBeVisible calls.

See here how to prevent this during linting: https://playwright.dev/docs/best-practices#lint-your-tests


I am using .mjs files.... will https://typescript-eslint.io/rules/no-floating-promises work on .mjs files?

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.