Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //setup
            var psi = new ProcessStartInfo(CAExeFile);

            _CAApp        = Application.AttachOrLaunch(psi);
            _CAMainWindow = _CAApp.GetWindow(SearchCriteria.ByAutomationId("ClinicalAccess"), InitializeOption.NoCache);

            //prepare
            _CAMainWindow.Get(SearchCriteria.ByAutomationId("btnSelectPatient")).Click();
            Window _PatientSelectDialogWindow = _CAMainWindow.ModalWindow("Patient Select Dialog");

            var PatientsTab = _PatientSelectDialogWindow.Get(SearchCriteria.ByText("Patients"));

            PatientsTab.Click();

            var cmbFacility = _PatientSelectDialogWindow.Get <ComboBox>(SearchCriteria.ByAutomationId("cmbFacility"));

            //int tryCnt = 0;
            //string FacilitySelectedValue = null;
            //while ((tryCnt < 3) && (FacilitySelectedValue != "XTRSim"))
            //{
            //    cmbFacility.Select("XTRSim");
            //    FacilitySelectedValue = cmbFacility.SelectedItem.Text;
            //    tryCnt++;
            //}

            //make sure the selection on the Unit row works
            _PatientSelectDialogWindow = _CAMainWindow.ModalWindow("Patient Select Dialog");
            _PatientSelectDialogWindow.Get(SearchCriteria.ByText("Unit Row 0")).DoubleClick();
            var DataGridView_Table = _PatientSelectDialogWindow.Get <Table>(SearchCriteria.ByAutomationId("dgvUnits"));

            cmbFacility.Select("XTRSim");

            //to avoid timeout=5000 exception
            CoreAppXmlConfiguration.Instance.BusyTimeout = 100000;//50000
            bool     found   = false;
            TableRow testRow = null;

            //go through the units to find the testing bed
            for (int i = 0; i < DataGridView_Table.Rows.Count; i++)
            {
                string pos = i.ToString();
                _PatientSelectDialogWindow.Get(SearchCriteria.ByText("Unit Row " + pos)).DoubleClick();

                var PatientsDatagrid2 = _PatientSelectDialogWindow.Get <Table>(SearchCriteria.ByAutomationId("dgvPatients"));
                var rows = PatientsDatagrid2.Rows;

                foreach (TableRow row in rows)
                {
                    if ((string)row.Cells[0].Value == "BD002(2140)") //"Room3(2666)") ; //"CP255")
                    {
                        testRow = row;
                        found   = true;
                        break;
                    }
                }
                if (found == true)
                {
                    break;
                }
            }

            //after click the row, the "Patient Select Dialog" disappear and may generate exception
            try
            {
                testRow.Click();
            }
            catch (Exception e)
            {
                Console.WriteLine("test case BedsideData exception" + e.Message.ToString());
            }

            //_CAMainWindow.Get(SearchCriteria.ByAutomationId("btnArrhythmiaReview")).Click();
            //click Bedside
            //var bedsideView = _CAMainWindow.Get(SearchCriteria.ByAutomationId("btnBedSide"));
            //bedsideView.Click();
            var WaveformsView = _CAMainWindow.Get(SearchCriteria.ByText("Waveforms"));

            WaveformsView.Click();
            //_CAMainWindow.Get(SearchCriteria.ByAutomationId("btn12Lead")).Click();
            //_CAMainWindow.Get(SearchCriteria.ByAutomationId("btnAlarmHistory")).Click();
            Thread.Sleep(2000);

            //Test codes

            _CAMainWindow.Get(SearchCriteria.ByAutomationId("btnCompressed")).Click();
            Panel    CompressedWaveformContainer = _CAMainWindow.Get <Panel>(SearchCriteria.ByAutomationId("CompressedWaveformContainer"));
            Panel    TimePanel1    = CompressedWaveformContainer.Get <Panel>(SearchCriteria.ByAutomationId("TimeControl.0"));
            string   DateStr       = TimePanel1.Get <Label>(SearchCriteria.ByAutomationId("Label.0")).Text;
            string   TimeStampStr  = TimePanel1.Get <Label>(SearchCriteria.ByAutomationId("Label.1")).Text;
            DateTime displayedTime = Convert.ToDateTime(DateStr + " " + TimeStampStr);

            //Display most recent data < 15  ?
            Assert.IsTrue((DateTime.Now - displayedTime).TotalMinutes < 15);

            //end test codes

            _CAApp.Close();
            _CAApp.Dispose();
        }