Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. package smoke_tests;
  2.  
  3. import DescriptionOperator.MethodsOperator;
  4. import com.codeborne.selenide.Condition;
  5. import options.Common;
  6. import org.junit.jupiter.api.AfterEach;
  7. import org.junit.jupiter.api.BeforeEach;
  8. import org.junit.jupiter.api.Test;
  9. import org.openqa.selenium.By;
  10.  
  11. import java.net.MalformedURLException;
  12. import java.sql.SQLException;
  13.  
  14. import static com.codeborne.selenide.Condition.enabled;
  15. import static com.codeborne.selenide.Condition.visible;
  16. import static com.codeborne.selenide.Selenide.$;
  17. import static com.codeborne.selenide.Selenide.closeWebDriver;
  18. import static org.openqa.selenium.By.xpath;
  19.  
  20. public class Example1 {
  21.  
  22. @BeforeEach
  23. public void setUP() throws SQLException, InterruptedException, MalformedURLException {
  24.  
  25. Common.setup();
  26.  
  27. MethodsOperator.open(Common.settings.url);
  28.  
  29. //Configuration.holdBrowserOpen = true;
  30.  
  31. }
  32.  
  33. @Test
  34. public void Test1() {
  35.  
  36. MethodsOperator.typeLogin(Common.credSettings.login_o);
  37. MethodsOperator.typePassword(Common.credSettings.password_o);
  38. MethodsOperator.clickButtonFieldInLoginForm();
  39. $("[name=\"confirm-false\"]").shouldBe(Condition.enabled).click();
  40.  
  41. }
  42.  
  43. @Test
  44. public void Test2() {
  45. MethodsOperator.typeLogin("Common.credSettings.login_o");
  46. MethodsOperator.typePassword(Common.credSettings.password_o);
  47. MethodsOperator.clickButtonFieldInLoginForm();
  48. //$("[name=\"confirm-false\"]").shouldBe(Condition.enabled).click();
  49. $(By.xpath(".//*[contains(text(),'Неверный логин/пароль')]")).shouldBe(Condition.visible);
  50.  
  51. }
  52.  
  53. @Test
  54. public void Test3() {
  55. MethodsOperator.typeLogin(Common.credSettings.login_o);
  56. MethodsOperator.typePassword(Common.credSettings.password_o);
  57. MethodsOperator.clickButtonFieldInLoginForm();
  58. //$("[name=\"confirm-false\"]").shouldBe(Condition.enabled).click();
  59. $("[name=\"confirm-true\"]").shouldBe(visible);
  60. }
  61.  
  62. @Test
  63. public void Test4() {
  64. MethodsOperator.typeLogin(Common.credSettings.login_o);
  65. MethodsOperator.typePassword(Common.credSettings.password_o);
  66. MethodsOperator.clickButtonFieldInLoginForm();
  67. //$("[name=\"confirm-false\"]").shouldBe(Condition.enabled).click();
  68. $("[name=\"confirm-true\"]").shouldBe(visible);
  69. $(xpath(".//*[contains(text(),'Данные корректны')]")).shouldBe(enabled);
  70. }
  71.  
  72. @Test
  73. public void Test5() {
  74. MethodsOperator.typeLogin(Common.credSettings.login_o);
  75. MethodsOperator.typePassword("Common.credSettings.password_o");
  76. MethodsOperator.clickButtonFieldInLoginForm();
  77. //$("[name=\"confirm-false\"]").shouldBe(Condition.enabled).click();
  78. $(By.xpath(".//*[contains(text(),'Неверный логин/пароль')]")).shouldBe(Condition.visible);
  79. }
  80.  
  81. @Test
  82. public void Test6() {
  83. MethodsOperator.typeLogin(Common.credSettings.login_o);
  84. MethodsOperator.typePassword("Common.credSettings.password_o");
  85. MethodsOperator.clickButtonFieldInLoginForm();
  86. //$("[name=\"confirm-false\"]").shouldBe(Condition.enabled).click();
  87. $(By.xpath(".//*[contains(text(),'Неверный логин/парль')]")).shouldBe(Condition.visible);
  88. }
  89.  
  90.  
  91.  
  92. @AfterEach
  93. public void over(){
  94. //WebDriverRunner.getWebDriver().close();
  95. closeWebDriver();
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement