﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Bonobo.Git.Server.Controllers;
using Bonobo.Git.Server.Test.Integration.Web;
using Bonobo.Git.Server.Test.IntegrationTests.Helpers;
using SpecsFor.Mvc;

namespace Bonobo.Git.Server.Test.IntegrationTests
{
    using OpenQA.Selenium.Support.UI;
    using OpenQA.Selenium;

    [TestClass]
    public class SharedLayoutTests : IntegrationTestBase
    {
        [TestMethod, TestCategory(TestCategories.WebIntegrationTest)]
        public void DropdownNavigationWorks()
        {
            var reponame = "A_Nice_Repo";
            var id1 = ITH.CreateRepositoryOnWebInterface(reponame);
            var id2 = ITH.CreateRepositoryOnWebInterface("other_name");

            app.NavigateTo<RepositoryController>(c => c.Detail(id2));

            var element = app.Browser.FindElementByCssSelector("select#Repositories");
            var dropdown = new SelectElement(element);
            dropdown.SelectByText(reponame);

            app.UrlMapsTo<RepositoryController>(c => c.Detail(id1));


            app.WaitForElementToBeVisible(By.CssSelector("select#Repositories"), TimeSpan.FromSeconds(10));
            dropdown = new SelectElement(app.Browser.FindElementByCssSelector("select#Repositories"));
            dropdown.SelectByText("other_name");

            app.UrlMapsTo<RepositoryController>(c => c.Detail(id2));
        }

    }
}

﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Bonobo.Git.Server.Controllers;
using Bonobo.Git.Server.Test.Integration.Web;
using Bonobo.Git.Server.Test.IntegrationTests.Helpers;
using SpecsFor.Mvc;

namespace Bonobo.Git.Server.Test.IntegrationTests
{
    using OpenQA.Selenium.Support.UI;
    using OpenQA.Selenium;
    using System.Threading;

    [TestClass]
    public class SharedLayoutTests : IntegrationTestBase
    {
        [TestMethod, TestCategory(TestCategories.WebIntegrationTest)]
        public void DropdownNavigationWorks()
        {
            var reponame = ITH.MakeName();
            var otherreponame = ITH.MakeName(reponame + "_other");
            var repoId = ITH.CreateRepositoryOnWebInterface(reponame);
            var otherrepoId = ITH.CreateRepositoryOnWebInterface(otherreponame);

            app.NavigateTo<RepositoryController>(c => c.Detail(otherrepoId));

            var element = app.Browser.FindElementByCssSelector("select#Repositories");
            var dropdown = new SelectElement(element);
            dropdown.SelectByText(reponame);
            Thread.Sleep(2000);

            app.UrlMapsTo<RepositoryController>(c => c.Detail(repoId));

            app.WaitForElementToBeVisible(By.CssSelector("select#Repositories"), TimeSpan.FromSeconds(10));
            dropdown = new SelectElement(app.Browser.FindElementByCssSelector("select#Repositories"));
            dropdown.SelectByText(otherreponame);
            Thread.Sleep(2000);

            app.UrlMapsTo<RepositoryController>(c => c.Detail(otherrepoId));
        }

    }
}

Make DropdDownNavigationWorks more reliable and use new test methods.
Make DropdDownNavigationWorks more reliable and use new test methods.
