Index: tst_ServiceShutdown/test.py =================================================================== diff -u -r40df2a58a855b561c1ca8dabd3b272ac48b8924e -r929c42f19c662c57ae264d200658fb1690353008 --- tst_ServiceShutdown/test.py (.../test.py) (revision 40df2a58a855b561c1ca8dabd3b272ac48b8924e) +++ tst_ServiceShutdown/test.py (.../test.py) (revision 929c42f19c662c57ae264d200658fb1690353008) @@ -11,9 +11,8 @@ # date 2019/11/20 # author Behrouz NematiPour # - +import utils import names -import time import globals import denaliMessages @@ -22,61 +21,61 @@ # This is only checking the functionality exists and it's working # ################################################################################ -def test_MainMenu_CurrentItem(vSRSUI = ""): - #test.compare(waitForObjectExists(names.o_mainMenu).currentIndex, 0) +def test_MainMenu_CurrentItem(vSRSUI=""): + # test.compare(waitForObjectExists(names.o_mainMenu).currentIndex, 0) test.compare(str(waitForObjectExists(names.o_mainMenu).currentTitle), "Treatment", globals.SRSUI(vSRSUI)) -def gotoScreenNtest_Contains_PowerOffButton(vSRSUI = ""): - mouseClick (waitForObjectExists(names.o_mainMenu_settings )) - test.compare(waitForObjectExists(names.o_settingsHome ).visible, True, globals.SRSUI(vSRSUI)) +def gotoScreenNtest_Contains_PowerOffButton(vSRSUI=""): + mouseClick (waitForObjectExists(names.o_mainMenu_settings)) + test.compare(waitForObjectExists(names.o_settingsHome).visible, True, globals.SRSUI(vSRSUI)) -def gotoScreenNtest_Contains_TreatmentHome(vSRSUI = ""): +def gotoScreenNtest_Contains_TreatmentHome(vSRSUI=""): mouseClick (waitForObjectExists(names.o_mainMenu_treatment)) test.compare(waitForObjectExists(names.o_treatmentHome).visible, True, globals.SRSUI(vSRSUI)) -def showNtest_PowerOffDialog(vSRSUI = ""): +def showNtest_PowerOffDialog(vSRSUI=""): denaliMessages.show_PowerOffDialog() test_PowerOffDialog(vSRSUI) -def hideNtest_PowerOffDialog(vSRSUI = ""): +def hideNtest_PowerOffDialog(vSRSUI=""): denaliMessages.hide_PowerOffDialog() test_PowerOffButton(vSRSUI) -def showNtest_PowerOffNotificationDialog(vSRSUI = ""): +def showNtest_PowerOffNotificationDialog(vSRSUI=""): mSRSUI = globals.SRSUI(vSRSUI) denaliMessages.show_PowerOffNotificationDialog() test.compare(str(waitForObjectExists(names.o_poweroff_notification).baseUrl.path), "/dialogs/AutoHideInfo.qml", mSRSUI + " - Dialog") constantPartOfTheMessage = "System is shutting down" test.compare(str(waitForObjectExists(names.o_poweroff_notification).text)[0:len(constantPartOfTheMessage)], constantPartOfTheMessage, mSRSUI + " - Message Text") - time.sleep(5) # dialog timeout - time.sleep(1) # animation transition + utils.waitForGUI(5) # dialog timeout + utils.waitForGUI(1) # animation transition -def showNtest_PowerOffRejectionDialog(vSRSUI = ""): +def showNtest_PowerOffRejectionDialog(vSRSUI=""): mSRSUI = globals.SRSUI(vSRSUI) denaliMessages.show_PowerOffRejectionDialog() test.compare(str(waitForObjectExists(names.o_poweroff_rejection).baseUrl.path), "/dialogs/AutoHideInfo.qml", mSRSUI + " - Dialog") - constantPartOfTheMessage = "Cannot shutdown during " # there might be the reason, concatenated at the end of the string. + constantPartOfTheMessage = "Cannot shutdown during " # there might be the reason, concatenated at the end of the string. test.compare(str(waitForObjectExists(names.o_poweroff_rejection).text)[0:len(constantPartOfTheMessage)], constantPartOfTheMessage, mSRSUI + " - Message Text") - time.sleep(2) # dialog timeout - time.sleep(1) # animation transition + utils.waitForGUI(2) # dialog timeout + utils.waitForGUI(1) # animation transition -def test_PowerOffButton(vSRSUI = ""): +def test_PowerOffButton(vSRSUI=""): test.compare(waitForObjectExists(names.o_poweroffButton).visible, True, globals.SRSUI(vSRSUI)) -def test_PowerOffDialog(vSRSUI = ""): +def test_PowerOffDialog(vSRSUI=""): test.compare(waitForObjectExists(names.o_modalDialog).visible, True, globals.SRSUI(vSRSUI)) -def testNclick_ShutdownButton_onPowerOffConfirm(vSRSUI = ""): +def testNclick_ShutdownButton_onPowerOffConfirm(vSRSUI=""): test.compare(waitForObjectExists(names.o_poweroff_shutdown).visible, True, globals.SRSUI(vSRSUI)) mouseClick (waitForObjectExists(names.o_poweroff_shutdown)) - time.sleep (1) # Wait for the animation + utils.waitForGUI (1) # Wait for the animation -def testNclick_CancelButton_onPowerOffConfirm(vSRSUI = ""): +def testNclick_CancelButton_onPowerOffConfirm(vSRSUI=""): test.compare(waitForObjectExists(names.o_poweroff_cancel).visible, True, globals.SRSUI(vSRSUI)) mouseClick (waitForObjectExists(names.o_poweroff_cancel)) - time.sleep (1) # Wait for the animation + utils.waitForGUI (1) # Wait for the animation def main(): # Start the Application @@ -86,7 +85,7 @@ test_MainMenu_CurrentItem(535) # 028 : The Home Screen shall display a "Settings" button. - test.compare(str(waitForObjectExists(names.o_mainMenu_settings ).text.text), "Settings", globals.SRSUI(28)) + test.compare(str(waitForObjectExists(names.o_mainMenu_settings).text.text), "Settings", globals.SRSUI(28)) # 029 : Upon "Settings" button depress on the Home Screen; the UI shall navigate the user to the Device Settings Screen. gotoScreenNtest_Contains_PowerOffButton(29)