Skip to content

Focus chrome after starting in system tests - #12352

Merged
seanbudd merged 6 commits into
masterfrom
better-systest-logging
May 5, 2021
Merged

Focus chrome after starting in system tests#12352
seanbudd merged 6 commits into
masterfrom
better-systest-logging

Conversation

@seanbudd

@seanbudd seanbudd commented Apr 29, 2021

Copy link
Copy Markdown
Member

Link to issue number:

None

Summary of the issue:

As discussed in #12293, our systems fail randomly. Usually this is due to another window stealing focus, such as the taskbar or Docker. As system tests are run locally, we shouldn't be killing these processes.

Description of how this pull request fixes the issue:

  • Use windows API to make the chrome window gain focus
  • Adds logging that lists the foreground window and open windows if chrome doesn't gain focus
  • Removes extra sleep time after starting NVDA

Testing strategy:

Run the system tests locally, and prevent chrome from gaining focus by holding alt+tab

Here's an example log from a local test:

checkbox labelled by inner element :: A checkbox labelled by an in... | FAIL |
Unable to focus Chrome.
Foreground Window: speechSpyGlobalPlugin.py (Working Tree) - nvda - Visual Studio Code.
Open Windows: ['speechSpyGlobalPlugin.py (Working Tree) - nvda - Visual Studio Code', 'NVDA Browser Test Case - Google Chrome', 'C:\\nvda\\testOutput\\system', 'Calculator', 'Calculator', 'Settings', 'Settings', 'Microsoft Text Input Application', 'Program Manager']

Known issues with pull request:

None

Change log entries:

None

Code Review Checklist:

  • Pull Request description is up to date.
  • Unit tests.
  • System (end to end) tests.
  • Manual tests.
  • User Documentation.
  • Change log entry.
  • Context sensitive help for GUI changes.

@seanbudd seanbudd self-assigned this Apr 29, 2021
@seanbudd
seanbudd requested a review from a team as a code owner April 29, 2021 04:33
@seanbudd
seanbudd requested a review from michaelDCurran April 29, 2021 04:33
@seanbudd
seanbudd marked this pull request as draft April 29, 2021 05:17
@seanbudd
seanbudd force-pushed the better-systest-logging branch from 289c1ff to 938a56d Compare April 29, 2021 05:28
@seanbudd
seanbudd marked this pull request as ready for review April 29, 2021 05:29
Comment thread tests/system/libraries/ChromeLib.py Outdated
Comment thread tests/system/libraries/ChromeLib.py Outdated

@michaelDCurran michaelDCurran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It may be an idea to add some kind of per-test unique value to testCaseTitle, because at the moment it is just "NVDA Browser Test Case". There is a small possibility the code could focus the wrong Chrome window, if one happened to be left arrround.

@seanbudd
seanbudd requested a review from michaelDCurran April 30, 2021 01:54
michaelDCurran
michaelDCurran previously approved these changes Apr 30, 2021
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 4d87770046

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit b858e98797

@seanbudd
seanbudd requested a review from michaelDCurran April 30, 2021 04:07
@seanbudd
seanbudd dismissed michaelDCurran’s stale review April 30, 2021 04:09

I've changed hash -> abs(hash()) and changed the filter for the window search

@seanbudd
seanbudd merged commit bacd1ab into master May 5, 2021
@seanbudd
seanbudd deleted the better-systest-logging branch May 5, 2021 06:02
@nvaccessAuto nvaccessAuto added this to the 2021.1 milestone May 5, 2021
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.

5 participants