Finished app
8
.idea/.gitignore
vendored
Normal file
@ -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
|
13
.idea/compiler.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="my-app" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
7
.idea/encodings.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
20
.idea/jarRepositories.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
12
.idea/misc.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="openjdk-18" project-jdk-type="JavaSDK" />
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
869
build/reports/tests/1707832750795.0.html
Normal file
BIN
build/reports/tests/1707832750795.0.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
1861
build/reports/tests/1707845184902.0.html
Normal file
BIN
build/reports/tests/1707845184902.0.png
Normal file
After Width: | Height: | Size: 497 KiB |
1861
build/reports/tests/1707919285890.0.html
Normal file
BIN
build/reports/tests/1707919285890.0.png
Normal file
After Width: | Height: | Size: 1.0 MiB |
1861
build/reports/tests/1707919795468.0.html
Normal file
BIN
build/reports/tests/1707919795468.0.png
Normal file
After Width: | Height: | Size: 1.0 MiB |
1861
build/reports/tests/1707919935190.0.html
Normal file
BIN
build/reports/tests/1707919935190.0.png
Normal file
After Width: | Height: | Size: 1.3 MiB |
1861
build/reports/tests/1707932913733.0.html
Normal file
BIN
build/reports/tests/1707932913733.0.png
Normal file
After Width: | Height: | Size: 1.3 MiB |
1861
build/reports/tests/1707933565990.0.html
Normal file
BIN
build/reports/tests/1707933565990.0.png
Normal file
After Width: | Height: | Size: 1.3 MiB |
1861
build/reports/tests/1707936144850.0.html
Normal file
BIN
build/reports/tests/1707936144850.0.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
1857
build/reports/tests/1707938471005.0.html
Normal file
BIN
build/reports/tests/1707938471005.0.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
1857
build/reports/tests/1707938807374.0.html
Normal file
BIN
build/reports/tests/1707938807374.0.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
1861
build/reports/tests/1707939003097.0.html
Normal file
BIN
build/reports/tests/1707939003097.0.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
1837
build/reports/tests/1708006699112.0.html
Normal file
BIN
build/reports/tests/1708006699112.0.png
Normal file
After Width: | Height: | Size: 729 KiB |
2197
build/reports/tests/1708006823180.0.html
Normal file
BIN
build/reports/tests/1708006823180.0.png
Normal file
After Width: | Height: | Size: 794 KiB |
869
build/reports/tests/1708007530751.0.html
Normal file
BIN
build/reports/tests/1708007530751.0.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
869
build/reports/tests/1708007634920.1.html
Normal file
BIN
build/reports/tests/1708007634920.1.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
869
build/reports/tests/1708007738556.2.html
Normal file
BIN
build/reports/tests/1708007738556.2.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
869
build/reports/tests/1708007844524.3.html
Normal file
BIN
build/reports/tests/1708007844524.3.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
873
build/reports/tests/1708007949983.4.html
Normal file
BIN
build/reports/tests/1708007949983.4.png
Normal file
After Width: | Height: | Size: 896 KiB |
873
build/reports/tests/1708008056653.5.html
Normal file
BIN
build/reports/tests/1708008056653.5.png
Normal file
After Width: | Height: | Size: 913 KiB |
92
pom.xml
Normal file
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.mycompany.app</groupId>
|
||||
<artifactId>my-app</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<name>my-app</name>
|
||||
<!-- FIXME change it to the project's website -->
|
||||
<url>http://www.example.com</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.codeborne</groupId>
|
||||
<artifactId>selenide</artifactId>
|
||||
<version>7.0.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</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>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
13
src/main/java/com/mycompany/app/App.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.mycompany.app;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "Hello World!" );
|
||||
}
|
||||
}
|
78
src/test/java/com/mycompany/app/AppTest.java
Normal file
@ -0,0 +1,78 @@
|
||||
package com.mycompany.app;
|
||||
|
||||
import static com.codeborne.selenide.CollectionCondition.allMatch;
|
||||
import static com.codeborne.selenide.CollectionCondition.texts;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.codeborne.selenide.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import static com.codeborne.selenide.Condition.*;
|
||||
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
{
|
||||
AppTestPage home = new AppTestPage();
|
||||
|
||||
@Test
|
||||
public void testURL() {
|
||||
home.open().assertUrl();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTitle() {
|
||||
home.open().assertTitle();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMenuLink() {
|
||||
home.open();
|
||||
home.getKulturaNavLink().click();
|
||||
String url = WebDriverRunner.url();
|
||||
assertTrue(url.contains("kultura"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfLogoExist() {
|
||||
home.open().getLogoLink().shouldBe(visible);;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfNavLinksHaveCorrectText() {
|
||||
|
||||
List<String> expectedLinks = Arrays.asList("NEWSY", "RECENZJE", "TEKSTY", "KULTURA", "WIDEO", "CZASOPISMO", "TECHNOLOGIE", "RETRO", "BAZA GIER", "NA LUZIE", "FORUM");
|
||||
ElementsCollection linksList = home.open().getNavLinks();
|
||||
linksList.shouldHave(texts(expectedLinks));
|
||||
}
|
||||
@Test
|
||||
public void testIfArticleLinkAndArticleTitleMatch() {
|
||||
home.open();
|
||||
SelenideElement articleLink = home.getArticleLink().should(exist);
|
||||
String articleLinkText = articleLink.text();
|
||||
articleLink.click();
|
||||
SelenideElement articleTitle = home.getArticleTitle().should(exist);
|
||||
articleTitle.shouldHave(text(articleLinkText));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIfSearchWorks() {
|
||||
home.open().getSearchLink().click();
|
||||
home.getSearchInput().val("aaaaa").pressEnter();
|
||||
home.getSearchInput().should(exist);
|
||||
|
||||
ElementsCollection searchResults = home.getSearchResults();
|
||||
List<String> searchResultTexts = searchResults.texts();
|
||||
System.out.println(searchResultTexts);
|
||||
for (String str: searchResultTexts){
|
||||
assertTrue(str.matches("^.*(aaaaa|AAAAA).*$"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
61
src/test/java/com/mycompany/app/AppTestPage.java
Normal file
@ -0,0 +1,61 @@
|
||||
package com.mycompany.app;
|
||||
|
||||
import com.codeborne.selenide.*;
|
||||
import org.openqa.selenium.By;
|
||||
|
||||
import static com.codeborne.selenide.Condition.exist;
|
||||
import static com.codeborne.selenide.Selenide.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class AppTestPage {
|
||||
public AppTestPage open(){
|
||||
Configuration.browser = "firefox";
|
||||
Configuration.timeout = 50000;
|
||||
Configuration.headless = true;
|
||||
Selenide.open("https://cdaction.pl/");
|
||||
SelenideElement cookies = $("#cookiescript_accept");
|
||||
if(cookies.exists()){
|
||||
cookies.click();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public SelenideElement getKulturaNavLink(){
|
||||
return $(By.xpath("//*[@id=\"__next\"]/header/div/nav/div/a[4]"));
|
||||
}
|
||||
|
||||
public SelenideElement getLogoLink(){
|
||||
return $(By.xpath("//a[@title=\"CD-Action\"]"));
|
||||
}
|
||||
|
||||
public ElementsCollection getNavLinks(){
|
||||
return $$(By.cssSelector("nav a"));
|
||||
}
|
||||
|
||||
public SelenideElement getSearchLink(){
|
||||
return $(By.xpath("//button[@aria-label=\"Wyszukiwarka\"]"));
|
||||
}
|
||||
|
||||
public SelenideElement getArticleLink() {return $(By.xpath("//*[@id=\"maincontainer\"]/section[1]/div[1]/div[1]/div[1]/a/div[3]/h2"));}
|
||||
|
||||
public SelenideElement getArticleTitle() {return $(By.xpath("//*[@id=\"maincontainer\"]/section[2]/div[2]/h1"));}
|
||||
|
||||
public SelenideElement getSearchInput(){
|
||||
return $(By.xpath("//input[@placeholder=\"Szukaj\"]"));
|
||||
|
||||
}
|
||||
|
||||
public ElementsCollection getSearchResults(){
|
||||
return $$(By.cssSelector("div a h2"));
|
||||
}
|
||||
|
||||
public void assertUrl(){
|
||||
String url = WebDriverRunner.url();
|
||||
assertEquals(url,"https://cdaction.pl/");
|
||||
}
|
||||
|
||||
public void assertTitle(){
|
||||
String title = title();
|
||||
assertEquals(title,"CD-Action – Strona główna");
|
||||
}
|
||||
}
|
BIN
target/classes/com/mycompany/app/App.class
Normal file
@ -0,0 +1 @@
|
||||
com/mycompany/app/App.class
|
@ -0,0 +1 @@
|
||||
/home/tonywesoly/Code/Studia/testowanie/my-app/src/main/java/com/mycompany/app/App.java
|
@ -0,0 +1 @@
|
||||
com/mycompany/app/AppTest.class
|
@ -0,0 +1,2 @@
|
||||
/home/tonywesoly/Code/Studia/testowanie/my-app/src/test/java/com/mycompany/app/AppTestPage.java
|
||||
/home/tonywesoly/Code/Studia/testowanie/my-app/src/test/java/com/mycompany/app/AppTest.java
|
14
target/surefire-reports/2024-02-11T15-47-11_400-jvmRun1.dump
Normal file
@ -0,0 +1,14 @@
|
||||
# Created at 2024-02-11T15:47:21.085
|
||||
System.exit() or native command error interrupted process checker.
|
||||
java.lang.IllegalStateException: error [STOPPED] to read process 1449
|
||||
at org.apache.maven.surefire.booter.PpidChecker.checkProcessInfo(PpidChecker.java:145)
|
||||
at org.apache.maven.surefire.booter.PpidChecker.isProcessAlive(PpidChecker.java:124)
|
||||
at org.apache.maven.surefire.booter.ForkedBooter$2.run(ForkedBooter.java:214)
|
||||
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
|
||||
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
|
||||
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
|
||||
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
|
||||
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
|
||||
at java.base/java.lang.Thread.run(Thread.java:833)
|
||||
|
||||
|
62
target/surefire-reports/TEST-com.mycompany.app.AppTest.xml
Normal file
4
target/surefire-reports/com.mycompany.app.AppTest.txt
Normal file
@ -0,0 +1,4 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Test set: com.mycompany.app.AppTest
|
||||
-------------------------------------------------------------------------------
|
||||
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 114.494 s - in com.mycompany.app.AppTest
|