예제 #1
0
    def test_MalformedPGSimParameter(self):
        """
        Verifies requirement GEN000003. Check that bad inputs are handled 
        correctly.
        """
        # Setup Mock Object
        self.common.SetupMox(self)

        testharness.getOptDebugFlag().AndReturn(True)
        testharness.getOptParam().AndReturn({'pgsim': self.badBooleanName})
        testharness.getOptExternal().AndReturn(self.external)
        testharness.getOptImplantable().AndReturn(self.implantable)
        testharness.getOptEnv().AndReturn(self.env)
        self.mocker.ReplayAll()

        self.trace('GEN000003')
        try:
            tc = komodo.getTestContext()
            self.verifyFailed(msg="Did not catch the UnrecognizedCommandLineParamError exception.")

        except komodo.UnrecognizedCommandLineParamError:
            self.verified(msg="UnrecognizedCommandLineParamError was raised")	    

        except:
            self.verifyFailed(msg="Did not catch the UnrecognizedCommandLineParamError exception.")	
        self.mocker.VerifyAll()
        
        # Reset Mock Object
        self.common.UnsetMox(self)    
예제 #2
0
    def test_EnvironmentNameIsNotSpecifiedRaisesError(self):
        """
        Verifies requirement GEN000003. Checks that the environment name must 
        be specified in the command line parameters.
        """
        # Setup Mock Object
        self.common.SetupMox(self)

        testharness.getOptDebugFlag().AndReturn(True)
        testharness.getOptParam().AndReturn(None)
        testharness.getOptExternal().AndReturn(self.external)
        testharness.getOptImplantable().AndReturn(self.implantable)
        testharness.getOptEnv().AndReturn(None)

        self.mocker.ReplayAll()

        self.trace('GEN000003')
        try:
            tc = komodo.getTestContext()
            self.verifyFailed(msg="Did not catch the MissingCommandLineParamError exception.")
            
        except komodo.MissingCommandLineParamError:
            self.verified(msg="MissingCommandLineParamError was raised")            	

        except:
            self.verifyFailed(msg="Did not catch the MissingCommandLineParamError exception.")	
        self.mocker.VerifyAll()

        # Reset Mock Object
        self.common.UnsetMox(self)
예제 #3
0
    def test_PGModelIsNotSpecifiedRaisesError(self):
        """
        Verifies requirement GEN000003. Checks that the missing config exception
        is thrown when the PG model is not specified.
        """
        # Setup Mock Object
        self.common.SetupMox(self)

        testharness.getOptDebugFlag().AndReturn(True)
        testharness.getOptParam().AndReturn(None)
        testharness.getOptExternal().AndReturn(self.external)
        testharness.getOptImplantable().AndReturn(None)
        testharness.getOptEnv().AndReturn(self.env)
        self.mocker.ReplayAll()

        self.trace('GEN000003')
        try:
            tc = komodo.getTestContext()
            self.verifyFailed(msg="Did not catch the MissingCommandLineParamError exception.")

        except komodo.MissingCommandLineParamError:
            self.verified(msg="MissingCommandLineParamError was raised")	    

        except:
            self.verifyFailed(msg="Did not catch the MissingCommandLineParamError exception.")	

        self.mocker.VerifyAll() 

        # Reset Mock Object
        self.common.UnsetMox(self)        
예제 #4
0
    def test_EnvironmentObjectIsRetrieved(self):
        """
        Verifies requirement GEN000003. Checks that the environment object was 
        retrieved.
        """
        # Setup Mock Object
        self.common.SetupMox(self)

        # Stub out the testharness functions that are called
        testharness.getOptDebugFlag().AndReturn(True)
        testharness.getOptParam().AndReturn(None)
        testharness.getOptExternal().AndReturn(self.external)
        testharness.getOptImplantable().AndReturn(self.implantable)
        testharness.getOptEnv().AndReturn(self.env)

        # In order for the testContext to return successfully, the environment 
        # geography and the external availability should match. Force this to 
        # occur with a mock environment object
        MockEnv = mox.MockObject(Environment)
        MockEnv.geography = 'us'
        availability.evaluate('US').AndReturn(True)
        environment.getInstance(self.env).AndReturn(MockEnv)
        self.mocker.ReplayAll()

        testContext = komodo.getTestContext()	
        # Verification
        self.trace('GEN000003')
        self.verify(testContext['env'] is not None)
        self.mocker.VerifyAll()
        
        # Reset Mock Object
        self.common.UnsetMox(self)        
예제 #5
0
    def test_ParameterDefaultsAreSetCorrectly(self):
        """
        Verifies requirements GEN000003 and GEN000004. Check that the default 
        optional parameters are set when none are specified. 
        
        GEN000003: Komodo shall provide a context to capture command line 
        options for the following attributes: External, Implantable, Environment,
        Browser Type, Enroll type, PG Simulator, Debug.

        
        GEN000004: Komodo shall provide the ability to load the product line 
        model for the external and implantable in the context.
        """
        # Setup Mock Object
        self.common.SetupMox(self)

        testharness.getOptDebugFlag().AndReturn(True)
        testharness.getOptParam().AndReturn(None)
        testharness.getOptExternal().AndReturn(self.external)
        testharness.getOptImplantable().AndReturn(self.implantable)
        testharness.getOptEnv().AndReturn(self.env)

        # In order for the testContext to return successfully, the environment 
        # geography and the external availability should match. Force this to 
        # occur with a mock environment object
        MockEnv = mox.MockObject(Environment)
        MockEnv.geography = 'us'
        availability.evaluate('US').AndReturn(True)
        environment.getInstance(self.env).AndReturn(MockEnv)
        self.mocker.ReplayAll()

        testContext = komodo.getTestContext()

        self.trace('GEN000003')
        self.verifyEqual(testContext['brwsr'], komodo.BROWSER_DEFAULT)
        self.verifyEqual(testContext['pgsim'], False)
        self.verifyEqual(testContext['enroll'], True)
        self.mocker.VerifyAll()
        
        # Reset Mock Object
        self.common.UnsetMox(self)	 
        
        self.trace('GEN000004')
        self.verifyTrue(availability.getExternal() is not None, msg="External PLM was loaded.")
        self.verifyTrue(availability.getImplantable() is not None, msg="Implantable PLM was loaded.")
예제 #6
0
    def test_EnvironmentExternalGeographyMismatchRaisesError(self):
        """
        Verifies requirement GEN000005. Check that the external param and the 
        env geography mismatch throw an error.
        """
        # Setup Mock Object
        self.common.SetupMox(self)

        testharness.getOptDebugFlag().AndReturn(True)
        testharness.getOptParam().AndReturn(None)
        testharness.getOptExternal().AndReturn(self.external)
        testharness.getOptImplantable().AndReturn(self.implantable)
        testharness.getOptEnv().AndReturn(self.env)

        # In order for the testContext to return successfully, the environment 
        # geography and the external availability should match. Force this to 
        # occur with a mock environment object
        MockEnv = mox.MockObject(Environment)
        MockEnv.geography = 'us'
        availability.evaluate('US').AndReturn(False)
        environment.getInstance(self.env).AndReturn(MockEnv)
        self.mocker.ReplayAll()

        self.trace('GEN000005')
        try:
            tc = komodo.getTestContext()
            self.verifyFailed(msg="Did not catch the ExternalPLMEnvironmentMismatchError exception.")

        except ExternalPLMEnvironmentMismatchError:
            self.verified(msg="ExternalPLMEnvironmentMismatchError was raised")	    

        except:
            self.verifyFailed(msg="Did not catch the ExternalPLMEnvironmentMismatchError exception.")

        self.mocker.VerifyAll() 
        
        # Reset Mock Object
        self.common.UnsetMox(self)
예제 #7
0
파일: __init__.py 프로젝트: randyesq/komodo
def getTestContext():
    """
    Defines the context parameters of the test from command-line parameters for
    use with any library component that requires this information. Parameters 
    are specified with key/value pairs using the perseus -p option. 
    
    Example::

        python Test_Script.py -t test1 -c case1 -e isosys5a -x EU_1.0_JAGRF -i J063-200-1 -p brwsr=InternetExplorer,enroll=True,pgsim=False
        
    I{Available parameters used by Komodo}::
        -brwsr    = InternetExplorer, Firefox (default), HtmlUnit -- see SyRS010131
        -pgsim    = True, False (default)
        -enroll   = True (default), False (direct to database)
    
    I{REQUIRED parameters available through Perseus command-line options}::
        -e = [name of environment, no underscores],  REQUIRED
        -x = [external from PLE], REQUIRED, must be specified before "-i"
        -i = [implantable from PLE], REQUIRED
        
    B{NOTE}:
    
    The Perseus command-line option "-r" for PLM release is ignored by Komodo.
    You cannot specify versions of browsers in Komodo, that is a test station-specific setup.
        
    @return: TestContext dictionary
    @rtype: C{dict}
    
    @raises UnrecognizedCommandLineParamError: 
    @raises MissingCommandLineParamError:
    """
    logger.info('** Komodo System Evaluation Automation Test Library Version %s **' % __VERSIONSTR)
    testContext = dict()
    _rawCommandLineArgs = dict()
    
    # Parse the specified command-line parameters from "-p"
    _rawCommandLineParams = testharness.getOptParam()

    # Check to make sure some command-line arguments were specified, malformed -p args may appear as strings
    if _rawCommandLineParams is not None and type(_rawCommandLineParams) is dict:
        logger.info('Command line Parameters: %s' % _rawCommandLineParams)
        _rawCommandLineArgs.update(_rawCommandLineParams)    

    # No parameters specified or parameters are strings, do nothing and let them
    # go unnoticed by Komodo
    else:
        pass

    _rawCommandLineArgs['debug'] = testharness.getOptDebugFlag()
    _rawCommandLineArgs['external'] = testharness.getOptExternal()
    _rawCommandLineArgs['implantable'] = testharness.getOptImplantable()
    _rawCommandLineArgs['env'] = testharness.getOptEnv()
        
    # Set the logger level if the debug flag is on
    if _rawCommandLineArgs['debug']:
        logger.setLevel(_plog.DEBUG)    
    
    # Browsers for web navigation (no longer supported), leave here for brevity
    testContext['brwsr'] = BROWSER_DEFAULT
            
    # PG Simulator vs Real PG
    if 'pgsim' in _rawCommandLineArgs:
        if _rawCommandLineArgs['pgsim'].lower() == 'true':
            testContext['pgsim'] = True
        elif _rawCommandLineArgs['pgsim'].lower() == 'false':
            testContext['pgsim'] = False
        else:
            logger.error('Unrecognized value for Command line Parameter - pgsim [%s]' % _rawCommandLineArgs['pgsim'])
            raise UnrecognizedCommandLineParamError("Parameter 'pgsim' values are 'True' or 'False'.")
    
    else:
        testContext['pgsim'] = False
        
    # Test Data: Enrollment vs Direct to Database push
    if 'enroll' in _rawCommandLineArgs:
        if _rawCommandLineArgs['enroll'].lower() == 'true':
            testContext['enroll'] = True
        elif _rawCommandLineArgs['enroll'].lower() == 'false':
            testContext['enroll'] = False
        else:
            logger.error('Unrecognized value for Command line Parameter - enroll [%s]' % _rawCommandLineArgs['enroll'])
            raise UnrecognizedCommandLineParamError("Parameter 'enroll' values are 'True' or 'False'.")
            
    else:
        testContext['enroll'] = True
        
    # Country: If the test wants to specify a country different than a random
    if 'country' in _rawCommandLineArgs:
            testContext['country'] = _rawCommandLineArgs['country']            
    else:
        testContext['country'] = None    
        
    # External (i.e. Communicator, required)
    if 'external' in _rawCommandLineArgs and _rawCommandLineArgs['external'] is not None:
        testContext['external'] = _rawCommandLineArgs['external']
        perseus.availability.loadExternal(testContext['external'])
        
    else:
        logger.error('Missing Command line Parameter - external')
        raise MissingCommandLineParamError("Parameter 'external' is required.")
    
    # PG Model (required)
    if 'implantable' in _rawCommandLineArgs and _rawCommandLineArgs['implantable'] is not None:
        testContext['implantable'] = _rawCommandLineArgs['implantable']
        perseus.availability.loadImplantable(testContext['implantable'])

    else:
        logger.error('Missing Command line Parameter - implantable')
        raise MissingCommandLineParamError("Parameter 'implantable' is required.")
        
    # Environment Name (required)
    if 'env' in _rawCommandLineArgs and _rawCommandLineArgs['env'] is not None:
        testContext['env'] = environment.getInstance(_rawCommandLineArgs['env'])
            
        # The external should be in the format [2-char server deployment]_[release #]_[comm model #]
        if testContext['external'][1:3].lower() == testContext['env'].geography.lower():
            logger.info('testContext PLM "external" %s matches environment geography %s' % (testContext['external'], testContext['env'].geography.upper()))
        else:
            logger.error('testContext PLM "external" %s does NOT match environment geography %s' % (testContext['external'], testContext['env'].geography.upper()))
            raise ExternalPLMEnvironmentMismatchError("Availability (%s) and Geography (%s) do not match" % (testContext['external'], testContext['env'].geography.upper()))

        # If a country has been specified, check it as well
        if testContext['country']:
            for ctry in testContext['env'].countries:
                if testContext['country'] == ctry.iso3code:
                    logger.info('testContext country "%s" matches an environment-supported geography' % testContext['country'])
                    testContext['country'] = ctry
                    testContext['country'].default = True
                    break
            else:
                logger.error('testContext country "%s" does not match environment support geographies: "%s"' % (testContext['country'], ", ".join( [x.iso3code for x in testContext['env'].countries] )))
                raise UnrecognizedCommandLineParamError('testContext country "%s" not found' % testContext['country'])
        else:
            testContext['country'] = None
        
    else:
        logger.error('Missing Command line Paramater - env')
        raise MissingCommandLineParamError("Parameter 'env' is required")
    
    # Log commandline parameters set in testContext
    logger.debug('testContext values: %s' % testContext)
    logger.info('Successfully created Komodo testContext dictionary.')

    return testContext
