Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: When using Promise.all() with multiple locator assertions, playwright report does not record all the steps. #30901

Closed
tui95 opened this issue May 20, 2024 · 3 comments
Assignees
Labels

Comments

@tui95
Copy link

tui95 commented May 20, 2024

Version

1.44.0

Steps to reproduce

  1. Add the following test
import { expect, test } from "@playwright/test"

test("Promise.all() with expect().toBeVisible()", async ({ page }) => {
    await page.setContent(`
    <!DOCTYPE html>
    <html>
    <head>
        <title>HTML Table Generator</title> 
        <style>
            table {
                border:1px solid #b3adad;
                border-collapse:collapse;
                padding:5px;
            }
            table th {
                border:1px solid #b3adad;
                padding:5px;
                background: #f0f0f0;
                color: #313030;
            }
            table td {
                border:1px solid #b3adad;
                text-align:center;
                padding:5px;
                background: #ffffff;
                color: #313030;
            }
        </style>
    </head>
    <body>
        <table>
            <thead>
                <tr>
                    <th>Header 1</th>
                    <th>Header 2</th>
                    <th>Header 3</th>
                    <th>Header 4</th>
                    <th>Header 5</th>
                    <th>Header 6</th>
                    <th>Header 7</th>
                    <th>Header 8</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
            </tbody>
        </table>
    </body>
    </html>
    `)
    const headers = ["Header 1", "Header 2", "Header 3", "Header 4", "Header 5", "Header 6", "Header 7", "Header 8"]
    await Promise.all(headers.map(async (header) => {
        await expect(page.locator(`table thead tr th:text-is("${header}")`)).toBeVisible()
    }))
})
  1. Run the test using the option --trace=on to keep the report even when the test succeeds.
npx playwright test --trace=on
  1. Open the report with
npx playwright show-report
  1. Look at the assertion steps.

Expected behavior

The report should list all assertion steps and there should be in total 8 assertions since there are 8 headers.

Actual behavior

The report lists only 7 assertion steps.
playwright-report.zip
Screenshot 2567-05-20 at 13 26 30

Additional context

No response

Environment

System:
  OS: macOS 14.4.1
  CPU: (8) arm64 Apple M3
  Memory: 86.06 MB / 16.00 GB
Binaries:
  Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
  npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
IDEs:
  VSCode: 1.89.1 - /usr/local/bin/code
Languages:
  Bash: 5.2.26 - /opt/homebrew/bin/bash
npmPackages:
  @playwright/test: ^1.44.0 => 1.44.0
@yury-s
Copy link
Member

yury-s commented May 21, 2024

@tui95, can you try with @next? It should be fixed there already.

@yury-s yury-s closed this as completed May 21, 2024
@tui95
Copy link
Author

tui95 commented May 21, 2024

@yury-s I tried with the @next version and the issue has been fixed. Thank you.

@yury-s
Copy link
Member

yury-s commented May 21, 2024

Thanks for confirming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants