Skip to content

Commit

Permalink
Fixed Warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmmay committed Jun 8, 2022
1 parent eda74e6 commit 56309fa
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 37 deletions.
Binary file modified ConjuringTests/.vs/ConjuringTests/v17/.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion ConjuringTests/BasementPageObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void ClickPiano()
public Boolean VerifyPianoAlertAppears()
{
// Waiting for Alert
WebDriverWait wait = new WebDriverWait(_webDriver, TimeSpan.FromSeconds(10));
WebDriverWait wait = new(_webDriver, TimeSpan.FromSeconds(10));
wait.IgnoreExceptionTypes(typeof(NoAlertPresentException));
IAlert alert = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.AlertIsPresent());
if (alert != null)
Expand Down
12 changes: 6 additions & 6 deletions ConjuringTests/BedroomBPageObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,24 @@ public BedroomBPageObject(IWebDriver webDriver)
_webDriver = webDriver;
}

private IWebElement slider => _webDriver.FindElement(By.XPath("//input[@type='range']"));
private IWebElement Slider => _webDriver.FindElement(By.XPath("//input[@type='range']"));

public void RaiseAndLowerSlider()
{
new WebDriverWait(_webDriver, TimeSpan.FromSeconds(10)).Until(e => e.FindElement(By.XPath("//input[@type='range']")));
while (slider.GetAttribute("value") != "5")
while (Slider.GetAttribute("value") != "5")
{
slider.SendKeys(Keys.ArrowRight);
Slider.SendKeys(Keys.ArrowRight);
}
while (slider.GetAttribute("value") != "0")
while (Slider.GetAttribute("value") != "0")
{
slider.SendKeys(Keys.ArrowLeft);
Slider.SendKeys(Keys.ArrowLeft);
}
}

public String GetSliderValue()
{
return slider.GetAttribute("value");
return Slider.GetAttribute("value");
}
}
}
30 changes: 15 additions & 15 deletions ConjuringTests/BedroomGPageObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ public BedroomGPageObject(IWebDriver webDriver)
{
_webDriver = webDriver;
}
private IWebElement wardrobe => _webDriver.FindElement(By.XPath("//img[@onclick='hide()']"));
private IWebElement Wardrobe => _webDriver.FindElement(By.XPath("//img[@onclick='hide()']"));

private IWebElement weightInput => _webDriver.FindElement(By.XPath("//input[@type='number']"));
private IWebElement submitButton => _webDriver.FindElement(By.XPath("//input[@onclick='fall()']"));
private IWebElement resultsText => _webDriver.FindElement(By.XPath("//h6[@class='text-danger']"));
private IWebElement WeightInput => _webDriver.FindElement(By.XPath("//input[@type='number']"));
private IWebElement SubmitButton => _webDriver.FindElement(By.XPath("//input[@onclick='fall()']"));
private IWebElement ResultsText => _webDriver.FindElement(By.XPath("//h6[@class='text-danger']"));

public Boolean ClickWardrobeAndAlert()
{
new WebDriverWait(_webDriver, TimeSpan.FromSeconds(10)).Until(e => e.FindElement(By.XPath("//img[@onclick='hide()']")));
wardrobe.Click();
Wardrobe.Click();
// Waiting for Alert
WebDriverWait wait = new WebDriverWait(_webDriver, TimeSpan.FromSeconds(10));
WebDriverWait wait = new(_webDriver, TimeSpan.FromSeconds(10));
wait.IgnoreExceptionTypes(typeof(NoAlertPresentException));
IAlert alert = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.AlertIsPresent());
if (alert != null)
Expand All @@ -35,28 +35,28 @@ public Boolean ClickWardrobeAndAlert()
public void EnterWeightAndSubmit(int weight)
{
new WebDriverWait(_webDriver, TimeSpan.FromSeconds(10)).Until(e => e.FindElement(By.XPath("//input[@type='number']")));
weightInput.Clear();
weightInput.SendKeys(weight.ToString());
WeightInput.Clear();
WeightInput.SendKeys(weight.ToString());
new WebDriverWait(_webDriver, TimeSpan.FromSeconds(10)).Until(e => e.FindElement(By.XPath("//input[@onclick='fall()']")));
submitButton.Click();
SubmitButton.Click();
}

