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

chore: make tests strict (1) #27731

Merged
merged 1 commit into from
Oct 23, 2023
Merged

Conversation

pavelfeldman
Copy link
Member

No description provided.

@github-actions

This comment has been minimized.

@@ -562,9 +562,9 @@ it('should have popup requests', async ({ contextFactory, server }, testInfo) =>
await popup.waitForLoadState();
const log = await getLog();

expect(log.pages.length).toBe(2);
expect(log.pages!.length).toBe(2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we just make pages non-nullable?

@@ -33,19 +33,19 @@ test.describe('cli codegen', () => {
recorder.trustedClick(),
]);

expect.soft(sources.get('JavaScript').text).toContain(`
expect.soft(sources.get('JavaScript')!.text).toContain(`
Copy link
Contributor

Choose a reason for hiding this comment

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

This is just sad...

@@ -172,8 +172,8 @@ it.describe('pause', () => {
const button = await page.waitForSelector('button');
const box1 = await button.boundingBox();

const x1 = box1.x + box1.width / 2;
const y1 = box1.y + box1.height / 2;
const x1 = box1!.x + box1!.width / 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is also painful for our users.

expect(await root2.$eval(`css=#target`, e => e.textContent)).toBe('Hello from root2');
expect(await root2.$(`css:light=#target`)).toBe(null);
const root2Shadow = await root2.evaluateHandle(r => r.shadowRoot);
const root2Shadow = (await root2.evaluateHandle(r => r.shadowRoot) as ElementHandle<ShadowRoot>)!;
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps the following will also work?

Suggested change
const root2Shadow = (await root2.evaluateHandle(r => r.shadowRoot) as ElementHandle<ShadowRoot>)!;
const root2Shadow = await root2.evaluateHandle(r => r.shadowRoot!);

@@ -236,7 +237,7 @@ it('should work with *', async ({ page }) => {
expect(await page.$$eval('div *', els => els.length)).toBe(2);
expect(await page.$$eval('* > *', els => els.length)).toBe(6);

const body = await page.$('body');
const body = (await page.$('body')) as ElementHandle<HTMLBodyElement>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const body = (await page.$('body')) as ElementHandle<HTMLBodyElement>;
const body = (await page.$('body'))!;

@github-actions

This comment has been minimized.

@pavelfeldman pavelfeldman merged commit 5752a28 into microsoft:main Oct 23, 2023
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Test results for "tests 1"

1 failed
❌ [playwright-test] › loader.spec.ts:755:5 › should resolve .js import to .tsx file in non-ESM mode for components

10 flaky ⚠️ [chromium] › library/tracing.spec.ts:239:5 › should not include trace resources from the previous chunks
⚠️ [firefox] › library/fetch-proxy.spec.ts:30:3 › context request should pick up proxy credentials
⚠️ [firefox] › library/tracing.spec.ts:239:5 › should not include trace resources from the previous chunks
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:21:5 › should watch files
⚠️ [chromium] › library/tracing.spec.ts:239:5 › should not include trace resources from the previous chunks
⚠️ [playwright-test] › ui-mode-test-ct.spec.ts:184:5 › should watch component
⚠️ [playwright-test] › ui-mode-test-ct.spec.ts:113:5 › should run component tests after editing test and component
⚠️ [chromium] › components/splitView.spec.tsx:65:5 › drag resize
⚠️ [webkit] › library/browsercontext-reuse.spec.ts:50:1 › should reset serviceworker
⚠️ [playwright-test] › ui-mode-test-ct.spec.ts:55:5 › should run component tests after editing test

25935 passed, 603 skipped
✔️✔️✔️

Merge workflow run.

Germandrummer92 pushed a commit to OctoMind-dev/playwright that referenced this pull request Oct 27, 2023
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