def testRightClickBack(self): utils.keySingle(utils.k.windows_l_key) utils.keyTypeString(self.launchername) utils.m.click(253, 170, 2) sleep(2) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.down_key) utils.keySingle(utils.k.enter_key) iconobj = self.ddedockobject.child(self.icon_deepinappstore) self.assertTrue(iconobj) self.assertTrue(iconobj.position != (0, 0)) self.assertTrue(iconobj.size != (0, 0))
def testOpenTerminalFromLauncher(self): utils.keySingle(utils.k.windows_l_key) try: launcherwin = utils.findWindow("dde-launcher") except: self.assertTrue(False, "Can't open dde-launcher") utils.keyTypeString("deepin-terminal") utils.keySingle(utils.k.enter_key) try: terminalwin = utils.findWindow(self.terminalwindowname) self.assertTrue(True) except: self.assertTrue(False, "Can't find window: %s" % self.terminalwindowname)
def testAccountsModifyUserPasswordAccept(self): accounts = Accounts() current_uid = self.session_manager.getCurrentUid() user_obj_path = accounts.FindUserById(current_uid) loginuser = User(user_obj_path) self.assertTrue(current_uid == loginuser.getUid()) self.currentUserName = loginuser.getUserName() self.assertTrue(self.currentUserName != None) ret = self.dcc.showModule("accounts") self.assertTrue(ret) curUserNameWidget = self.dcc.dccObj.child(self.currentUserName, roleName='label') self.assertTrue(curUserNameWidget != None) curUserNameWidget.click() ModifyPasswordWidget = self.dcc.dccObj.child( self.dcc.string_Modify_Password, roleName='label') self.assertTrue(ModifyPasswordWidget != None) ModifyPasswordWidget.click() NewPasswordWidget = self.dcc.dccObj.child(self.dcc.string_New_Password, roleName='password text') self.assertTrue(NewPasswordWidget != None) NewPasswordWidget.click() utils.keyTypeString(self.newpw) RepeatPasswordWidget = self.dcc.dccObj.child( self.dcc.string_Repeat_Password, roleName='password text') self.assertTrue(RepeatPasswordWidget != None) RepeatPasswordWidget.click() utils.keyTypeString(self.newpw) ModifyAcceptWidget = self.dcc.dccObj.child( self.dcc.string_Modify_Accept) self.assertTrue(ModifyAcceptWidget != None) ModifyAcceptWidget.click() do_polkit_agent() ret = self.dbus_lock.UnlockCheck(self.currentUserName, self.newpw) self.assertTrue(ret) ret = self.dbus_lock.UnlockCheck(self.currentUserName, self.oldpw) self.assertFalse(ret)
def testOpenGeditFromLauncher(self): self.dbus_launcher.Show() try: launcherwin = utils.findWindow("dde-launcher") except: self.assertTrue(False, "Can't open dde-launcher") utils.keyTypeString("gedit") utils.keySingle(utils.k.enter_key) try: geidtwin = utils.findWindow(self.geidtwindowname, comparetype="notequal") self.assertTrue(True) except: self.assertTrue(False, "Can't find window: %s" % self.geidtwindowname) time.sleep(2)
def testSetDock(self): utils.keySingle(utils.k.windows_l_key) try: launcherwin = utils.findWindow("dde-launcher") except: self.assertTrue(False, "Can't open dde-launcher") utils.keyTypeString(self.filemanagerlauncher) app = launcher.getAppObj(self.filemanagericonname) app.click(3) try: dockmenuapp = root.application('deepin-menu', '/usr/lib/deepin-menu') dockmenu = dockmenuapp.child(utils.desktop.desktopmenuname) except: self.assertTrue(False, "Can't find desktopmenu") utils.keySingle('c')
def do_polkit_agent(pw='deepin', action='Confirm'): app_name = 'Deepin Polkit Agent' polkit_agent = window.WindowState(app_name) win_polkit_agent = polkit_agent.getWindow() if None == win_polkit_agent: print("Window: %s does not exist." % app_name) else: dogtail_agent = root.application( 'dde-polkit-agent', '/usr/lib/polkit-1-dde/dde-polkit-agent') PasswordInput = dogtail_agent.child('PasswordInput') PasswordInput.click() utils.keyTypeString(pw) if action == 'Confirm': Comfirm = dogtail_agent.child('Confirm') Comfirm.click() else: Cancel = dogtail_agent.child('Cancel') Cancel.click()
def testDragIconToDock(self): utils.keySingle(utils.k.windows_l_key) try: launcherwin = utils.findWindow("dde-launcher") except: self.assertTrue(False, "Can't open dde-launcher") utils.keyTypeString("deepin-screenshot") try: launcher_icon = self.ddedockobject.child("Launcher") except: self.assertTrue(False, "Can't find launcher icon") apps = launcher.getLauncherAllApps() fromXY = launcher.getAppCenterCoor(apps[0]) toXY = utils.getDockIconCenterPoint(launcher_icon) utils.mouseDragIconToDock((int(fromXY[0]), int(fromXY[1])), toXY) time.sleep(1) self.testDeepinScreenshotExistOnDock() time.sleep(1)
def testDragBack(self): utils.keySingle(utils.k.windows_l_key) utils.keyTypeString(self.launchername) #utils.keySingle(utils.k.enter_key) utils.m.move(253, 170) sleep(3) utils.m.press(253, 170) sleep(3) while utils.m.position()[0] < 427: utils.m.move((utils.m.position()[0]+1), utils.m.position()[1]) while utils.m.position()[1] < 873: utils.m.move(utils.m.position()[0], (utils.m.position()[1]+1)) while utils.m.position()[0] < 477: sleep(0.03) utils.m.move((utils.m.position()[0]+1), utils.m.position()[1]) #utils.m.move(427, 873) sleep(2) utils.m.release(477, 873) sleep(3) iconobj = self.ddedockobject.child(self.icon_deepinappstore) self.assertTrue(iconobj) self.assertTrue(iconobj.position != (0, 0)) self.assertTrue(iconobj.size != (0, 0))
def testDragIconToDock(self): self.dbus_launcher.Show() try: launcherwin = utils.findWindow("dde-launcher") except: self.assertTrue(False, "Can't open dde-launcher") utils.keyTypeString("gedit") try: launcher_icon = self.ddedockobject.child(self.dock.string_Show_Desktop) except: self.assertTrue(False, "Can't find launcher icon") apps = launcher.getLauncherAllApps() fromXY = launcher.getAppCenterCoor(apps[0]) toXY = utils.getDockIconCenterPoint(launcher_icon) utils.mouseDragIconToDock((int(fromXY[0]), int(fromXY[1])), toXY) time.sleep(1) self.testGeditExistOnDock() time.sleep(1)
def addUser(self, username, password, operation): widget_username = self.dccObj.child(self.string_NewAccount_Username) widget_password = self.dccObj.child(self.string_NewAccount_Password) widget_repeat_password = self.dccObj.child( self.string_NewAccount_Repeat_password) widget_username.click() utils.keyTypeString(username) widget_password.click() utils.keyTypeString(password) widget_repeat_password.click() utils.keyTypeString(password) if operation == self.string_NewAccount_Cancel: widget_cancel = self.dccObj.child(self.string_NewAccount_Cancel, roleName='push button') widget_cancel.click() self.page_deep -= 1 elif operation == self.string_NewAccount_Create: widget_create = self.dccObj.child(self.string_NewAccount_Create, roleName='push button') widget_create.click() polkit_agent.do_polkit_agent() self.page_deep -= 1