<commit_before>﻿// <copyright file="RunTestsInCloud.cs" company="Automate The Planet Ltd.">
// Copyright 2017 Automate The Planet Ltd.
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
// <author><NAME></author>
// <site>http://automatetheplanet.com/</site>

using System;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;

namespace ExecuteUiTestsCloudCrossBrowserTesting
{
    [TestFixture]
    public class RunTestsInCloud
    {
        private string _username = "<EMAIL>";
        private string _authkey = "<KEY>";
        private IWebDriver _driver;

        [SetUp]
        public void SetupTest()
        {
            ////var caps = new DesiredCapabilities();
            ////caps.SetCapability("name", "Automate The Planet Cloud Tests");
            ////caps.SetCapability("build", "1.0");

            ////caps.SetCapability("browser_api_name", "Edge15");
            ////caps.SetCapability("os_api_name", "Win10-E15");
            ////caps.SetCapability("screen_resolution", "1366x768");

            ////// Not working- there is a bug.
            //////caps.SetCapability("browser_api_name", "FF46");
            //////caps.SetCapability("os_api_name", "Mac10.11");
            //////caps.SetCapability("screen_resolution", "1400x900");


            ////caps.SetCapability("record_video", "true");
            ////caps.SetCapability("record_network", "true");
            ////caps.SetCapability("_username", _username);
            ////caps.SetCapability("password", _authkey);

            ////var hubUri = new Uri("http://hub.crossbrowsertesting.com:80/wd/hub");
            ////_driver = new RemoteWebDriver(hubUri, caps, TimeSpan.FromSeconds(180));

            // Start by setting the capabilities
            var caps = new DesiredCapabilities();
            caps.SetCapability("name", "Basic Example");
            caps.SetCapability("build", "1.0");
            //caps.SetCapability("browser_api_name", "Chrome58");
            //caps.SetCapability("os_api_name", "Win10-E15");
            //caps.SetCapability("screen_resolution", "1366x768");

            caps.SetCapability("browser_api_name", "FF46");
            caps.SetCapability("os_api_name", "Mac10.11");
            caps.SetCapability("screen_resolution", "1400x900");
            caps.SetCapability("record_video", "true");
            caps.SetCapability("record_network", "true");


            caps.SetCapability("username", _username);
            caps.SetCapability("password", _<PASSWORD>);
            
            _driver = new RemoteWebDriver(new Uri("http://hub.crossbrowsertesting.com:80/wd/hub"), caps, TimeSpan.FromSeconds(180));

        }

        [TearDown]
        public void TeardownTest()
        {
            _driver.Quit();
        }

        [Test]
        public void ScrollFocusToControl_InCloud_ShouldFail()
        {
            _driver.Navigate().GoToUrl(@"http://automatetheplanet.com/compelling-sunday-14022016/");
            var link = _driver.FindElement(By.PartialLinkText("Previous post"));<commit_msg>small updates Execute UI Tests in the Cloud- Cross Browser Testing article's code<commit_after>﻿// <copyright file="RunTestsInCloud.cs" company="Automate The Planet Ltd.">
// Copyright 2017 Automate The Planet Ltd.
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
// <author><NAME></author>
// <site>http://automatetheplanet.com/</site>

using System;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;

namespace ExecuteUiTestsCloudCrossBrowserTesting
{
    [TestFixture]
    public class RunTestsInCloud
    {
        private string _username = "<EMAIL>";
        private string _authkey = "<KEY>";
        private IWebDriver _driver;

        [SetUp]
        public void SetupTest()
        {
            var caps = new DesiredCapabilities();
            caps.SetCapability("name", "Basic Example");
            caps.SetCapability("build", "1.0");
            caps.SetCapability("browser_api_name", "Chrome58");
            caps.SetCapability("os_api_name", "Win10-E15");
            caps.SetCapability("screen_resolution", "1366x768");

            //////caps.SetCapability("browser_api_name", "FF46");
            //////caps.SetCapability("os_api_name", "Mac10.11");
            //////caps.SetCapability("screen_resolution", "1400x900");
            caps.SetCapability("record_video", "true");
            caps.SetCapability("record_network", "true");

            caps.SetCapability("username", _username);
            caps.SetCapability("password", _authkey);
            
            _driver = new RemoteWebDriver(new Uri("http://hub.crossbrowsertesting.com:80/wd/hub"), caps, TimeSpan.FromSeconds(180));
        }

        [TearDown]
        public void TeardownTest()
        {
            _driver.Quit();
        }

        [Test]
        public void ScrollFocusToControl_InCloud_ShouldFail()
        {
            _driver.Navigate().GoToUrl(@"http://automatetheplanet.com/compelling-sunday-14022016/");
            var link = _driver.FindElement(By.PartialLinkText("Previous post"));
{'fraction_non_alphanumeric': 0.13454663633409164, 'fraction_numerical': 0.021286967825804356, 'mean_word_length': 2.6790197250448298, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3404968', 'n_tokens_mistral': 1823, 'n_tokens_neox': 1689, 'n_words': 411}