Skip to content

Commit

Permalink
System tests: run Chrome in kiosk mode to stop treeGrid test failing (n…
Browse files Browse the repository at this point in the history
…vaccess#12023)

* Chrome system tests: run Chrome in kiosk mode, which removes the need to press f6 1 or more times to move from the Chrome to the document.

* Linting

* Force another pr build.
  • Loading branch information
michaelDCurran authored Feb 3, 2021
1 parent 376780f commit 65e183b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/system/libraries/ChromeLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def start_chrome(self, filePath):
" --force-renderer-accessibility"
" --suppress-message-center-popups"
" --disable-notifications"
" -kiosk"
f' "{filePath}"',
shell=True,
alias='chromeAlias',
Expand Down Expand Up @@ -92,18 +93,19 @@ def _wasStartMarkerSpoken(self, speech: str):
marker = ChromeLib._beforeMarker
return marker in speech and documentIndex < speech.index(marker)

def _moveToStartMarker(self, spy):
""" Press F6 until the start marker is spoken
def _waitForStartMarker(self, spy, lastSpeechIndex):
""" Wait until the page loads and NVDA reads the start marker.
@param spy:
@type spy: SystemTestSpy.speechSpyGlobalPlugin.NVDASpyLib
@return: None
"""
for i in range(10): # set a limit on the number of tries.
# Small changes in Chrome mean the number of tab presses to get into the document can vary.
builtIn.sleep("0.5 seconds") # ensure application has time to receive input
actualSpeech = self.getSpeechAfterKey('f6')
spy.wait_for_speech_to_finish()
actualSpeech = spy.get_speech_at_index_until_now(lastSpeechIndex)
if self._wasStartMarkerSpoken(actualSpeech):
break
lastSpeechIndex = spy.get_last_speech_index()
else: # Exceeded the number of tries
spy.dump_speech_to_log()
builtIn.fail(
Expand Down Expand Up @@ -133,11 +135,7 @@ def prepareChrome(self, testCase: str) -> None:
# it is ready.
applicationTitle = f"{self._testCaseTitle}"
appTitleIndex = spy.wait_for_specific_speech(applicationTitle, afterIndex=lastSpeechIndex)
spy.wait_for_speech_to_finish()

afterTitleSpeech = spy.get_speech_at_index_until_now(appTitleIndex)
if not self._wasStartMarkerSpoken(afterTitleSpeech):
self._moveToStartMarker(spy)
self._waitForStartMarker(spy, appTitleIndex)


@staticmethod
Expand Down

0 comments on commit 65e183b

Please sign in to comment.