How to use selecttab method in pyatom

Best Python code snippet using pyatom_python

test_exodus_state.py

Source:test_exodus_state.py Github

copy

Full Screen

1#!/usr/bin/env python22#* This file is part of the MOOSE framework3#* https://www.mooseframework.org4#*5#* All rights reserved, see COPYRIGHT for full restrictions6#* https://github.com/idaholab/moose/blob/master/COPYRIGHT7#*8#* Licensed under LGPL 2.1, please see LICENSE for details9#* https://www.gnu.org/licenses/lgpl-2.1.html10from PyQt5 import QtCore, QtWidgets11from peacock.utils import Testing12class TestExodusState(Testing.PeacockAppImageTestCase):13 """14 Test for ExodusViewer state when executable is re-run.15 """16 qapp = QtWidgets.QApplication([])17 def testState(self):18 """19 Tests that re-executing doesn't change the state of the exodus viewer.20 """21 # The tabs to switch between22 exodus = self._app.main_widget.tab_plugin.ExodusViewer23 execute = self._app.main_widget.tab_plugin.ExecuteTabPlugin24 # Run and check that basic results show up25 self.execute()26 self.selectTab(exodus)27 Testing.process_events(1)28 self.assertImage("testDefault.png")29 # Select the mesh30 mesh_plugin = exodus.currentWidget().MeshPlugin31 mesh_plugin.ViewMeshToggle.setCheckState(QtCore.Qt.Checked)32 mesh_plugin.ViewMeshToggle.clicked.emit(True)33 self.assertImage("testMeshOn.png", allowed=0.98)34 # Re-run and check results again35 self.selectTab(execute)36 self.execute()37 self.selectTab(exodus)38 self.assertImage("testMeshOn.png", allowed=0.98)39 def testTabChange(self):40 """41 Tests that changing tabs chan42 """43 # The tabs to switch between44 exodus = self._app.main_widget.tab_plugin.ExodusViewer45 execute = self._app.main_widget.tab_plugin.ExecuteTabPlugin46 # Execute tab active, but nothing run yet (both timers should be inactive)47 self.assertFalse(self._window._timers['initialize'].isActive())48 self.assertFalse(self._window._timers['update'].isActive())49 # Switch to Exodus tabs (initialize timer should be running)50 self.selectTab(exodus)51 self.assertTrue(self._window._timers['initialize'].isActive())52 self.assertFalse(self._window._timers['update'].isActive())53 # Execute (update timer should be running, initialize should be off)54 self.execute()55 self.assertFalse(self._window._timers['initialize'].isActive())56 self.assertTrue(self._window._timers['update'].isActive())57 # Switch to Execute tab (both timers should be disabled)58 self.selectTab(execute)59 self.assertFalse(self._window._timers['initialize'].isActive())60 self.assertFalse(self._window._timers['update'].isActive())61 def testColorbarState(self):62 """63 Test that re-running the simulation maintains colorbar state.64 """65 # The tabs to switch between66 exodus = self._app.main_widget.tab_plugin.ExodusViewer67 execute = self._app.main_widget.tab_plugin.ExecuteTabPlugin68 cbar_plugin = exodus.currentWidget().ColorbarPlugin69 # Run and check that basic results show up70 self.execute()71 self.selectTab(exodus)72 Testing.process_events(1)73 # Disable colorbar74 cbar_plugin.ColorBarToggle.setCheckState(QtCore.Qt.Unchecked)75 cbar_plugin.ColorBarToggle.clicked.emit(True)76 self.assertImage("testColorbarOff.png", allowed=0.98)77 # Re-run and check results again78 self.selectTab(execute)79 self.execute()80 self.selectTab(exodus)81 Testing.process_events(1)82 self.assertImage("testColorbarOff.png", allowed=0.98)83if __name__ == '__main__':...

Full Screen

Full Screen

pagetablist.py

Source:pagetablist.py Github

copy

Full Screen

1#!/usr/bin/env python2#3# Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp4#5# Description:6# This set of test scripts will test the LDTP framework for correct7# functioning of its APIs. This is a Regression Suite.8#9# Author:10# Prashanth Mohan <prashmohan@gmail.com>11#12#13# This test script is free software; you can redistribute it and/or14# modify it under the terms of the GNU Library General Public15# License as published by the Free Software Foundation; either16# version 2 of the License, or (at your option) any later version.17#18# This library is distributed in the hope that it will be useful,19# but WITHOUT ANY WARRANTY; without even the implied warranty of20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU21# Library General Public License for more details.22#23# You should have received a copy of the GNU Library General Public24# License along with this library; if not, write to the25# Free Software Foundation, Inc., 59 Temple Place - Suite 330,26# Boston, MA 02111-1307, USA.27#28from regression import *29import random, os30try:31 check_open('gedit')32except:33 raise34data_object = LdtpDataFileParser (datafilename)35tab_count = data_object.gettagvalue ('tabcount')36if tab_count == []:37 tab_count = 538else:39 tab_count = int(tab_count[0])40pref = '*Pref*'41log ('tab list count','teststart')42try:43 open_pref()44 count = gettabcount (pref,'ptl0')45 if count != tab_count:46 log ('number of tabs do not tally','cause')47 raise LdtpExecutionError (str (traceback.format_exc ()))48except:49 testfail ('tab list count')50 raise LdtpExecutionError (str (traceback.format_exc ()))51testpass ('tab list count')52log ('selecttab','teststart')53try:54 open_pref()55 obj = [ x for x in getobjectlist(pref) if x.startswith ('ptab')]56 if selecttab (pref,'ptl0','View') == 0:57 log ('Unable to select tab','cause')58 raise LdtpExecutionError (str (traceback.format_exc ()))59 if selecttab (pref,'ptl0','Editor') == 0:60 log ('Unable to select tab','cause')61 raise LdtpExecutionError (str (traceback.format_exc ()))62 if selecttab (pref,'ptl0','Font & Colors') == 0:63 log ('Unable to select tab','cause')64 raise LdtpExecutionError (str (traceback.format_exc ()))65 if selecttab (pref,'ptl0','Syntax Highlighting') == 0:66 log ('Unable to select tab','cause')67 raise LdtpExecutionError (str (traceback.format_exc ()))68 if selecttab (pref,'ptl0','Plugins') == 0:69 log ('Unable to select tab','cause')70 raise LdtpExecutionError (str (traceback.format_exc ()))71# for tab in obj:72# if selecttab (pref,'ptl0',tab[4:]) == 0:73# log ('Unable to select tab','cause')74# raise LdtpExecutionError (str (traceback.format_exc ()))75except:76 testfail ('selecttab')77 raise LdtpExecutionError (str (traceback.format_exc ()))78testpass ('selecttab')79log ('selecttabindex','teststart')80try:81 for ind in range (tab_count):82 if selecttabindex (pref,'ptl0',ind) == 0:83 log ('Unable to select tab','cause')84 raise LdtpExecutionError (str (traceback.format_exc ()))85 click (pref,'btnClose')86 waittillguinotexist (pref)87except:88 testfail ('selecttabindex')89 raise LdtpExecutionError (str (traceback.format_exc ()))...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful