<commit_before>﻿/* Copyright (c) 2012 Inish Technology Ventures Limited.  All rights reserved.
 * 
 * This code is licensed under the BSD 3-Clause License included with this source
 * 
 * FOR DETAILS, SEE https://github.com/InishTech/Sp.Api/wiki/License */
namespace Sp.Api.Customer.Html.Acceptance
{
	using OpenQA.Selenium;
	using OpenQA.Selenium.Remote;
	using Sp.Api.Shared;
	using Sp.Test.Html;
	using System;
	using System.Linq;
	using Xunit;
	using Xunit.Extensions;

	public class CustomerCreate
	{
		[Theory, ClassData( typeof( RemoteWebDriverAndAuthenticatingNavigatorProvider<SoftwarePotentialDataFixture> ) )]
		public static void CreateCustomerShouldSucceed( RemoteWebDriver driver, AuthenticatingNavigator navigator )
		{
			using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
			{
				navigator.NavigateWithAuthenticate( driver, "Sp.Web.CustomerManagement/customer/Create" );

				IWebElement nameElement = driver.FindElement( By.Id( "name" ) );
				string anonymousCustomerName = "anonymousName" + Guid.NewGuid();
				nameElement.SendKeys( anonymousCustomerName );

				IWebElement descriptionElement = driver.FindElement( By.Id( "description" ) );
				descriptionElement.SendKeys( "anonymousDescription" );

				IWebElement createButton = driver.FindElement( By.Id( "add-customer" ) );
				createButton.Click();

				var names = driver.FindElementsByClassName( "customerName" );
				Assert.True( names.Any( x => x.Text.Equals( anonymousCustomerName ) ) );
			}
		}
	}<commit_msg>Initial fix for broken customer test due to changed expectations on success<commit_after>﻿/* Copyright (c) 2012 Inish Technology Ventures Limited.  All rights reserved.
 * 
 * This code is licensed under the BSD 3-Clause License included with this source
 * 
 * FOR DETAILS, SEE https://github.com/InishTech/Sp.Api/wiki/License */
namespace Sp.Api.Customer.Html.Acceptance
{
	using OpenQA.Selenium;
	using OpenQA.Selenium.Remote;
	using Sp.Api.Shared;
	using Sp.Test.Html;
	using System;
	using System.Linq;
	using Xunit;
	using Xunit.Extensions;
	using OpenQA.Selenium.Support.UI;

	public class CustomerCreate
	{
		[Theory, ClassData( typeof( RemoteWebDriverAndAuthenticatingNavigatorProvider<SoftwarePotentialDataFixture> ) )]
		public static void CreateCustomerShouldSucceed( RemoteWebDriver driver, AuthenticatingNavigator navigator )
		{
			using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
			{
				navigator.NavigateWithAuthenticate( driver, "Sp.Web.CustomerManagement/Customer/Create" );

				WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
				wait.Until( d => d.FindElement( By.Id( "create-view" ) ) );
				IWebElement nameElement = driver.FindElement( By.Id( "name" ) );
				string anonymousCustomerName = "anonymousName" + Guid.NewGuid();
				nameElement.SendKeys( anonymousCustomerName );

				IWebElement descriptionElement = driver.FindElement( By.Id( "description" ) );
				descriptionElement.SendKeys( "anonymousDescription" );

				IWebElement createButton = driver.FindElement( By.Id( "add-customer" ) );
				createButton.Click();

				wait.Until( d => d
					.FindElement( By.Id( "messages" ) )
					.Text.Equals( "Customer created successfully" ) );
			}
		}
	}
{'fraction_non_alphanumeric': 0.11026615969581749, 'fraction_numerical': 0.009066978648727698, 'mean_word_length': 4.428571428571429, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 2, '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': '364705', 'n_tokens_mistral': 1168, 'n_tokens_neox': 1025, 'n_words': 238}