Exemplo n.º 1
0
        /// <summary>
        /// 根据 WorkingDay 将任务状态恢复到未开始。
        /// </summary>
        List <Task> SetTaskInfoAsWd(List <Task> tsks)
        {
            var ZeroDate = new DateTime(1, 1, 1, 0, 0, 0);

            foreach (var T in tsks)
            {
                bool NotStartedInM = false;

                if (T.Res.StartedPhs.YearIsOK() && Wd.DateIsNotEarlier(T.Res.StartedPhs))
                {
                    T.Res.StartedPhs = ZeroDate;
                    NotStartedInM    = true;
                }

                if (T.Res.FinishedPhs.YearIsOK() && Wd.DateIsNotEarlier(T.Res.FinishedPhs))
                {
                    T.Res.FinishedPhs = ZeroDate;
                    NotStartedInM     = true;
                }

                if (T.Res.Closed.YearIsOK() && Wd.DateIsNotEarlier(T.Res.Closed))
                {
                    T.Res.Closed = ZeroDate;
                    T.Inf.Stat   = Status.Testing;
                }

                if (NotStartedInM)
                {
                    T.Phs.CompDeg = 0;
                    T.Inf.Stat    = Status.Wait;
                }
            }
            return(tsks);
        }
Exemplo n.º 2
0
        public void TestSwitchingBetweenIframe()
        {
            Wd.Get(TestPage.OkButton).PerformClick();
            Wd.SwitchIframe(TestPage.WikiPeadiaIFrame);
            var textInsideIframe = Wd.Get(TestPage.DivInsideiFrame).Text;

            Assert.AreEqual("This is insed the iFrame", textInsideIframe);
            Wd.SwitchBackToMainContent();
            Wd.Get(TestPage.OkButton).PerformClick();
        }
Exemplo n.º 3
0
        public void Setup()
        {
            Init();
            _screenRecorder = new ScreenRecorder(Path.GetTempPath(), TestContext.TestName);
            _screenRecorder.StartRecording();
            string codeBase = Assembly.GetExecutingAssembly().Location;
            var    dir      = new FileInfo(codeBase).Directory + @"\UnitTests\Test.html";

            _baseUrl = new Uri(dir).ToString();
            Wd.Visit(_baseUrl);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Check for window's name list
 /// </summary>
 private void ScanWindowsName()
 {
     try
     {
         //Check with FindWindows
         foreach (MemoryProtector.Protected_String Wd in BlackListedWindows)
         {
             IntPtr Handle = WindowsMgr.FindMainWindow(null, Wd.Get_String());
             if (Handle != IntPtr.Zero)
             {
                 //Found
                 Found(hibProcess.GetProcessIdFromWindow(Handle));
             }
             Handle = IntPtr.Zero;
         }
     }
     catch
     {
         new CloseApp();
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 处理老数据 : 2020.3月份及以前的。
        /// 确保在3月之前开始的任务,得到拆分。
        /// 4月开始,任务会通过禅道保证在当月开始及结束。
        /// </summary>
        List <Task> SplitTaskFinishedBefore20200331(List <Task> tsks)
        {
            if (Wd.Year >= 2020 && Wd.Mon > 3)
            {
                return(tsks);
            }

            foreach (var T in tsks)
            {
                if (!T.Inf.IsFinished)
                {
                    //TODO
                    //没有完成的,需要向后拆:
                    //3月的任务已经全部结束掉了,或者拆了新阶段。所以只需要向前拆。
                    //2月及以前的就不管了。
                    continue;
                }
                if (T.Res.FinishedPhs.Year >= 2020 && T.Res.FinishedPhs.Month > 3)
                {
                    continue;
                }

                bool StartFinishInSameMonth = (T.Res.StartedPhs.Month == T.Res.FinishedPhs.Month && T.Res.StartedPhs.Year == T.Res.FinishedPhs.Year);
                if (StartFinishInSameMonth)
                {
                    continue;
                }

                //3月之前开始的,当时没有拆分任务,那么按 当前完成度,照完时间占比,拆分一下
                var TotalDaySpent  = Wd.CountWDays(T.Res.StartedPhs, T.Res.FinishedPhs);
                var SpentThisMonth = Wd.CountWDays(Wd.Day1, T.Res.FinishedPhs);
                var PctgInM        = (float)SpentThisMonth / TotalDaySpent;

                T.Phs.LastId     = 1;
                T.Phs.LstCompDeg = T.Phs.CompDeg - (uint)(PctgInM * 100f);
                T.Res.StartedPhs = Wd.Day1;
            }
            return(tsks);
        }
Exemplo n.º 6
0
        Dictionary <ManName, ManSpd> GetTesterSpeed()
        {
            var ManTotalPts = new Dictionary <ManName, ManSpd>();
            var Ents        = GetTasks(Sql.CITM);

            if (Ents.Count == 0)
            {
                return(ManTotalPts);
            }

            foreach (var M in ResCtl.Persons)
            {
                if (M.Value.Pos == ManPos.DevTest)
                {
                    ManTotalPts[M.Value.Name] = new ManSpd {
                        Name = M.Value.Name
                    };
                }
            }

            foreach (var Ent in Ents)
            {
                if (ManTotalPts.ContainsKey(Ent.Res.Closer))
                {
                    ManTotalPts[Ent.Res.Closer].TotalPts += Ent.Inf.Points;
                }
            }

            var Days = Wd.CountWDays1ToN();

            foreach (var Pair in ManTotalPts)
            {
                var Ms = ManTotalPts[Pair.Key];
                Ms.Spd = Ms.TotalPts / Days;
            }

            return(ManTotalPts);
        }
Exemplo n.º 7
0
 public void TestTickingCheckbox()
 {
     Wd.Get(TestPage.SubscribeCheckbox).PerformClick();
     Assert.IsTrue(Wd.Get(TestPage.SubscribeCheckbox).Selected);
 }
Exemplo n.º 8
0
 public void TestSelectValueFromDropDown()
 {
     Wd.Get(TestPage.DropDown).SelectOption("Third Value");
     Assert.AreEqual("third", Wd.Get(TestPage.DropDown).GetAttribute("value"));
 }
Exemplo n.º 9
0
 public void TestInputElementUneditable()
 {
     Wd.Get(TestPage.DisableField).SetText("THis field should fail input because it disabled");
 }
Exemplo n.º 10
0
 public void TestForElementUnclikable()
 {
     Wd.Get(TestPage.HiddenUnclickable).PerformClick();
 }
Exemplo n.º 11
0
 public void TestClickingElement()
 {
     Wd.Get(TestPage.HideButton).PerformClick();
     Assert.IsFalse(Wd.Get(TestPage.SecretText).Displayed);
 }
Exemplo n.º 12
0
        public void TestElementRequiringRuntimeData()
        {
            var textContent = Wd.Get(TestPage.ListOption, "Coffee").Text;

            Assert.AreEqual(textContent, "Black Coffee");
        }
Exemplo n.º 13
0
 public void TestNonExistentElement()
 {
     Wd.Get("#this-does-not-exists");
 }
Exemplo n.º 14
0
 public void TestInputtingValueIntoTextField()
 {
     Wd.Get(TestPage.EnterTextField).SetText("cheese");
     Assert.IsTrue(Wd.Get(TestPage.EnterTextField).GetAttribute("value") == "cheese");
 }
Exemplo n.º 15
0
 public static void CleanUp()
 {
     Wd?.Dispose();
 }