Skip to content

Tweak tests - #3948

Merged
nstepien merged 1 commit into
mainfrom
better-tests
Feb 4, 2026
Merged

nstepien merged 1 commit into
mainfrom
better-tests

Conversation

@nstepien

@nstepien nstepien commented Feb 4, 2026 •

Copy link
Copy Markdown
Collaborator
  • more await expect.element()
  • zero expect.poll() left
  • zero .all() left
  • fewer .elements()
  • tweaked vitest config

@nstepien nstepien self-assigned this Feb 4, 2026
? firefoxCI
: firefox;

await expect.element(grid).toHaveStyle({ gridTemplateColumns });

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷‍♂️

This doesn't work:

await expect.element(grid).toHaveStyle(
  expect.toBeOneOf([
    { gridTemplateColumns: chrome },
    { gridTemplateColumns: firefox },
    { gridTemplateColumns: firefoxCI },
  ])
);

This also doesn't work:

await expect.element(grid).toHaveStyle({
  gridTemplateColumns: expect.toBeOneOf([chrome, firefox, firefoxCI])
});

This DOES work, at runtime, but it seems like there are bugs with vitest's types

await expect
  .element(grid)
  .toBeOneOf([
    expect.toHaveStyle({ gridTemplateColumns: chrome }),
    expect.toHaveStyle({ gridTemplateColumns: firefox }),
    expect.toHaveStyle({ gridTemplateColumns: firefoxCI })
  ]);

Comment thread test/globals.d.ts
@@ -1,3 +1,7 @@
declare global {
const __IS_CI__: boolean;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type is only available in test files, thanks to compartmentalized tsconfigs.

Comment thread vite.config.ts
viewport
},
launchOptions: {
channel: 'chromium'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotta have separate providers so we can set this channel for chrome

Comment thread vite.config.ts
{
browser: 'chromium',
provider: playwright({
actionTimeout: 1000,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added actionTimeout.

Comment thread vite.config.ts
viewport
}
}),
instances: [{ browser: 'chromium' }, { browser: 'firefox' }],

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fileParallelism was missing here

@nstepien
nstepien marked this pull request as ready for review February 4, 2026 14:42
it('should merges cells', async () => {
await setupColSpan();
// header
expect(getHeaderCells()).toHaveLength(13);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point we should use getHeaderCellsNew

Comment thread test/browser/column/colSpan.test.ts Resolved
expect(topSummarryRow1[7]).toHaveAttribute('aria-colindex', '8');
expect(topSummarryRow1[7]).toHaveAttribute('aria-colspan', '2');
expect(topSummarryRow1[7]).toHaveStyle({
await expect.element(topSummarryRow1[7]).toHaveAttribute('aria-colindex', '8');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be nice if we can use nth

Comment thread vite.config.ts
}
}),
instances: [{ browser: 'chromium' }, { browser: 'firefox' }],
instances: getInstances(),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using the new headless is better for accuracy, as it's closer to the real browser.
And tests are fast enough, so we don't really need the speed benefit of old headless.

@nstepien
nstepien merged commit d7b1799 into main Feb 4, 2026
1 check passed
@nstepien
nstepien deleted the better-tests branch February 4, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants