<commit_before>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Interactions;
using Riganti.Utils.Testing.SeleniumCore;
using System;
using System.Globalization;
using System.Linq;
using System.Threading;
using Dotvvm.Samples.Tests;

namespace DotVVM.Samples.Tests.Complex
{
    [TestClass]
    public class InvoiceCalculatorTests : SeleniumTestBase
    {
        [TestMethod]
        public void Complex_InvoiceCalculator()
        {
            RunInAllBrowsers(browser =>
            {
                browser.NavigateToUrl( SamplesRouteUrls.ComplexSamples_InvoiceCalculator_InvoiceCalculator);
                var table = browser.First(".table");
                var addButton = browser.ElementAt("a", 1);
                var recalculateButton = browser.ElementAt("a", 2);

                // add lines
                addButton.Click();
                browser.Wait();
                addButton.Click();
                browser.Wait();
                addButton.Click();
                browser.Wait();

                // fill second line
                var cells = table.ElementAt("tr", 2).FindElements("td");
                cells.ElementAt(0).First("input").Clear().SendKeys("111");
                cells.ElementAt(1).First("select").Select(1);
                cells.ElementAt(2).First("input").Clear().SendKeys("Bread");
                cells.ElementAt(3).First("input").Clear().SendKeys("12");
                cells.ElementAt(4).First("input").Clear().SendKeys("10");

                // fill third line
                cells = table.ElementAt("tr", 3).FindElements("td");
                cells.ElementAt(0).First("input").Clear().SendKeys("222");
                cells.ElementAt(1).First("select").Select(2);
                cells.ElementAt(2).First("input").Clear().SendKeys("Ham");
                cells.ElementAt(3).First("input").Clear().SendKeys("1");
                cells.ElementAt(4).First("input").Clear().SendKeys("5");

                // fill fourth line
                cells = table.ElementAt("tr", 4).FindElements("td");
                cells.ElementAt(0).First("input").Clear().SendKeys("333");
                cells.ElementAt(1).First("select").Select(3);
                cells.ElementAt(2).First("input").Clear().SendKeys("Cheese");
                cells.ElementAt(3).First("input").Clear().SendKeys("10");
                cells.ElementAt(4).First("input").Clear().SendKeys("15");

                // verify line totals
                browser.First("input[type=text]").Click();
<commit_msg>Waits added to the invoice calculator tests<commit_after>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Interactions;
using Riganti.Utils.Testing.SeleniumCore;
using System;
using System.Globalization;
using System.Linq;
using System.Threading;
using Dotvvm.Samples.Tests;

namespace DotVVM.Samples.Tests.Complex
{
    [TestClass]
    public class InvoiceCalculatorTests : SeleniumTestBase
    {
        [TestMethod]
        public void Complex_InvoiceCalculator()
        {
            RunInAllBrowsers(browser =>
            {
                browser.NavigateToUrl(SamplesRouteUrls.ComplexSamples_InvoiceCalculator_InvoiceCalculator);
                var table = browser.First(".table");
                var addButton = browser.ElementAt("a", 1);
                var recalculateButton = browser.ElementAt("a", 2);

                // add lines
                addButton.Click();
                browser.Wait();
                addButton.Click();
                browser.Wait();
                addButton.Click();
                browser.Wait();

                // fill second line
                var cells = table.ElementAt("tr", 2).FindElements("td");
                cells.ElementAt(0).First("input").Clear().SendKeys("111");
                cells.ElementAt(1).First("select").Select(1).Wait();
                cells.ElementAt(2).First("input").Clear().SendKeys("Bread");
                cells.ElementAt(3).First("input").Clear().SendKeys("12");
                cells.ElementAt(4).First("input").Clear().SendKeys("10");

                // fill third line
                cells = table.ElementAt("tr", 3).FindElements("td");
                cells.ElementAt(0).First("input").Clear().SendKeys("222");
                cells.ElementAt(1).First("select").Select(2).Wait();
                cells.ElementAt(2).First("input").Clear().SendKeys("Ham");
                cells.ElementAt(3).First("input").Clear().SendKeys("1");
                cells.ElementAt(4).First("input").Clear().SendKeys("5");

                // fill fourth line
                cells = table.ElementAt("tr", 4).FindElements("td");
                cells.ElementAt(0).First("input").Clear().SendKeys("333");
                cells.ElementAt(1).First("select").Select(3).Wait();
                cells.ElementAt(2).First("input").Clear().SendKeys("Cheese");
                cells.ElementAt(3).First("input").Clear().SendKeys("10");
                cells.ElementAt(4).First("input").Clear().SendKeys("15");

                // verify line totals
                browser.First("input[type=text]").Click();

{'fraction_non_alphanumeric': 0.1550462249614792, 'fraction_numerical': 0.016178736517719568, 'mean_word_length': 2.1491813220133413, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '135004', 'n_tokens_mistral': 1482, 'n_tokens_neox': 1339, 'n_words': 183}