public void RepeatStepsAndEnterHighWeight(int weight)
{
wardrobe.Click();
Wardrobe.Click();
// Waiting for Alert
WebDriverWait wait = new WebDriverWait(_webDriver, TimeSpan.FromSeconds(10));
WebDriverWait wait = new(_webDriver, TimeSpan.FromSeconds(10));
wait.IgnoreExceptionTypes(typeof(NoAlertPresentException));
wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.AlertIsPresent());
_webDriver.SwitchTo().Alert().Accept();
weightInput.Clear();
weightInput.SendKeys(weight.ToString());
submitButton.Click();
WeightInput.Clear();
WeightInput.SendKeys(weight.ToString());
SubmitButton.Click();
}

public String GetWeightFormResultsText()
{
return resultsText.Text;
return ResultsText.Text;
}
}
}
7 changes: 5 additions & 2 deletions ConjuringTests/Drivers/BrowserDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using OpenQA.Selenium.Chrome;
namespace ConjuringTests.Drivers
{
public class BrowserDriver : IDisposable
public class BrowserDriver // : IDisposable
{
private readonly Lazy<IWebDriver> _currentWebDriverLazy;
private bool _isDisposed;
// private bool _isDisposed;

public BrowserDriver()
{
Expand All @@ -25,6 +25,8 @@ private IWebDriver CreateWebDriver()
var chromeDriver = new ChromeDriver(chromeDriverService, chromeOptions);
return chromeDriver;
}

/*
public void Dispose()
{
if (_isDisposed)
Expand All @@ -39,5 +41,6 @@ public void Dispose()
_isDisposed = true;
}
*/
}
}
2 changes: 1 addition & 1 deletion ConjuringTests/HomePageObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ConjuringTests.Pages
{
public class HomePageObject
{
private string _homepageURL = URLUtil.CreatePath("");
private readonly string _homepageURL = URLUtil.CreatePath("");

private readonly IWebDriver _webDriver;

Expand Down
10 changes: 5 additions & 5 deletions ConjuringTests/OutsidePageObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ public OutsidePageObject(IWebDriver webDriver)
_webDriver = webDriver;
}

private IWebElement crow => _webDriver.FindElement(By.XPath("//img[@onclick='possessCrow()']"));
private IWebElement Crow => _webDriver.FindElement(By.XPath("//img[@onclick='possessCrow()']"));

private IWebElement crowCounter => _webDriver.FindElement(By.XPath("//span"));
private IWebElement CrowCounter => _webDriver.FindElement(By.XPath("//span"));

public void Click20Crows()
{
new WebDriverWait(_webDriver, TimeSpan.FromSeconds(10)).Until(e => e.FindElement(By.XPath("//img[@onclick='possessCrow()']")));
while (crowCounter.Text != "20")
while (CrowCounter.Text != "20")
{
crow.Click();
Crow.Click();
}
}

public String GetCrowCount()
{
return crowCounter.Text;
return CrowCounter.Text;
}
}
}
8 changes: 1 addition & 7 deletions ConjuringTests/URLUtil.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
namespace ConjuringTests.Utils {
public static class URLUtil
{
private static string _baseUrl = "https://ethanmmay.github.io/conjuring-site";
private static readonly string _baseUrl = "https://ethanmmay.github.io/conjuring-site";

public static string CreatePath(string subpath) {
return $"{_baseUrl}/{subpath}";
}
}

class HeaderNavigation {
public void NavigateTo(string searchKeyword) {

}
}
}

0 comments on commit 56309fa

Please sign in to comment.