Рефакторинг

parent 0728f409
...@@ -20,13 +20,6 @@ namespace PhoneStore.Tests.Helpers ...@@ -20,13 +20,6 @@ namespace PhoneStore.Tests.Helpers
_driver.Quit(); _driver.Quit();
_driver.Close(); _driver.Close();
} }
public bool IsElementFound(string text)
{
var element = _driver.FindElement(By.XPath($"//*[contains(text(), '{text}')]"));
return element != null;
}
public void GoToUrl(string url) public void GoToUrl(string url)
{ {
_driver.Navigate().GoToUrl(url); _driver.Navigate().GoToUrl(url);
...@@ -44,10 +37,10 @@ namespace PhoneStore.Tests.Helpers ...@@ -44,10 +37,10 @@ namespace PhoneStore.Tests.Helpers
{ {
GoToUrl(RegisterUrl); GoToUrl(RegisterUrl);
} }
public bool IsElementFound(string text)
public void ClickButtonById(string id)
{ {
_driver.FindElement(By.Id(id)).Click(); var element = _driver.FindElement(By.XPath($"//*[contains(text(), '{text}')]"));
return element != null;
} }
public void FillFormField(string fieldId, string text) public void FillFormField(string fieldId, string text)
...@@ -55,5 +48,12 @@ namespace PhoneStore.Tests.Helpers ...@@ -55,5 +48,12 @@ namespace PhoneStore.Tests.Helpers
var field = _driver.FindElement(By.Id(fieldId)); var field = _driver.FindElement(By.Id(fieldId));
field.SendKeys(text); field.SendKeys(text);
} }
public void ClickButtonById(string id)
{
_driver.FindElement(By.Id(id)).Click();
}
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment