Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/software-testing.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tpo_lab3/app.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BIG_BOOBS=true
HOT_CHICKS=true
WEB_DRIVER=firefox

94 changes: 94 additions & 0 deletions tpo_lab3/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>tpo_lab3</artifactId>
<version>1.0.0</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.19.1</version>
</dependency>
<dependency>
<groupId>com.github.seratch</groupId>
<artifactId>java-time-backport</artifactId>
<version>1.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.1</version>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
</plugins>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
</build>
</project>
42 changes: 42 additions & 0 deletions tpo_lab3/src/main/java/org/example/Utils.java
Original file line number Diff line number Diff line change
@@ -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<WebDriver> getDrivers() {
return List.of(
getChromeDriver()//,
// getFireFoxDriver()
);
}

public static void wait10Sec(WebDriver webDriver) {
webDriver.manage().timeouts().implicitlyWait(Duration.of(10, ChronoUnit.SECONDS));
}
}
138 changes: 138 additions & 0 deletions tpo_lab3/src/main/java/org/example/pages/CreatInformation.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
Loading