Example #1
0
        public void MyCardsPage_CollectionIsDownloaded_FileFound()
        {
            driver.Close();
            string downloadPath  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var    chromeOptions = new ChromeOptions();

            chromeOptions.AddArguments("--browser.download.folderList=2");
            chromeOptions.AddArguments("--browser.helperApps.neverAsk.saveToDisk=text/plain");
            chromeOptions.AddArguments("--browser.download.dir=" + downloadPath);
            chromeOptions.AddUserProfilePreference("download.prompt_for_download", false);
            chromeOptions.AddUserProfilePreference("download.directory_upgrade", true);
            chromeOptions.AddUserProfilePreference("download.default_directory", downloadPath);
            chromeOptions.AddUserProfilePreference("intl.accept_languages", "nl");
            chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true");
            driver = new ChromeDriver(chromeOptions);

            Login();
            RemoveAllCards();
            UploadTests.UploadCard(driver, 1, "Raichu");
            driver.Navigate().GoToUrl(homeURL + MyCardsURL);
            IWebElement downloadLink = driver.FindElement(By.LinkText("Download Your Card Information"));
            string      path         = downloadLink.GetAttribute("href");

            driver.Navigate().GoToUrl(path);
            var timeAtPause = DateTime.Now;
            var seconds     = TimeSpan.FromSeconds(3);
            var wait        = new WebDriverWait(driver, seconds);

            wait.PollingInterval = TimeSpan.FromMilliseconds(1000);
            wait.Until(wd => (DateTime.Now - timeAtPause) - seconds > TimeSpan.Zero);
            string finalPath = downloadPath + "\\Collection.csv";

            Assert.True(File.Exists(finalPath));
            File.Delete(finalPath);
        }
Example #2
0
        public void MyCardsPage_CheckRemoveLinkExistsWhenCardExists_RemoveLinkExists()
        {
            Login();
            RemoveAllCards();
            UploadTests.UploadCard(driver, 1, "Raichu");
            driver.Navigate().GoToUrl(homeURL + MyCardsURL);
            IWebElement removeButton = driver.FindElement(By.Id("Remove"));

            Assert.IsNotNull(removeButton);
        }
Example #3
0
        public void MyCardsPage_FindNewCard_CardFoundOnMyCards()
        {
            Login();
            RemoveAllCards();
            UploadTests.UploadCard(driver, 1, "Raichu");
            driver.Navigate().GoToUrl(homeURL + MyCardsURL);
            IWebElement cardName = driver.FindElement(By.Id("Name"));

            Assert.AreEqual(cardName.Text, "Raichu");
        }
Example #4
0
        public void MyCardsPage_CheckCardValue_CardValueFound()
        {
            Login();
            RemoveAllCards();
            UploadTests.UploadCard(driver, 1, "Raichu");
            driver.Navigate().GoToUrl(homeURL + MyCardsURL);
            IWebElement Value = null;

            try
            {
                Value = driver.FindElement(By.Id("Value"));
            }
            catch { }
            Assert.IsNotNull(Value);
        }
Example #5
0
        public void MyCardsPage_DownloadLinkExists_LinkFound()
        {
            Login();
            RemoveAllCards();
            UploadTests.UploadCard(driver, 1, "Raichu");
            driver.Navigate().GoToUrl(homeURL + MyCardsURL);
            IWebElement downloadLink = null;

            try
            {
                downloadLink = driver.FindElement(By.Id("download"));
            }
            catch { }
            Assert.IsNotNull(downloadLink);
        }
Example #6
0
        public void MyCardsPage_RemoveACard_CardIsRemoved()
        {
            Login();
            RemoveAllCards();
            UploadTests.UploadCard(driver, 1, "Raichu");
            driver.Navigate().GoToUrl(homeURL + MyCardsURL);
            IWebElement removeButton = driver.FindElement(By.Id("Remove"));
            Actions     action       = new Actions(driver);

            action.MoveToElement(removeButton).Perform();
            //Waiting for the menu to be displayed
            System.Threading.Thread.Sleep(2000);
            removeButton.Click();
            driver.Navigate().GoToUrl(homeURL + MyCardsURL);
            IWebElement cardName = null;

            try
            {
                cardName = driver.FindElement(By.Id("Name"));
            }
            catch { }
            Assert.IsNull(cardName);
        }