예제 #8
0
    def Case_Patient_Detail_Page(self): 
        self.clinic1 = self.enroll.createClinic("DW_Patient_Detail")
        self.subclinic1 = self.enroll.createSubclinic(clinicObj=self.clinic1)
        self.subclinic2 = self.enroll.createSubclinic(clinicObj=self.clinic1)
        self.clinician1 = self.enroll.createClinician(clinicObj=self.clinic1,role=CAM)
        pgModel = testharness.getOptImplantable()
        
        #H/W Setup and Patient Enrollment
        pg = self.enroll.createPG(self.clinic1)
        comm = self.enroll.createCommunicator(self.clinic1)
        scale = perseus.bluetooth.getPort(perseus.config.getProperty('scalePort','SENSORSIM'))
        bloodPressure = perseus.bluetooth.getPort(perseus.config.getProperty('bpMonitorPort','SENSORSIM'))
        bp1 = self.enroll.createBloodPressureMonitor(self.clinic1,bluetoothAddress = bloodPressure.getAddress())
        ws1 = self.enroll.createWeightScale(self.clinic1,bluetoothAddress = scale.getAddress())
        self.patient1 = self.enroll.createPatient(self.subclinic1, pg, comm, wsObj=ws1, bpmObj=bp1)
        self.comm1, self.pg1 = self.shortcutInstance.initializeHardware(self.patient1,True,True)
        self.shortcutInstance.sendSensorReading(self.patient1, self.comm1, 'ws', reading = (60,))
        if evaluate('InductiveCommunicator'):
            self.comm1.pressAndWait(5)
        self.shortcutInstance.sendSensorReading(self.patient1, self.comm1, 'bpm', reading = (120,80,75,100))  
        if evaluate('InductiveCommunicator'):
            self.comm1.pressAndWait(5)
        self.comm1.shiftTime(minutes = 20)
        time.sleep(5)
        self.comm1.callServer()

        #Episode Creation
        self.shortcutInstance.createAlert(pg=self.pg1,alertType='Red')
        self.shortcutInstance.createAlert(pg=self.pg1,alertType='Yellow')
        self.pg1.createAlert('TherapyHistoryCorruption')
        self.pg1.createEpisode('EpisodeNonSustainedV')
        self.pg1.loadTrendsData(int(14))
        self.pg1.setLeadInfo('LeadA','Jan',2010,'M12345','123456',('LeadMfgGuidant','Guidant')[0],('LeadPolarityIS1Bipolar','IS-1 Bipolar')[0],('LeadPosRightAtrium','Right Atrium')[0])
        self.pg1.setLeadImplantDiagnosticResult('RA', 550,7000,1600,700)
        self.pg1.setLeadImplantDiagnosticResult('RV', 550,7000,1600,700)
        self.comm1.performPII()
        self.pg1.close()

        msgTitle = 'Case_Patient_Detail_Page'
        self.trace(
            ['DWB000017', ])
        #navigating to Patient Detail Page and check that patient detail information is retrieved from patient detail page
        page = self.dwi.navigateToLogin()
        page = page.login(self.clinician1.username, self.clinician1.password)
        page = page.clickAllPatients()
        page = page.clickPatientName(self.patient1)
        self.verifyTrue(isinstance(page, komodo.dragonweb.pages.PatientDetailPage),'User navigates to PatientDetailPage')
        self.verifyTrue(page.verifyPage(),'A true is returned if page is Patient Detail Page') 
        
        #check that clickEditPatientEquipmentInformation button navigates correctly
        page = page.clickEditPatientEquipmentInformation()
        self.verifyTrue(isinstance(page, komodo.dragonweb.pages.EnrollPatientPageStep2),
                        'User clicks clickEditPatientEquipmentInformation button and navigates to EnrollPatientPageStep2 ')        

        #check that clickEditScheduleAlertConfiguration button navigates correctly
        page = page.clickSaveAndClose()
        page = page.clickEditScheduleAlertConfiguration()
        self.verifyTrue(isinstance(page, komodo.dragonweb.pages.AlertScheduleSettingPage),
                        'User clicks clickEditScheduleAlertConfiguration button and navigates to AlertScheduleSettingPage ')

        #check that clickReportsMenu button navigates correctly
        page = page.clickCloseWithoutSaving()
        reportPage = page.clickReportsMenu()
        self.verifyTrue(isinstance(reportPage, komodo.dragonweb.pages.ReportsMenuPage),
                        'User clicks clickReportsMenu button and navigates to ReportsMenuPage')
        reportPage.clickClose()
        
        #Navigate to Patient Detail Page
        page = page.clickViewPatientList()        
        page = page.clickAllPatients()
        page = page.clickPatientName(self.patient1)

        #Check the Patient Detail Dictionary
        patientDetailDict = page.getPatientDetail()
        self.verifyTrue(patientDetailDict["Patient"] == Common.getName(self, self.patient1), "Patient Name can be accessed")
        self.verifyTrue(patientDetailDict["Patient ID"] == self.patient1.patientClinics[0].patientId, "Patient ID can be accessed")
        self.verifyTrue(patientDetailDict["Device"].find(self.patient1.pg.modelName) != -1, "Device information can be accessed")
        self.verifyTrue(len(patientDetailDict["Date of Birth"])>0, "Date of Birth can be accessed")
        self.verifyTrue(patientDetailDict["Patient Group"] == self.subclinic1.name, "Patient Group can be accessed")
        self.verifyTrue(patientDetailDict["Monitoring Status"] is not None, "Monitoring Status can be accessed")
        self.verifyTrue(patientDetailDict["Patient Group Type"] == 'Primary',"Patient Group Type can be accessed")
        self.verifyTrue(patientDetailDict["Latest Device Send Date"] is not None,"Latest Device Send Date can be accessed")

        #MonitoringDictionary -- Covered in Case_Static_Patient_Detail
        #NotificationDictionary -- Covered in Case_Static_Patient_Detail
        #getSafetyCoreMessage -- Covered in Case_Static_Patient_Detail
        summaryPage = page.clickSummary()
        
        #check MyAlerts Dictionary
        myAlertsDict = summaryPage.getMyAlerts()
        self.verifyTrue(len(myAlertsDict) > 0, 'MyAlerts Dictionary is created')
        self.verifyTrue(myAlertsDict[1].Severity.find('Alert') != -1, 'Alert Severity can be accessed')#Spot Check
        self.verifyTrue(len(myAlertsDict[1].Message) > 0, 'Alert Message can be accessed')#Spot Check
        self.verifyTrue(len(myAlertsDict[1].Date) > 0, 'Alert Date can be accessed')#Spot Check

        #check BatteryDetail Dictionary
        batteryDetailDict = summaryPage.getBatteryDetailDictionary()
        self.verifyTrue(len(batteryDetailDict) > 0, 'BatteryDetail Dictionary is created')
        self.verifyTrue(batteryDetailDict.get('Magnet Rate') is not None,"Magnet Rate value is not none")

        #check LeadsDetail Dictionary
        leadDetailDict = summaryPage.getLeadsDetailDictionary()
        self.verifyTrue(len(leadDetailDict) > 0, 'LeadsDetail Dictionary is created')

        #check HealthDetail Dictionary
        healthDetailDict = summaryPage.getHealthDetailDictionary()
        self.verifyTrue(len(healthDetailDict) > 0, 'Health Detail Dictionary is created')

        #check EventsDetail Dictionary
        eventsDetailDict = summaryPage.getEventsDetailDictionary()
        self.verifyTrue(len(eventsDetailDict) > 0, 'EventsDetail Dictionary is created')
        self.verifyTrue(eventsDetailDict.has_key('Event Counts'),'Event Details has Event Counts section')      
        self.verifyTrue(eventsDetailDict.has_key('Percent Paced'),'Event Details has Percent Paced section')

        #check SettingsSummaryDetail Dictionary
        settingsSummaryDetailDict = summaryPage.getSettingsSummaryDetailDictionary()
        self.verifyTrue(len(settingsSummaryDetailDict) > 0, 'SettingsSummaryDetail Dictionary is created')

        #check DeviceEvents Dictionary
        deviceEventsDict = summaryPage.getDeviceEventsDictionary()
        self.verifyTrue(len(deviceEventsDict) > 0, 'DeviceEvents Dictionary is created')

        #check LeadSafetySwitchIndicator
        if not pgModel.startswith('P163'):
            leadSafetySwitchDict = summaryPage.getLeadSafetySwitchIndicator()
            self.verifyTrue(len(leadSafetySwitchDict) > 0, 'LeadSafetySwitch Dictionary is created')

        #check therapyHistoryCorruptionDetectedIndicator
        therapyHistoryAlert = summaryPage.getTherapyHistoryCorruptionDetectedIndicator()
        self.verifyTrue(therapyHistoryAlert.Date is not None, "TherapyHistoryCorruptionDetected Date can be accessed")
        self.verifyEqual(therapyHistoryAlert.Message,'Therapy history corruption detected.',
                         'Therapy history corruption detected message can be accessed')
        self.verifyEqual(therapyHistoryAlert.Severity,'Yellow Alert',
                         'Therapy history corruption detected severity can be accessed')

        #check ExternalSensorsDictionary
        externalSensorDict = summaryPage.getExternalSensorsDictionary()
        self.verifyTrue(len(externalSensorDict) > 0, 'External Sensor Dictionary is created')
        self.verifyTrue(len(externalSensorDict['WeightScale']['Measurement'])>0,
                        'Weight scale Measurement can be accessed')
        self.verifyTrue(len(externalSensorDict['WeightScale']['MeasurementDate'])>0 ,
                        'Weight scale MeasurementDate can be accessed')
        self.verifyTrue(externalSensorDict['BloodPressureMonitor']['Measurement'] == str(120) + '/' + str(80) + ' mmHg',
                        'BloodPressureMonitor Measurement can be accessed')
        self.verifyTrue(len(externalSensorDict['BloodPressureMonitor']['MeasurementDate'])>0,
                        'BloodPressureMonitor MeasurementDate can be accessed')

        #check if clickPresentingEgmViewDetail navigates correctly
        self.trace(
            ['DWB000028', 'DWB000017', ])
        popUp = summaryPage.clickPresentingEgmViewDetail()
        self.verifyTrue(isinstance(popUp,komodo.dragonweb.pages.EventPopup),
                        'User clicks clickPresentingEgmViewDetail link and navigates to EventPopUp ')
        self.verifyTrue(popUp.isDataPresentInGraph(), 'Data Presence in Graph can be checked')
        popUp = summaryPage.clickPresentingEgmViewDetail()
        self.verifyTrue(popUp.isDataPresentInMarkers(), 'Data Presence in markers can be checked')

        self.trace(
            ['DWB000017', ])
        #Check Leads tab
        leadsTab = page.clickLeads()
        leadInfoDict = leadsTab.getLeadInfoDictionary()
        self.verifyTrue(len(leadInfoDict) > 0, 'Lead Info Dictionary is created')
        leadInfoRow = leadInfoDict[1]
        self.verifyTrue(leadInfoRow.ImplantDate is not None, 'Impant date can be accessed fron Lead Info dictionary')
        self.verifyTrue(leadInfoRow.Manufacturer is not None, 'Manufacturer can be accessed fron Lead Info dictionary')
        self.verifyTrue(leadInfoRow.Model is not None, 'Model can be accessed fron Lead Info dictionary')
        self.verifyTrue(leadInfoRow.Serial is not None, 'Serial can be accessed fron Lead Info dictionary')
        self.verifyTrue(leadInfoRow.Polarity is not None, 'Polarity can be accessed fron Lead Info dictionary')
        self.verifyTrue(leadInfoRow.Position is not None, 'Position can be accessed fron Lead Info dictionary')

        #checking Lead Measurments dictionary
        leadMeasureDict = leadsTab.getLeadMeasurmentsDictionary()
        self.verifyTrue(len(leadMeasureDict) > 0, 'Lead Measurments Dictionary is created')
        for key in leadMeasureDict:	
            leadMeasRow = leadMeasureDict[key]
            self.verifyTrue(leadMeasRow.Impedance is not None, 'Impedance can be accessed fron Lead Measurments dictionary')
            self.verifyTrue(leadMeasRow.IntrinsicAmplitude is not None, 
                            'IntrinsicAmplitude can be accessed fron Lead Measurments dictionary')
            self.verifyTrue(leadMeasRow.PaceThreshold is not None, 
                            'PaceThreshold can be accessed fron Lead Measurments dictionary')

        #Checking Graphs
        self.verifyTrue(len(leadsTab.getGraphs()) > 0, 'Get names of all the graphs')
        self.verifyTrue(leadsTab.isDataPresentInGraph(leadsTab.getGraphs()[0]), 'Checks the data in First Graph')
        self.verifyTrue(leadsTab.isDataPresentInGraph("Right Ventricular Pace Impedance"), 
                         'Checks the data in Pace Impedence Graph')
        
        trendDic = leadsTab.getTrendDictionary()
        self.verifyTrue(len(trendDic) > 0, 'Trend Dictionary can be accessed')
        #trendDic[u'RV Pace Impedance (\u2126)'].keys()[0] << to get the date
        self.verifyTrue(len(leadsTab.getTrend("RV Pace", trendDic[u'RV Pace Impedance (\u2126)'].keys()[0]))>0,
                         'Get Trend function can extract trend from the whole table')

        #Check Events tab
        eventTab = page.clickEvents()
        eventsTabPage = eventTab.setViewingEventsSince('Implant')
        self.verifyTrue(isinstance(eventsTabPage, komodo.dragonweb.pages.EventsTab), 'Setting ViewingEventsSince navigates to EventsTab')  
        self.verifyEqual(eventTab.getViewingEventsSince(),'Implant','ViewingEventsSince can be accessed on Events tab')
        resultclickAtrial = eventTab.clickAtrial()
        self.verifyTrue(isinstance(resultclickAtrial, komodo.dragonweb.pages.EventsTab), 'clickAtrial navigates to EventsTab')  
        resultclickVTachy = eventTab.clickVTachy()
        self.verifyTrue(isinstance(resultclickVTachy, komodo.dragonweb.pages.EventsTab), 'clickVTachy navigates to EventsTab')  
        resultClickOther = eventTab.clickOther()
        self.verifyTrue(isinstance(resultClickOther, komodo.dragonweb.pages.EventsTab), 'Setting ViewingEventsSince navigates to EventsTab')  
        resultclickAll = eventTab.clickAll()
        self.verifyTrue(isinstance(resultclickAll, komodo.dragonweb.pages.EventsTab), 'clickAll navigates to EventsTab') 

        #The following functions do not return anything
        eventTab.setCheckboxesForAllEvents(True)
        eventTab.setCheckboxesForAllEvents(False)

        #check for setEventsCheckbox
        self.verifyTrue(eventTab.setEventsCheckbox(True,'V-1'),'Event Checkbox for V-1 can be checked') 

        #check clickGenerateReportForSelectedEvents navigation
        pdfObj = eventTab.clickGenerateReportForSelectedEvents()
        self.verifyTrue(isinstance(pdfObj, komodo.dragonweb.pdf.PDF), 'User clicks clickGenerateReportForSelectedEvents button '
                        'and navigates to PDF report in new browser')  
        pdfObj.close()

        #check clickGenerateArythmiaLogbookReport navigation
        pdfObj = eventTab.clickGenerateArythmiaLogbookReport()
        self.verifyTrue(isinstance(pdfObj, komodo.dragonweb.pdf.PDF),'User clicks clickGenerateArythmiaLogbookReport button '
                        'and navigates to PDF report in new browser')  
        pdfObj.close()

        eventTab = page.clickEvents()
        self.trace(
            ['DWB000028', 'DWB000017', ])
        popUp = eventTab.clickEvent(None,1)
        self.verifyTrue(isinstance(popUp,komodo.dragonweb.pages.EventPopup), 'Pop up can be opened')
        self.verifyTrue(len(popUp.getEventDetail()) > 0, 'Event Detail can be accessed')
        popUp.clickClose()

        self.trace(
            ['DWB000017', ])
        #Check Health tab
        # All the _Graphs based checking is done in Leads Tab Validation
        healthTab = page.clickHealth() 
        self.verifyTrue(len(healthTab.getMostRecentMeasurement()) > 0,
                        'MostRecentMeasurement can be accessed on Health Tab ') 

        
        #Check FollowupHistory tab
        followUpHistTab = page.clickFollowUpHistory()
        reportPage = followUpHistTab.clickReportsMenu(1)
        self.verifyTrue(isinstance(reportPage,komodo.dragonweb.pages.ReportsMenuPage),
                        'User clicks clickReportsMenu button and navigates to ReportsMenuPage ') 
        reportPage.clickClose()

        #check clickShowAlertHistory navigation
        alertHistPage = followUpHistTab.clickShowAlertHistory()
        #AA giving attribute error
        self.verifyTrue(isinstance(alertHistPage,komodo.dragonweb.pages.AlertHistoryPage),
                        'User clicks clickShowAlertHistory button and navigates to AlertHistoryPage ') 
        alertHistPage.closeAlertHistoryWindow()
        
        #check that clickDismissFromReviewList button navigates correctly
        page = page.clickDismissFromReviewList()
        self.verifyTrue(isinstance(page, komodo.dragonweb.pages.ViewPatientListPage),
                        'User clicks clickDismissFromReviewList button and navigates to ViewPatientListPage')
