public void WhenPressHomeButton()
        {
            By          selectorButtonHome = By.XPath("//a[@title='Software Testing Home']");
            IWebElement elementButtonHome  = FunctionsTests.WaitElementIsExistVisible(TFrame.Driver, selectorButtonHome, 30);

            elementButtonHome.Click();
        }
Esempio n. 2
0
        public void TestDataFromCSV(double num1, double num2, double num3)
        {
            TFrame.Driver.Navigate().GoToUrl("https://calcus.ru/calculator-imt");

            By          selectorInputHeight = By.XPath("//input[@name ='height']");
            IWebElement elementInputHeight  = FunctionsTests.WaitElementIsExistVisible(TFrame.Driver, selectorInputHeight, 30);

            By          selectorInputWeight = By.XPath("//input[@name ='weight']");
            IWebElement elementInputWeight  = FunctionsTests.WaitElementIsExistVisible(TFrame.Driver, selectorInputWeight, 30);

            elementInputHeight.SendKeys(Convert.ToString(num1));
            elementInputWeight.SendKeys(Convert.ToString(num2));

            elementInputWeight.Submit();

            By          selectorIMT = By.XPath("//div[contains(@class,'calc-result-value')]");
            IWebElement elementIMT  = FunctionsTests.WaitElementIsExistVisible(TFrame.Driver, selectorIMT, 30);

            WebDriverWait wait = new WebDriverWait(TFrame.Driver, TimeSpan.FromSeconds(10));

            double numberIMT = 0;

            wait.Until((x) =>
            {
                return(double.TryParse(elementIMT.Text, out numberIMT));
            });

            Assert.AreEqual(num3, numberIMT);
        }
Esempio n. 3
0
        public TextBox(TestFramework TFrame, By Selector, int WaitTimeSeconds)
        {
            this.TFrame          = TFrame;
            this.Selector        = Selector;
            this.WaitTimeSeconds = WaitTimeSeconds;

            Element = FunctionsTests.WaitElementIsExistVisible(TFrame.Driver, Selector, WaitTimeSeconds);
        }
Esempio n. 4
0
        [Category("First")]//open cmd and type: dotnet test "C:\source\repos\PracticeTestFramework\PracticeTestFramework\bin\Debug\netcoreapp3.1\PracticeTestFramework.dll" --filter "Category = First"
        public void Test1()
        {
            TFrame.Driver.Navigate().GoToUrl("http://lurkmore.to/DotA");

            By selector = By.XPath("//body[contains(@class,'page-DotA')]//div[@id='mw-content-text']" +
                                   "//div[contains(@class,'thumbinner morphcontainer') and descendant::a[contains(text(),'Свободно поиграть')]]");
            IWebElement element = FunctionsTests.WaitElementIsExistVisible(TFrame.Driver, selector, 30);

            string fileName = "screen8";

            TFrame.FuncTests.ScrollToElement(element);

            TFrame.FuncTests.MakeScreenshot(fileName);
        }
Esempio n. 5
0
        public void Test6()
        {
            TFrame.Driver.Navigate().GoToUrl("https://www.ilovepdf.com/ru/word_to_pdf");

            By          selectorInputFile = By.XPath("//input[@type='file']");
            IWebElement elementInputFile  = FunctionsTests.WaitElementIsExist(TFrame.Driver, selectorInputFile, 30);

            elementInputFile.SendKeys(@"C:\source\repos\fdf.docx");

            By          selectorOutputFileName = By.XPath("//span[@class='file__info__name']");
            IWebElement elementOutputFileName  = FunctionsTests.WaitElementIsExistVisible(TFrame.Driver, selectorOutputFileName, 30);

            Assert.AreEqual(elementOutputFileName.Text, "fdf.docx");
        }
Esempio n. 6
0
        public void Test7()
        {
            TFrame.Driver.Navigate().GoToUrl("https://kleki.com");

            By          selectorCanvas = By.XPath("//canvas[contains(@style,'user-select')]");
            IWebElement elementCanvas  = FunctionsTests.WaitElementIsExistVisible(TFrame.Driver, selectorCanvas, 30);

            var sizeCanvas = elementCanvas.Size;

            new Actions(TFrame.Driver).MoveToElement(elementCanvas, 2, 2).ClickAndHold()
            .MoveByOffset(sizeCanvas.Width / 2, sizeCanvas.Height / 2).Release().Perform();

            Screenshot screenshot = ((ITakesScreenshot)TFrame.Driver).GetScreenshot();

            screenshot.SaveAsFile(@"sqreenshotCanvasNew.png", OpenQA.Selenium.ScreenshotImageFormat.Png);

            Assert.IsTrue(FunctionsTests.CompareFilesByHash(@"resources\sqreenshotCanvas.png", "sqreenshotCanvasNew.png"));
        }
        public void Test_alert(string browserName)
        {
            Setup(browserName);

            TFrame.Driver.Navigate().GoToUrl("http://the-internet.herokuapp.com/javascript_alerts");

            var expectedAlertText = "I am a JS Alert";

            By          selectorAlertButton = By.XPath("//button[.='Click for JS Alert']");
            IWebElement elementAlertButton  = FunctionsTests.WaitElementIsExistVisible(TFrame.Driver, selectorAlertButton, 30);

            elementAlertButton.Click();

            var elementAlertWindow = TFrame.Driver.SwitchTo().Alert();

            Assert.AreEqual(expectedAlertText, elementAlertWindow.Text);

            elementAlertWindow.Accept();
        }
Esempio n. 8
0
        public void Test2()
        {
            TFrame.Driver.Navigate().GoToUrl("https://gotovim-doma.ru");

            PageEnter enterPage = new PageEnter(TFrame);

            enterPage.Enter.Click();

            PageLogin loginPage = new PageLogin(TFrame);

            loginPage.Username.SendKeys("alikaalinka");
            loginPage.Password.SendKeys("18931212");

            ((IWebElement)(loginPage.Password.Element)).Submit();

            By          selectorUsername = By.XPath("//header//div[contains(@class,'head')]//div[contains(@class,'head-autorize')]//a[contains(text(),'alikaalinka')]");
            IWebElement elementUsername  = FunctionsTests.WaitElementIsExistVisible(TFrame.Driver, selectorUsername, 30);

            Assert.IsTrue(elementUsername.Displayed);
        }