Projekt

Obecné

Profil

Stáhnout (1.99 KB) Statistiky
| Větev: | Tag: | Revize:
1
using Microsoft.EntityFrameworkCore;
2
using Microsoft.Extensions.Logging;
3
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

    
13

    
14
    [TestClass]
15
    public class MainTestingClass
16
    {
17
        //public TestContext context = new TestContext();
18
        [TestMethod]
19
        public void runAll()
20
        {
21
            
22

    
23
        } 
24

    
25

    
26
        /*
27
        public IWebDriver fDriver = new FirefoxDriver();
28
        public IWebDriver cDriver = new ChromeDriver();
29
        [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
        */
60

    
61
    }
62
}
(8-8/11)