Пример #1
0
 public void IEOpenTestSuccessTest()
 {
     scripter.Text = $@"
                     ie.open
                     ie.open
                     ie.open
                     ";
     scripter.Run();
     Assert.IsTrue(IETests.GetIeInstancesCount() == 3);
 }
        public void IEDetachSuccessTest()
        {
            scripter.Text = $@"
                            ie.open result {SpecialChars.Variable}result1
                            ie.open result {SpecialChars.Variable}result2
                            ie.switch {SpecialChars.Variable}result1
                            ie.detach
                            ie.switch {SpecialChars.Variable}result2
                            ie.detach";

            scripter.Run();
            Assert.IsTrue(IETests.GetIeInstancesCount() != 0);
        }
        public static void WaitForIeOpen(int timeoutMs, params string[] keywords)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            while (stopwatch.ElapsedMilliseconds < timeoutMs)
            {
                if (IETests.GetIeProcessesByTitle(keywords).Count > 0)
                {
                    return;
                }
            }
            throw new TimeoutException($"Internet explorer instance could not be found");
        }
 public void IECloseSuccessTest()
 {
     scripter.Text = $@"
                     ie.open result  {SpecialChars.Variable}result1
                     ie.open result  {SpecialChars.Variable}result2
                     ie.open result  {SpecialChars.Variable}result3
                     ie.open result  {SpecialChars.Variable}result4
                     ie.switch {SpecialChars.Variable}result1
                     ie.close
                     ie.switch {SpecialChars.Variable}result2
                     ie.close
                     ie.switch {SpecialChars.Variable}result3
                     ie.close
                     ie.switch {SpecialChars.Variable}result4
                     ie.close";
     scripter.Run();
     Assert.IsTrue(IETests.GetIeInstancesCount() == 0);
 }
Пример #5
0
        public void IESwitchFailureTest()
        {
            scripter.Text = $@"
                            ie.open result {SpecialChars.Variable}result1
                            ie.open result {SpecialChars.Variable}result2
                            ie.open result {SpecialChars.Variable}result3                            
                            ie.switch {SpecialChars.Variable}result1
                            ie.close
                            ie.switch {SpecialChars.Variable}result2
                            ie.close
                            ie.switch {SpecialChars.Variable}result3
                            ie.switch {SpecialChars.Variable}result1
                            ie.close";
            Exception exception = Assert.Throws <ApplicationException>(delegate
            {
                scripter.Run();
            });

            Assert.IsInstanceOf <InvalidOperationException>(exception.GetBaseException());
            Assert.IsTrue(IETests.GetIeInstancesCount() != 0);
        }
Пример #6
0
        public void IEAttachSuccessTest()
        {
            //    scripter.Text = $@"
            //                    {SpecialChars.Variable}result = -1
            //                    ie.attach by url phrase google result result
            //                    ie.close";
            //    IETests.WaitForIeOpen(10000, newIeInstanceTitleKeywords);
            //    scripter.Run();
            //    Assert.AreEqual(IETests.GetIeInstancesCount(), 0, "there were ie instances opened left");
            //    int result = scripter.Variables.GetVariableValue<int>("result", -1, true);
            //    Assert.AreNotEqual(result, -1, $"wrong result value: {result}");

            scripter.Text = $@"
                            {SpecialChars.Variable}result2 = -1
                            ie.attach by url phrase google result {SpecialChars.Variable}result2
                            ie.close";
            IETests.WaitForIeOpen(10000, newIeInstanceTitleKeywords);
            scripter.Run();
            Assert.AreEqual(IETests.GetIeInstancesCount(), 0, "there were ie instances opened left");
            int result2 = scripter.Variables.GetVariableValue <int>("result2", -1, true);

            Assert.AreNotEqual(result2, -1, $"wrong result value: {result2}");
        }
 public void IECloseSuccessOneOpenedLeftTest()
 {
     try
     {
         scripter.Text = $@"
                     ie.open result {SpecialChars.Variable}result1
                     ie.open result {SpecialChars.Variable}result2
                     ie.open result {SpecialChars.Variable}result3
                     ie.open result {SpecialChars.Variable}result4
                     ie.switch {SpecialChars.Variable}result1
                     ie.close
                     ie.switch {SpecialChars.Variable}result2
                     ie.close
                     ie.switch {SpecialChars.Variable}result3
                     ie.close
                     ie.switch {SpecialChars.Variable}result4";
         scripter.Run();
         Assert.IsTrue(IETests.GetIeInstancesCount() != 0);
     }
     finally
     {
         IETests.KillAllIeProcesses();
     }
 }
Пример #8
0
 public void CleanUp()
 {
     IETests.KillAllIeProcesses();
 }