diff --git a/.DS_Store b/.DS_Store
index 16b599b..7b0093d 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..639900d
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..3cc8d3a
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/software-testing.iml b/.idea/software-testing.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/.idea/software-testing.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tpo_lab3/app.properties b/tpo_lab3/app.properties
new file mode 100644
index 0000000..0b4ee1a
--- /dev/null
+++ b/tpo_lab3/app.properties
@@ -0,0 +1,4 @@
+BIG_BOOBS=true
+HOT_CHICKS=true
+WEB_DRIVER=firefox
+
diff --git a/tpo_lab3/pom.xml b/tpo_lab3/pom.xml
new file mode 100644
index 0000000..700c227
--- /dev/null
+++ b/tpo_lab3/pom.xml
@@ -0,0 +1,94 @@
+
+ 4.0.0
+ org.example
+ tpo_lab3
+ 1.0.0
+
+
+ 17
+ 17
+
+
+
+
+ org.seleniumhq.selenium
+ selenium-java
+ 4.19.1
+
+
+ com.github.seratch
+ java-time-backport
+ 1.0.0
+
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ 5.10.2
+ test
+
+
+ joda-time
+ joda-time
+ 2.9.1
+
+
+
+
+
+
+
+
+ maven-clean-plugin
+ 3.1.0
+
+
+
+ maven-resources-plugin
+ 3.0.2
+
+
+ maven-compiler-plugin
+ 3.8.0
+
+
+ maven-surefire-plugin
+ 2.22.1
+
+
+ maven-jar-plugin
+ 3.0.2
+
+
+ maven-install-plugin
+ 2.5.2
+
+
+ maven-deploy-plugin
+ 2.8.2
+
+
+
+ maven-site-plugin
+ 3.7.1
+
+
+ maven-project-info-reports-plugin
+ 3.0.0
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 17
+ 17
+
+
+
+ src/main/java
+ src/test/java
+
+
diff --git a/tpo_lab3/src/main/java/org/example/Utils.java b/tpo_lab3/src/main/java/org/example/Utils.java
new file mode 100644
index 0000000..1e1b1a3
--- /dev/null
+++ b/tpo_lab3/src/main/java/org/example/Utils.java
@@ -0,0 +1,42 @@
+package org.example;
+
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+import java.util.List;
+
+public class Utils {
+ public static final String DEFAULT_URL = "https://www.answers.com/";
+
+ private static FirefoxDriver firefoxDriver;
+
+ private static ChromeDriver chromeDriver;
+
+ public static FirefoxDriver getFireFoxDriver() {
+ if (firefoxDriver == null) {
+ firefoxDriver = new FirefoxDriver();
+ }
+ return firefoxDriver;
+ }
+
+ public static ChromeDriver getChromeDriver() {
+ if (chromeDriver == null) {
+ chromeDriver = new ChromeDriver();
+ }
+ return chromeDriver;
+ }
+
+ public static List getDrivers() {
+ return List.of(
+ getChromeDriver()//,
+ // getFireFoxDriver()
+ );
+ }
+
+ public static void wait10Sec(WebDriver webDriver) {
+ webDriver.manage().timeouts().implicitlyWait(Duration.of(10, ChronoUnit.SECONDS));
+ }
+}
diff --git a/tpo_lab3/src/main/java/org/example/pages/CreatInformation.java b/tpo_lab3/src/main/java/org/example/pages/CreatInformation.java
new file mode 100644
index 0000000..f5c7583
--- /dev/null
+++ b/tpo_lab3/src/main/java/org/example/pages/CreatInformation.java
@@ -0,0 +1,138 @@
+package org.example.pages;
+
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+
+import java.util.List;
+
+public class CreatInformation {
+
+ public CreatInformation(WebDriver webDriver) {
+ PageFactory.initElements(webDriver, this);
+ }
+
+ @FindBy(xpath = "//*[@class=\"block focus:outline-none\"]/button")
+ private WebElement creatSomeThing;
+
+ @FindBy(xpath = "//*[@class=\"undefined undefined\"]/../span[1]/button/img")
+ private WebElement creatQuestion;
+
+ @FindBy(xpath = "//*[@class=\"undefined undefined\"]/../span[2]/button/img")
+ private WebElement studyGuide;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div/div[2]/div[1]/textarea")
+ //*[@id="root"]/div/div[4]/div/div[2]
+ //*[@id="root"]/div/div[4]/div/div[2]/div/div[2]/div[1]/textarea
+ private WebElement textQuestion;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div/div[1]/button[2]")
+ private WebElement submitQuestion;
+
+ @FindBy(xpath = "//*[@id=\"question-title\"]")
+ private WebElement answer;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div/div[2]/div/div[2]/button/span\n")
+ private WebElement clickForAnswer;
+
+ @FindBy(xpath = "//*[@class=\"p-4 bg-white md:rounded shadow-cardGlow\"]/div[3]/textarea")
+ private WebElement addATitle;
+
+ @FindBy(xpath = "//*[@class=\"p-4 bg-white md:rounded shadow-cardGlow\"]/div[5]/textarea")
+ private WebElement addADescription;
+
+ @FindBy(xpath = "//*[@class=\" relative flex flex-row whitespace-nowrap space-x-2 no-scrollbar \"]/div[1]/input")
+ private WebElement addTags1;
+
+ @FindBy(xpath = "//*[@class=\" relative flex flex-row whitespace-nowrap space-x-2 no-scrollbar \"]/div[2]/input")
+ private WebElement addTags2;
+
+ @FindBy(xpath = "//*[@class=\" relative flex flex-row whitespace-nowrap space-x-2 no-scrollbar \"]/div[3]/input")
+ private WebElement addTags3;
+
+ @FindBy(xpath = "//*[@id=\"editGuides\"]/div/div[1]/div[1]")
+
+ private WebElement addTerm;
+
+ @FindBy(xpath = "//*[@id=\"editGuides\"]/div/div[2]/div[1]")
+ private WebElement addDefinition;
+
+ @FindBy(xpath = "//*[@class=\"p-4 mt-4 bg-white md:rounded shadow-cardGlow\"]/div[2]/button[1]")
+ private WebElement addNewCard;
+ @FindBy(xpath = "//*[@id=\"editGuides\"]/../../div[2]/div/div/div[1]/div[1]")
+ private WebElement addTerm1;
+
+ @FindBy(xpath = "//*[@id=\"editGuides\"]/../../div[2]/div/div/div[2]/div[1]")
+ private WebElement addDefinition1;
+
+ @FindBy(xpath = "//*[text()='What color are the socks!!!!!']")
+ private WebElement textGuide;
+
+ @FindBy(xpath = "//*[@id=\"createButton\"]")
+ private WebElement creatGuide;
+
+
+ public WebElement getClickForAnswer() {
+ return clickForAnswer;
+ }
+
+ public WebElement getTextGuide() {
+ return textGuide;
+ }
+ public WebElement getCreatGuide() {
+ return creatGuide;
+ }
+ public WebElement getAddTerm1() {
+ return addTerm1;
+ }
+ public WebElement getAddDefinition1() {
+ return addDefinition1;
+ }
+ public WebElement getAddNewCard() {
+ return addNewCard;
+ }
+ public WebElement getAddTerm() {
+ return addTerm;
+ }
+ public WebElement getAddDefinition() {
+ return addDefinition;
+ }
+
+ public WebElement getAddTags1() {
+ return addTags1;
+ }
+ public WebElement getAddTags2() {
+ return addTags2;
+ }
+ public WebElement getAddTags3() {
+ return addTags3;
+ }
+
+ public WebElement getAddATitle() {
+ return addATitle;
+ }
+ public WebElement getAddADescription() {
+ return addADescription;
+ }
+
+ public WebElement getCreatSomeThing() {
+ return creatSomeThing;
+ }
+ public WebElement getAnswer() {
+ return answer;
+ }
+ public WebElement getSubmitQuestion() {
+ return submitQuestion;
+ }
+ public WebElement getTextQuestion(){
+ return textQuestion;
+ }
+
+ public WebElement getCreatQuestion() {
+ return creatQuestion;
+ }
+ public WebElement getStudyGuide() {
+ return studyGuide;
+ }
+}
diff --git a/tpo_lab3/src/main/java/org/example/pages/LoginPage.java b/tpo_lab3/src/main/java/org/example/pages/LoginPage.java
new file mode 100644
index 0000000..4f76444
--- /dev/null
+++ b/tpo_lab3/src/main/java/org/example/pages/LoginPage.java
@@ -0,0 +1,82 @@
+package org.example.pages;
+
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+
+public class LoginPage {
+
+ private WebDriver webDriver;
+
+ public LoginPage(WebDriver webDriver) {
+ PageFactory.initElements(webDriver, this);
+ this.webDriver = webDriver;
+ }
+
+ @FindBy(xpath = "//*[text()='Log in']")
+ private WebElement logInButton;
+
+
+ @FindBy(xpath = "//*[text()='Log in with email']")
+ private WebElement logInWithEmail;
+
+ @FindBy(xpath = "//*[@type=\"submit\"]")
+ private WebElement submit;
+
+
+ @FindBy(xpath = "//*[@id=\"email-input\"]")
+ private WebElement emailField;
+
+
+ @FindBy(xpath = "//*[@id=\"outlined-adornment-password\"]")
+ private WebElement passwordField;
+
+ @FindBy(xpath = "//*[@id=\"profile-menu\"]/span/img")
+ private WebElement avatar;
+
+
+ @FindBy(xpath = "//*[@href=\'https://www.answers.com/logout']/span")
+ // @FindBy(xpath = "//*[@id=\"root\"]/div/div[1]/div/div[4]/div[3]/span/div/div/div/button[3]/a/span")
+ private WebElement logUot;
+
+ @FindBy(xpath = "//*[@id=\"loginUser\"]/div[2]/span")
+ private WebElement errorMessage;
+
+ public WebElement getEmailField() {
+ return emailField;
+ }
+
+
+ public WebElement getPasswordField() {
+ return passwordField;
+ }
+
+ public WebElement getSignInButton() {
+ return logInButton;
+ }
+
+ public WebElement getSignInButtonWhitEmail() {
+ return logInWithEmail;
+ }
+ public WebElement getSubmit() {
+ return submit;
+ }
+
+ public WebElement getAvatar() {
+ return avatar;
+ }
+
+ public WebElement getLogUot() {
+ return logUot;
+ }
+
+
+ public WebDriver getWebDriver() {
+ return webDriver;
+ }
+
+ public WebElement getErrorMessage() {
+ return errorMessage;
+ }
+}
diff --git a/tpo_lab3/src/main/java/org/example/pages/Profile.java b/tpo_lab3/src/main/java/org/example/pages/Profile.java
new file mode 100644
index 0000000..5b7a522
--- /dev/null
+++ b/tpo_lab3/src/main/java/org/example/pages/Profile.java
@@ -0,0 +1,73 @@
+package org.example.pages;
+
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+
+public class Profile {
+
+ private WebDriver webDriver;
+
+ public Profile(WebDriver webDriver) {
+ PageFactory.initElements(webDriver, this);
+ this.webDriver = webDriver;
+ }
+
+ @FindBy(xpath = "//*[@id=\"profile-menu\"]/span/img")
+ private WebElement clickAvatar;
+
+
+ @FindBy(xpath = "//*[@href=\'https://www.answers.com/user/profile']/span")
+ private WebElement clickSettings;
+
+ //*[@id="checkbox"]/input
+
+ @FindBy(xpath = "//*[@value=\"optInEmail\"]/input")
+ private WebElement clickCheckBoxEmail;
+
+ @FindBy(xpath = "//*[@value=\"optInEmailNotifications\"]/input")
+ private WebElement clickCheckBoxEmail2;
+
+ @FindBy(xpath = "//*[@value=\"optInDatabaseNotifications\"]/input")
+ private WebElement clickCheckBoxEmail3;
+
+ @FindBy(xpath = "//*[@value=\"optInNotifications\"]/input")
+ private WebElement clickCheckBoxEmail4;
+
+ @FindBy(xpath = "//*[@value=\"optInPpid\"]/input")
+ private WebElement clickCheckBoxEmail5;
+
+
+ public WebElement getClickCheckBoxEmail2() {
+ return clickCheckBoxEmail2;
+ }
+
+ public WebElement getClickCheckBoxEmail3() {
+ return clickCheckBoxEmail3;
+ }
+
+ public WebElement getClickCheckBoxEmail5() {
+ return clickCheckBoxEmail5;
+ }
+
+ public WebElement getClickCheckBoxEmail4() {
+ return clickCheckBoxEmail4;
+ }
+
+ public WebElement getClickAvatar() {
+ return clickAvatar;
+ }
+
+ public WebElement getClickSettings() {
+ return clickSettings;
+ }
+
+ public WebElement getClickCheckBoxEmail() {
+ return clickCheckBoxEmail;
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/tpo_lab3/src/main/java/org/example/pages/SearchAdvanceAnswer.java b/tpo_lab3/src/main/java/org/example/pages/SearchAdvanceAnswer.java
new file mode 100644
index 0000000..a2de26b
--- /dev/null
+++ b/tpo_lab3/src/main/java/org/example/pages/SearchAdvanceAnswer.java
@@ -0,0 +1,104 @@
+package org.example.pages;
+
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+
+public class SearchAdvanceAnswer {
+
+ private WebDriver webDriver;
+
+ public SearchAdvanceAnswer(WebDriver webDriver) {
+ PageFactory.initElements(webDriver, this);
+ this.webDriver = webDriver;
+ }
+
+ @FindBy(xpath = "//*[name()='use' and @*='#adv-config']")
+ private WebElement openAdvanceSearch;
+
+ @FindBy(xpath = "//*[@type=\"text\"]")
+ private WebElement searchTerm;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div[2]/button/div")
+ private WebElement contentType;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div[2]/div/div/span[1]/span")
+ private WebElement selectСontentType;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div[3]/button/div")
+ private WebElement subject;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div[3]/div/div/span[1]/span")
+ private WebElement selectsubject;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div[4]/button/div")
+ private WebElement category;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div[4]/div/div/span[2]/span")
+ private WebElement selectCategory;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div[5]/div[3]/input")
+ private WebElement selectRadio;
+
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div[6]/button/div")
+ private WebElement sortBy;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div[6]/div/div/span[1]")
+ private WebElement selectSortBy;
+
+ @FindBy(xpath = "//*[@role=\"dialog\"]/div[7]/button")
+ private WebElement search;
+
+ @FindBy(xpath = "//*[@type=\"number\"]")
+ private WebElement addNumber;
+
+ public WebElement getSelectSortBy() {
+ return selectSortBy;
+ }
+ public WebElement getSearch() {
+ return search;
+ }
+ public WebElement getAddNumber() {
+ return addNumber;
+ }
+
+ public WebElement getSortBy() {
+ return sortBy;
+ }
+
+ public WebElement getSelectRadio() {
+ return selectRadio;
+ }
+ public WebElement getOpenAdvanceSearch() {
+ return openAdvanceSearch;
+ }
+ public WebElement getSearchTerm() {
+ return searchTerm;
+ }
+
+ public WebElement getContentType() {
+ return contentType;
+ }
+
+ public WebElement getSubject() {
+ return subject;
+ }
+
+ public WebElement getCategory() {
+ return category;
+ }
+ public WebElement getSelectСontentType() {
+ return selectСontentType;
+ }
+ public WebElement getSelectsubject() {
+ return selectsubject;
+ }
+
+ public WebElement getSelectCategory() {
+ return selectCategory;
+ }
+
+
+}
diff --git a/tpo_lab3/src/main/java/org/example/pages/SearchAnswer.java b/tpo_lab3/src/main/java/org/example/pages/SearchAnswer.java
new file mode 100644
index 0000000..14af8e2
--- /dev/null
+++ b/tpo_lab3/src/main/java/org/example/pages/SearchAnswer.java
@@ -0,0 +1,39 @@
+package org.example.pages;
+
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+import org.openqa.selenium.support.PageFactory;
+
+public class SearchAnswer {
+
+ public SearchAnswer(WebDriver webDriver) {
+ PageFactory.initElements(webDriver, this);
+ }
+
+ @FindBy(xpath = "//*[@id=\"search-input\"]")
+ private WebElement inputField;
+
+ @FindBy(xpath = "//*[@class=\"py-2 px-3 rounded-md flex items-center justify-center bg-primaryColor text-secondaryLight caption3 ml-1\"]")
+ private WebElement searchButton;
+
+ @FindBy(xpath = "//*[@id=\"best-answer\"]/div[4]/div[2]/button[2]")
+ private WebElement viewPage;
+
+ @FindBy(xpath = "//*[@id=\"top-answer\"]/div[2]/div[1]/div/p")
+ private WebElement answer;
+ public WebElement getInputField() {
+ return inputField;
+ }
+
+ public WebElement getSearchButton() {
+ return searchButton;
+ }
+
+ public WebElement getViewPage() {
+ return viewPage;
+ }
+
+ public WebElement getAnswer(){return answer;}
+
+}
diff --git a/tpo_lab3/src/test/java/org/example/EnvTest.java b/tpo_lab3/src/test/java/org/example/EnvTest.java
new file mode 100644
index 0000000..ba60a39
--- /dev/null
+++ b/tpo_lab3/src/test/java/org/example/EnvTest.java
@@ -0,0 +1,12 @@
+package org.example;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class EnvTest {
+ @Test
+ void test() {
+ assertTrue(true);
+ }
+}
diff --git a/tpo_lab3/src/test/java/org/example/usecase/CreatInformationTest.java b/tpo_lab3/src/test/java/org/example/usecase/CreatInformationTest.java
new file mode 100644
index 0000000..7968e2f
--- /dev/null
+++ b/tpo_lab3/src/test/java/org/example/usecase/CreatInformationTest.java
@@ -0,0 +1,151 @@
+package org.example.usecase;
+
+import org.example.Utils;
+import org.example.pages.CreatInformation;
+import org.example.pages.LoginPage;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.WebDriver;
+
+import static org.example.Utils.wait10Sec;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class CreatInformationTest {
+
+ @AfterEach
+ void tearDown() {
+ Utils.getDrivers().forEach(WebDriver::quit);
+ }
+
+ @Test
+ void creatQuestion() {
+ Utils.getDrivers().forEach(webDriver -> {
+ webDriver.manage().window().maximize();
+ //задержка на выполнение теста = 10 сек.
+ wait10Sec(webDriver);
+ webDriver.get("https://www.answers.com/");
+ LoginPage loginPage = new LoginPage(webDriver);
+ loginPage.getSignInButton().click();
+ loginPage.getSignInButtonWhitEmail().click();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ loginPage.getEmailField().sendKeys("maggisapphire@finacenter.com");
+ loginPage.getPasswordField().sendKeys("ww2N0mpD");
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ loginPage.getSubmit().click();
+ CreatInformation creatInformation = new CreatInformation(webDriver);
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ creatInformation.getCreatSomeThing().click();
+
+ creatInformation.getCreatQuestion().click();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ creatInformation.getTextQuestion().sendKeys("What color are the socks???");
+ creatInformation.getSubmitQuestion().click();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ String text = creatInformation.getAnswer().getText();
+ assertEquals(
+ "What color are the socks?",
+ text
+ );
+ creatInformation.getClickForAnswer().click();
+ webDriver.quit();
+ });
+ }
+
+ @Test
+ void CreatStudyGuide() throws RuntimeException {
+ Utils.getDrivers().forEach(webDriver -> {
+ webDriver.manage().window().maximize();
+ //задержка на выполнение теста = 10 сек.
+ wait10Sec(webDriver);
+ webDriver.get("https://www.answers.com/");
+ LoginPage loginPage = new LoginPage(webDriver);
+ loginPage.getSignInButton().click();
+ loginPage.getSignInButtonWhitEmail().click();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ loginPage.getEmailField().sendKeys("maggisapphire@finacenter.com");
+ loginPage.getPasswordField().sendKeys("ww2N0mpD");
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ loginPage.getSubmit().click();
+ CreatInformation creatInformation = new CreatInformation(webDriver);
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ creatInformation.getCreatSomeThing().click();
+
+ creatInformation.getStudyGuide().click();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ creatInformation.getAddATitle().sendKeys("What color are the socks!!!!!");
+ creatInformation.getAddADescription().sendKeys("About socks");
+ creatInformation.getAddTags1().sendKeys("socks");
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ creatInformation.getAddTags2().sendKeys("blue");
+ creatInformation.getAddTags3().sendKeys("black");
+ creatInformation.getAddTerm().sendKeys("fitst socks");
+ creatInformation.getAddDefinition().sendKeys("black");
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ creatInformation.getAddNewCard().click();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ creatInformation.getAddTerm1().sendKeys("second socks");
+ creatInformation.getAddDefinition1().sendKeys("blue");
+ creatInformation.getAddDefinition1().click();
+ creatInformation.getCreatGuide().click();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ String text = creatInformation.getTextGuide().getText();
+ assertEquals(
+ "What color are the socks!!!!!",
+ text
+ );
+ webDriver.quit();
+ });
+ }
+}
diff --git a/tpo_lab3/src/test/java/org/example/usecase/LoginPageTest.java b/tpo_lab3/src/test/java/org/example/usecase/LoginPageTest.java
new file mode 100644
index 0000000..92d177e
--- /dev/null
+++ b/tpo_lab3/src/test/java/org/example/usecase/LoginPageTest.java
@@ -0,0 +1,109 @@
+package org.example.usecase;
+
+import org.example.Utils;
+import org.example.pages.LoginPage;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+
+import static org.example.Utils.wait10Sec;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class LoginPageTest {
+
+ @BeforeEach
+ void init() {
+
+ }
+
+ @Test
+ void loginTest() {
+ Utils.getDrivers().forEach(webDriver -> {
+ webDriver.manage().window().maximize();
+ //задержка на выполнение теста = 10 сек.
+ wait10Sec(webDriver);
+ webDriver.get("https://www.answers.com/");
+ LoginPage loginPage = new LoginPage(webDriver);
+ loginPage.getSignInButton().click();
+ loginPage.getSignInButtonWhitEmail().click();
+ loginPage.getEmailField().sendKeys("maggisapphire@finacenter.com");
+ loginPage.getPasswordField().sendKeys("ww2N0mpD");
+ loginPage.getSubmit().click();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ webDriver.quit();
+ });
+ }
+
+ @Test
+ void logoutTest() {
+ Utils.getDrivers().forEach(webDriver -> {
+ webDriver.manage().window().maximize();
+ //задержка на выполнение теста = 10 сек.
+ wait10Sec(webDriver);
+ webDriver.get("https://www.answers.com/");
+ LoginPage loginPage = new LoginPage(webDriver);
+ loginPage.getSignInButton().click();
+ loginPage.getSignInButtonWhitEmail().click();
+ loginPage.getEmailField().sendKeys("maggisapphire@finacenter.com");
+ loginPage.getPasswordField().sendKeys("ww2N0mpD");
+ loginPage.getSubmit().click();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ loginPage.getAvatar().click();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ loginPage.getLogUot().click();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ webDriver.quit();
+ });
+ }
+
+ @Test
+ void loginErrorTest() {
+ Utils.getDrivers().forEach(webDriver -> {
+ webDriver.manage().window().maximize();
+ webDriver.manage().window().maximize();
+ //задержка на выполнение теста = 10 сек.
+ wait10Sec(webDriver);
+ webDriver.get("https://www.answers.com/");
+ LoginPage loginPage = new LoginPage(webDriver);
+ loginPage.getSignInButton().click();
+ loginPage.getSignInButtonWhitEmail().click();
+ loginPage.getEmailField().sendKeys("maggisapphire@finacenter.com");
+ loginPage.getPasswordField().sendKeys("4234");
+ loginPage.getSubmit().click();
+ String text = loginPage.getErrorMessage().getText();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ webDriver.quit();
+ assertEquals(
+ "Passwords must be between 8 and 40 characters long",
+ text
+ );
+ });
+ }
+}
diff --git a/tpo_lab3/src/test/java/org/example/usecase/ProfileTest.java b/tpo_lab3/src/test/java/org/example/usecase/ProfileTest.java
new file mode 100644
index 0000000..3f8b83f
--- /dev/null
+++ b/tpo_lab3/src/test/java/org/example/usecase/ProfileTest.java
@@ -0,0 +1,71 @@
+package org.example.usecase;
+
+//import org.example.pages.SearchCarPage;
+
+import org.example.Utils;
+import org.example.pages.LoginPage;
+import org.example.pages.Profile;
+import org.junit.jupiter.api.Test;
+
+import static org.example.Utils.wait10Sec;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class ProfileTest {
+
+ @Test
+ void profileTest() {
+ Utils.getDrivers().forEach(webDriver -> {
+ webDriver.manage().window().maximize();
+ //задержка на выполнение теста = 10 сек.
+ wait10Sec(webDriver);
+ webDriver.get("https://www.answers.com/");
+ LoginPage loginPage = new LoginPage(webDriver);
+ loginPage.getSignInButton().click();
+ loginPage.getSignInButtonWhitEmail().click();
+ loginPage.getEmailField().sendKeys("maggisapphire@finacenter.com");
+ loginPage.getPasswordField().sendKeys("ww2N0mpD");
+ loginPage.getSubmit().click();
+
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ Profile profile = new Profile(webDriver);
+ profile.getClickAvatar().click();
+ profile.getClickSettings().click();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ profile.getClickCheckBoxEmail().click();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ profile.getClickCheckBoxEmail2().click();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ profile.getClickCheckBoxEmail3().click();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ profile.getClickCheckBoxEmail4().click();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ profile.getClickCheckBoxEmail5().click();
+
+ webDriver.quit();
+ });
+ }
+}
diff --git a/tpo_lab3/src/test/java/org/example/usecase/SearchAdvanceAnswerTest.java b/tpo_lab3/src/test/java/org/example/usecase/SearchAdvanceAnswerTest.java
new file mode 100644
index 0000000..0636d52
--- /dev/null
+++ b/tpo_lab3/src/test/java/org/example/usecase/SearchAdvanceAnswerTest.java
@@ -0,0 +1,106 @@
+package org.example.usecase;
+
+import org.example.Utils;
+import org.example.pages.LoginPage;
+import org.example.pages.SearchAdvanceAnswer;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import java.time.Duration;
+
+import static org.example.Utils.wait10Sec;
+
+public class SearchAdvanceAnswerTest {
+
+ @AfterEach
+ void tearDown() {
+ Utils.getDrivers().forEach(WebDriver::quit);
+ }
+
+ @Test
+ void searchAdvance() {
+ Utils.getDrivers().forEach(webDriver -> {
+ webDriver.manage().window().maximize();
+ //задержка на выполнение теста = 10 сек.
+ wait10Sec(webDriver);
+ webDriver.get("https://www.answers.com/");
+ LoginPage loginPage = new LoginPage(webDriver);
+ loginPage.getSignInButton().click();
+ loginPage.getSignInButtonWhitEmail().click();
+ loginPage.getEmailField().sendKeys("maggisapphire@finacenter.com");
+ loginPage.getPasswordField().sendKeys("ww2N0mpD");
+ loginPage.getSubmit().click();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ webDriver.get("https://www.answers.com/search");
+ SearchAdvanceAnswer searchAdvanceAnswer = new SearchAdvanceAnswer(webDriver);
+ wait10Sec(webDriver);
+ System.out.println( webDriver.getCurrentUrl());
+ // webDriver.findElements(By.xpath("//*[@id=\"root\"]")).forEach(WebElement::);
+// var fsdf =43;
+// var fdsf = webDriver.findElement(By.xpath("/html/body/div[1]/div[1]/div[2]/div/div/div[1]/div/div[3]/form/div/div/div/div[1]/svg/use"));
+// var dsad = searchAdvanceAnswer.getOpenAdvanceSearch();
+ // searchAdvanceAnswer.getOpenAdvanceSearch().click();
+ new WebDriverWait(webDriver, Duration.ofSeconds(10)).until(ExpectedConditions.elementToBeClickable(By.xpath("//*[name()='use' and @*='#adv-config']/.."))).click();
+ System.out.println(searchAdvanceAnswer.getOpenAdvanceSearch().getText());
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ searchAdvanceAnswer.getSearchTerm().sendKeys("Barack Obama");
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ searchAdvanceAnswer.getContentType().click();
+ searchAdvanceAnswer.getSelectСontentType().click();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ searchAdvanceAnswer.getCategory().click();
+ searchAdvanceAnswer.getSelectCategory().click();
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ searchAdvanceAnswer.getSubject().click();
+ searchAdvanceAnswer.getSelectsubject().click();
+
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ searchAdvanceAnswer.getSelectRadio().click();
+ searchAdvanceAnswer.getAddNumber().sendKeys("3");
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ searchAdvanceAnswer.getSortBy().click();
+ searchAdvanceAnswer.getSelectSortBy().click();
+ searchAdvanceAnswer.getSearch().click();
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ webDriver.quit();
+ });
+ }
+}
diff --git a/tpo_lab3/src/test/java/org/example/usecase/SearchAnswerTest.java b/tpo_lab3/src/test/java/org/example/usecase/SearchAnswerTest.java
new file mode 100644
index 0000000..1788328
--- /dev/null
+++ b/tpo_lab3/src/test/java/org/example/usecase/SearchAnswerTest.java
@@ -0,0 +1,48 @@
+package org.example.usecase;
+
+import org.example.Utils;
+import org.example.pages.LoginPage;
+import org.example.pages.SearchAnswer;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import java.time.Duration;
+import java.time.temporal.ChronoUnit;
+
+import static org.example.Utils.wait10Sec;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class SearchAnswerTest {
+
+ @Test
+ void searchAnswer() {
+ Utils.getDrivers().forEach(webDriver -> {
+ webDriver.manage().window().maximize();
+ //задержка на выполнение теста = 10 сек.
+ wait10Sec(webDriver);
+ webDriver.get("https://www.answers.com/");
+ SearchAnswer searchAnswer = new SearchAnswer(webDriver);
+ searchAnswer.getInputField().sendKeys("what is it borsh?");
+ searchAnswer.getSearchButton().click();
+ searchAnswer.getViewPage().click();
+ String text = searchAnswer.getAnswer().getText();
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ assertEquals(
+ "It's probably some variant of borscht, perhaps \"borsh.\"",
+ text
+ );
+
+ webDriver.quit();
+ });
+
+ }
+}
diff --git a/tpo_lab3/target/classes/org/example/Utils.class b/tpo_lab3/target/classes/org/example/Utils.class
new file mode 100644
index 0000000..414b433
Binary files /dev/null and b/tpo_lab3/target/classes/org/example/Utils.class differ
diff --git a/tpo_lab3/target/classes/org/example/pages/CreatInformation.class b/tpo_lab3/target/classes/org/example/pages/CreatInformation.class
new file mode 100644
index 0000000..708ecc4
Binary files /dev/null and b/tpo_lab3/target/classes/org/example/pages/CreatInformation.class differ
diff --git a/tpo_lab3/target/classes/org/example/pages/LoginPage.class b/tpo_lab3/target/classes/org/example/pages/LoginPage.class
new file mode 100644
index 0000000..2d64cb5
Binary files /dev/null and b/tpo_lab3/target/classes/org/example/pages/LoginPage.class differ
diff --git a/tpo_lab3/target/classes/org/example/pages/Profile.class b/tpo_lab3/target/classes/org/example/pages/Profile.class
new file mode 100644
index 0000000..0afaead
Binary files /dev/null and b/tpo_lab3/target/classes/org/example/pages/Profile.class differ
diff --git a/tpo_lab3/target/classes/org/example/pages/SearchAdvanceAnswer.class b/tpo_lab3/target/classes/org/example/pages/SearchAdvanceAnswer.class
new file mode 100644
index 0000000..eddad49
Binary files /dev/null and b/tpo_lab3/target/classes/org/example/pages/SearchAdvanceAnswer.class differ
diff --git a/tpo_lab3/target/classes/org/example/pages/SearchAnswer.class b/tpo_lab3/target/classes/org/example/pages/SearchAnswer.class
new file mode 100644
index 0000000..52f38d9
Binary files /dev/null and b/tpo_lab3/target/classes/org/example/pages/SearchAnswer.class differ
diff --git a/tpo_lab3/target/test-classes/org/example/EnvTest.class b/tpo_lab3/target/test-classes/org/example/EnvTest.class
new file mode 100644
index 0000000..e107b8e
Binary files /dev/null and b/tpo_lab3/target/test-classes/org/example/EnvTest.class differ
diff --git a/tpo_lab3/target/test-classes/org/example/usecase/CreatInformationTest.class b/tpo_lab3/target/test-classes/org/example/usecase/CreatInformationTest.class
new file mode 100644
index 0000000..6d7774d
Binary files /dev/null and b/tpo_lab3/target/test-classes/org/example/usecase/CreatInformationTest.class differ
diff --git a/tpo_lab3/target/test-classes/org/example/usecase/LoginPageTest.class b/tpo_lab3/target/test-classes/org/example/usecase/LoginPageTest.class
new file mode 100644
index 0000000..1dd5c6b
Binary files /dev/null and b/tpo_lab3/target/test-classes/org/example/usecase/LoginPageTest.class differ
diff --git a/tpo_lab3/target/test-classes/org/example/usecase/ProfileTest.class b/tpo_lab3/target/test-classes/org/example/usecase/ProfileTest.class
new file mode 100644
index 0000000..ca7a3ab
Binary files /dev/null and b/tpo_lab3/target/test-classes/org/example/usecase/ProfileTest.class differ
diff --git a/tpo_lab3/target/test-classes/org/example/usecase/SearchAdvanceAnswerTest.class b/tpo_lab3/target/test-classes/org/example/usecase/SearchAdvanceAnswerTest.class
new file mode 100644
index 0000000..f4bac55
Binary files /dev/null and b/tpo_lab3/target/test-classes/org/example/usecase/SearchAdvanceAnswerTest.class differ
diff --git a/tpo_lab3/target/test-classes/org/example/usecase/SearchAnswerTest.class b/tpo_lab3/target/test-classes/org/example/usecase/SearchAnswerTest.class
new file mode 100644
index 0000000..38aacd1
Binary files /dev/null and b/tpo_lab3/target/test-classes/org/example/usecase/SearchAnswerTest.class differ