Projekt

Obecné

Profil

Stáhnout (1.99 KB) Statistiky
| Větev: | Tag: | Revize:
1 782b6d38 Vojtěch Bartička
using Microsoft.EntityFrameworkCore;
2
using Microsoft.Extensions.Logging;
3 773d1205 schenkj
using Microsoft.VisualStudio.TestTools.UnitTesting;
4
5
using System;
6
using System.Collections;
7
using System.Collections.Generic;
8
using System.Threading;
9
10
namespace BackendTesting
11
{
12 782b6d38 Vojtěch Bartička
13
14 773d1205 schenkj
    [TestClass]
15 782b6d38 Vojtěch Bartička
    public class MainTestingClass
16 773d1205 schenkj
    {
17 782b6d38 Vojtěch Bartička
        //public TestContext context = new TestContext();
18
        [TestMethod]
19
        public void runAll()
20
        {
21
            
22
23
        } 
24 773d1205 schenkj
25
26 782b6d38 Vojtěch Bartička
        /*
27
        public IWebDriver fDriver = new FirefoxDriver();
28
        public IWebDriver cDriver = new ChromeDriver();
29 773d1205 schenkj
        [TestMethod]
30
        public void DummyTutorial()
31
        {
32
            var webDriver = cDriver; //potrebuje "using selenium a chrome (firefox)
33
            //priprava promennych
34
            By googleSearchBar = By.Name("q");
35
            By googleSearchButton = By.Name("btnK");
36
            By searchName = By.XPath("//h2//span[text()='Elden Ring']");
37
            By googleCoockieAggreementButton = By.Id("L2AGLb");
38
39
            //prace s driverem
40
            webDriver.Manage().Window.Maximize();
41
            webDriver.Navigate().GoToUrl("https://www.google.com/");    //zakladni stranka
42
            Thread.Sleep(500);
43
44
            webDriver.FindElement(googleCoockieAggreementButton).Click();           //odsouhlaseni coockies
45
            Thread.Sleep(500);
46
47
            webDriver.FindElement(googleSearchBar).SendKeys("Elden Ring");          //napsat Elden Ring do hledani
48
            Thread.Sleep(500);
49
            webDriver.FindElement(googleSearchButton).Click();                      //kliknout na button pro poslani prikazu
50
            Thread.Sleep(500);
51
52
            var resultText = webDriver.FindElement(searchName);                     //najit pomoci xpath pozadovany element a ulozit si ho
53
54
            Assert.IsTrue(resultText.Text == "Elden Ring"); //samotny test pro otestovani stazene hodnoty
55
56
57
            webDriver.Quit();                                                          //ukonceni webdriveru
58
        }
59 782b6d38 Vojtěch Bartička
        */
60 773d1205 schenkj
61
    }
62
}