# -*- coding: utf-8 -*- ## # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_ServiceShutdown # date 2019/11/20 # author Behrouz NematiPour # import utils import names import globals import denaliMessages ################################################################################ # This test need to be changed when the Service screen has been implemented # # This is only checking the functionality exists and it's working # ################################################################################ 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)) utils.waitForGUI() test.compare(waitForObjectExists(names.o_settingsHome).visible, True, globals.SRSUI(vSRSUI)) def gotoScreenNtest_Contains_TreatmentHome(vSRSUI=""): mouseClick (waitForObjectExists(names.o_mainMenu_treatment)) utils.waitForGUI() test.compare(waitForObjectExists(names.o_treatmentHome).visible, True, globals.SRSUI(vSRSUI)) def showNtest_PowerOffDialog(vSRSUI=""): denaliMessages.show_PowerOffDialog() test_PowerOffDialog(vSRSUI) def hideNtest_PowerOffDialog(vSRSUI=""): denaliMessages.hide_PowerOffDialog() test_PowerOffButton(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") utils.waitForGUI(5) # dialog timeout utils.waitForGUI(1) # animation transition 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. test.compare(str(waitForObjectExists(names.o_poweroff_rejection).text)[0:len(constantPartOfTheMessage)], constantPartOfTheMessage, mSRSUI + " - Message Text") utils.waitForGUI(2) # dialog timeout utils.waitForGUI(1) # animation transition def test_PowerOffButton(vSRSUI=""): test.compare(waitForObjectExists(names.o_poweroffButton).visible, True, globals.SRSUI(vSRSUI)) def test_PowerOffDialog(vSRSUI=""): test.compare(waitForObjectExists(names.o_modalDialog).visible, True, globals.SRSUI(vSRSUI)) def testNclick_ShutdownButton_onPowerOffConfirm(vSRSUI=""): test.compare(waitForObjectExists(names.o_poweroff_shutdown).visible, True, globals.SRSUI(vSRSUI)) mouseClick (waitForObjectExists(names.o_poweroff_shutdown)) utils.waitForGUI (1) # Wait for the animation def testNclick_CancelButton_onPowerOffConfirm(vSRSUI=""): test.compare(waitForObjectExists(names.o_poweroff_cancel).visible, True, globals.SRSUI(vSRSUI)) mouseClick (waitForObjectExists(names.o_poweroff_cancel)) utils.waitForGUI (1) # Wait for the animation def main(): utils.tstStart() # Start the Application startApplication("denaliSquish") utils.waitForGUI(1) # 535 : The "Treatment" button shall be selected by default on the Home Screen. 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)) utils.waitForGUI() # 029 : Upon "Settings" button depress on the Home Screen; the UI shall navigate the user to the Device Settings Screen. gotoScreenNtest_Contains_PowerOffButton(29) # 514 : The UI shall display a "Power Off Confirmation" screen when the HD Device requests power off. showNtest_PowerOffDialog(514) # 556 : The UI shall hide the "Power Off Confirmation" screen after 1 minute inactivity, waiting for user interaction (upon HD Device messaging). hideNtest_PowerOffDialog(556) # 015 : The "Power Off Confirmation" screen shall display a "CANCEL" button. showNtest_PowerOffDialog(514) testNclick_CancelButton_onPowerOffConfirm(15) # 016 : Upon "CANCEL" button depress, the UI shall navigate the user to its previous screen. test_PowerOffButton(16) # 017 : The "Power Off Confirmation" screen shall display a "SHUTDOWN" button. showNtest_PowerOffDialog(514) testNclick_ShutdownButton_onPowerOffConfirm(17) # 566 : The UI shall display the "Power Off Notification" Dialog when the HD Device confirms power off. showNtest_PowerOffNotificationDialog(566) # 567 : The UI shall display the "Power Off Rejection" Dialog when the HD Device rejects power off. showNtest_PowerOffRejectionDialog(567) # 534 : The "Treatment" button shall be selected by default on the Home Screen. gotoScreenNtest_Contains_TreatmentHome(534) utils.tstDone()