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(null): null safety fixes for assorted test helpers #3462

Merged
merged 12 commits into from
Oct 19, 2020

Conversation

dbjorge
Copy link
Contributor

@dbjorge dbjorge commented Oct 13, 2020

Description of changes

This PR fixes all yarn null:find issues in common test helpers, plus all files yarn null:autoadd picked up.

New yarn null:progress:

Web strict-null progress

47% complete (635/1362 non-test files)

Contribute at #2869. Last update: Tue Oct 13 2020

Pull request checklist

  • Addresses an existing issue: Codebase should use strict null checks #2869
  • Ran yarn fastpass
  • Added/updated relevant unit test(s) (and ran yarn test)
  • Verified code coverage for the changes made. Check coverage report at: <rootDir>/test-results/unit/coverage
  • PR title AND final merge commit title both start with a semantic tag (fix:, chore:, feat(feature-name):, refactor:). See CONTRIBUTING.md.
  • [n/a] (UI changes only) Added screenshots/GIFs to description above
  • [n/a] (UI changes only) Verified usability with NVDA/JAWS

@dbjorge dbjorge requested a review from a team as a code owner October 13, 2020 21:14
state: 'attached',
});
}))!;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the most interesting fix. The contract for Playwright's waitForSelector is that it will throw rather than returning null if it can't find an element, except that if you explicitly pass options like {state: 'detached'}, then it will return null in the success path. So waitForSelectorInShadowRoot is allowed to return null (since someone could pass through that option), but waitForShadowRoot gets to assume that waitForSelector is not returning null (since it's passing state: 'attached' always)

"androidSetupStepComponentProvider": Object {
"detect-adb": [Function],
"prompt-locate-adb": [Function],
},
"closeApp": null,
Copy link
Contributor

Choose a reason for hiding this comment

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

Glad to see these going away--it was not a good code smell to have to change a bunch of downstream test classes when adding a field to the properties

@dbjorge dbjorge merged commit 7e0f6aa into microsoft:master Oct 19, 2020
@dbjorge dbjorge deleted the null-20201016 branch October 19, 2020 18:16
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.

3 participants