예제 #9
0
def getTestContext():
    """
    Defines the context parameters of the test from command-line parameters for
    use with any library component that requires this information. Parameters 
    are specified with key/value pairs using the perseus -p option. 
    
    I{Available parameters used by KomodoRS}::
        -pgsim    = True, False (default)
        -brwsr    = InternetExplorer (default), Firefox 
    
    I{REQUIRED parameters available through Perseus command-line options}::
        -e = [name of environment, no underscores],  REQUIRED
        -x = [external from PLE], REQUIRED, must be specified before "-i"
        -i = [implantable from PLE], REQUIRED
        
    B{NOTE}:
    
    The Perseus command-line option "-r" for PLM release is ignored by KomodoRS.
    You cannot specify versions of browsers in Komodo, that is a test station-specific setup.
        
    @return: TestContext dictionary
    @rtype: C{dict}
    
    @raises UnrecognizedCommandLineParamError: 
    @raises MissingCommandLineParamError:        
    """
    testContext = {}
    # Get required parameters
    testContext['env'] = testharness.getOptEnv() 
    testContext['external'] = testharness.getOptExternal()
    testContext['implantable'] = testharness.getOptImplantable()
    
    # Set optional parameters to default values
    testContext['pgsim'] = PGSIM_DEFAULT 
    testContext['brwsr'] = BROWSER_DEFAULT
    
    # Get optional parameters - overwrite defaults
    optionalParams = testharness.getOptParam()
    if isinstance(optionalParams, dict):
        customBoolArgs = CUSTOM_ARGS.split(',')
        for arg in optionalParams:
            if arg == 'pgsim':
                if not optionalParams[arg].lower() in ('true','false'):
                    raise UnrecognizedCommandLineParamError("Optional command line argument %s must be True or False" % arg)
                testContext[arg] = (optionalParams[arg].lower() == 'true')    
            elif arg == 'brwsr':
                if not optionalParams[arg].lower() in ('firefox','internetexplorer'):
                    raise UnrecognizedCommandLineParamError("Optional command line argument %s must be Firefox or InternetExplorer" % arg)
                testContext[arg] = optionalParams[arg].lower()
            else:
                raise UnrecognizedCommandLineParamError("Command line argument %s not recognized." % arg)

        
    # Validate required arguments are not None
    required = ['external', 'implantable', 'env']
    for arg in required:
        if not testContext[arg]:
            raise MissingCommandLineParamError("The required command line argument '%s' is not present" % arg)
            
    # Set environment
    testContext['env'] = environment.getInstance(testContext['env'])
    
    # Set the logger level if the debug flag is on
    if testharness.getOptDebugFlag():
        logger.setLevel(_plog.DEBUG)

    # Load availability
    perseus.availability.loadExternal(testContext['external'])
    perseus.availability.loadImplantable(testContext['implantable'])
    
    # Preset the containers for copies of hardware handles
    testContext['comm'] = None
    testContext['pg'] = None
    
    logger.info('testContext created successfully: %s' % testContext)
    return testContext