Ejemplo n.º 1
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)        
Ejemplo n.º 2
0
 def _getBandSpecificCenterFrequency(self):
     if not evaluate("RF_MICSBand"):
         if evaluate("EU"):
             return conf.getProperty("ENROLLMENT", "srdcenterfreqency")
         else:
             return conf.getProperty("ENROLLMENT", "ismcenterfreqency")
     else:
         return None  # no PG Center frequency for MICS-band PGs
Ejemplo n.º 3
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.")
Ejemplo n.º 4
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)
Ejemplo n.º 5
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')