Anul 3 Semestrul 2
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath("net.serenity-bdd:serenity-gradle-plugin:2.3.2")
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'net.serenity-bdd.aggregator'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
dependencies {
|
||||
compile 'net.serenity-bdd:serenity-core:2.3.2'
|
||||
compile 'net.serenity-bdd:serenity-junit:2.3.2'
|
||||
testCompile('junit:junit:4.12')
|
||||
}
|
||||
gradle.startParameter.continueOnFailure = true
|
||||
@@ -0,0 +1,121 @@
|
||||
<?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>org.example</groupId>
|
||||
<artifactId>Lab5DemoSerenityJUnit</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>Serenity project with JUnit and WebDriver</name>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<serenity.version>2.3.2</serenity.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<id>central</id>
|
||||
<name>bintray</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<id>central</id>
|
||||
<name>bintray-plugins</name>
|
||||
<url>https://jcenter.bintray.com</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.serenity-bdd</groupId>
|
||||
<artifactId>serenity-core</artifactId>
|
||||
<version>${serenity.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.7</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.serenity-bdd</groupId>
|
||||
<artifactId>serenity-junit</artifactId>
|
||||
<version>${serenity.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*Test.java</include>
|
||||
<include>**/Test*.java</include>
|
||||
<include>**/When*.java</include>
|
||||
<include>**/*Story.java</include>
|
||||
</includes>
|
||||
<argLine>-Xmx512m</argLine>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.2</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>net.serenity-bdd.maven.plugins</groupId>
|
||||
<artifactId>serenity-maven-plugin</artifactId>
|
||||
<version>${serenity.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>serenity-reports</id>
|
||||
<phase>post-integration-test</phase>
|
||||
<goals>
|
||||
<goal>aggregate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,30 @@
|
||||
# Define the default driver
|
||||
#webdriver.driver=phantomjs
|
||||
|
||||
# Appears at the top of the reports
|
||||
serenity.project.name = Demo Project using Serenity and JUnit
|
||||
webdriver.autodownload = false
|
||||
webdriver.driver = chrome
|
||||
headless.mode = false
|
||||
|
||||
drivers {
|
||||
windows {
|
||||
webdriver.chrome.driver = src/test/resources/webdriver/windows/chromedriver.exe
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Root package for any JUnit acceptance tests
|
||||
serenity.test.root=org.example.features
|
||||
|
||||
# Customise your riequirements hierarchy
|
||||
#serenity.requirement.types=feature, story
|
||||
|
||||
# Run the tests without calling webdriver - useful to check your JUnit wireing
|
||||
#serenity.dry.run=true
|
||||
|
||||
# Customise browser size
|
||||
#serenity.browser.height = 1200
|
||||
#serenity.browser.width = 1200
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package org.example.features.search;
|
||||
|
||||
import net.serenitybdd.junit.runners.SerenityRunner;
|
||||
import net.thucydides.core.annotations.Issue;
|
||||
import net.thucydides.core.annotations.Managed;
|
||||
import net.thucydides.core.annotations.Pending;
|
||||
import net.thucydides.core.annotations.Steps;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
import org.example.steps.serenity.EndUserSteps;
|
||||
|
||||
@RunWith(SerenityRunner.class)
|
||||
public class SearchByKeywordStory {
|
||||
|
||||
@Managed(uniqueSession = true)
|
||||
public WebDriver webdriver;
|
||||
|
||||
@Steps
|
||||
public EndUserSteps anna;
|
||||
|
||||
@Issue("#WIKI-1")
|
||||
@Test
|
||||
public void searching_by_keyword_apple_should_display_the_corresponding_article() {
|
||||
anna.is_the_home_page();
|
||||
anna.looks_for("apple");
|
||||
// anna.should_see_definition("A common, round fruit produced by the tree Malus
|
||||
// domestica, cultivated in temperate climates.");
|
||||
// anna.should_see_definition("Rezultatele cautarii dupa: apple");
|
||||
anna.should_see_definition(
|
||||
"Rachel Appleby: Observations & Reflections: Learning from each other, learning from yourself");
|
||||
|
||||
}
|
||||
|
||||
@Issue("#WIKI-1")
|
||||
@Test
|
||||
public void searching_by_keyword_boian_should_display_the_corresponding_article() {
|
||||
anna.is_the_home_page();
|
||||
anna.looks_for("boian");
|
||||
// anna.should_see_definition("A common, round fruit produced by the tree Malus
|
||||
// domestica, cultivated in temperate climates.");
|
||||
// anna.should_see_definition("Rezultatele cautarii dupa: apple");
|
||||
anna.should_see_definition(
|
||||
"Profesorul Florian BOIAN la 70 de ani");
|
||||
|
||||
}
|
||||
|
||||
@Issue("#WIKI-1")
|
||||
@Test
|
||||
public void searching_by_keyword_vancea_should_display_the_corresponding_article() {
|
||||
anna.is_the_home_page();
|
||||
anna.looks_for("vancea");
|
||||
// anna.should_see_definition("A common, round fruit produced by the tree Malus
|
||||
// domestica, cultivated in temperate climates.");
|
||||
// anna.should_see_definition("Rezultatele cautarii dupa: apple");
|
||||
anna.should_see_definition(
|
||||
"Comisiile permanente ale Consiliului Facultăţii de Matematică şi Informatică");
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* @Test
|
||||
* public void
|
||||
* searching_by_keyword_banana_should_display_the_corresponding_article() {
|
||||
* anna.is_the_home_page();
|
||||
* anna.looks_for("pear");
|
||||
* anna.
|
||||
* should_see_definition("An edible fruit produced by the pear tree, similar to an apple but typically elongated towards the stem."
|
||||
* );
|
||||
* // An edible fruit produced by the pear tree, similar to an apple but
|
||||
* typically elongated towards the stem.
|
||||
* }
|
||||
*
|
||||
* @Pending @Test
|
||||
* public void
|
||||
* searching_by_ambiguious_keyword_should_display_the_disambiguation_page() {
|
||||
* }
|
||||
*/
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
package org.example.features.search;
|
||||
|
||||
|
||||
import net.serenitybdd.junit.runners.SerenityParameterizedRunner;
|
||||
import net.thucydides.core.annotations.Issue;
|
||||
import net.thucydides.core.annotations.Managed;
|
||||
import net.thucydides.core.annotations.Steps;
|
||||
import net.thucydides.junit.annotations.Qualifier;
|
||||
import net.thucydides.junit.annotations.UseTestDataFrom;
|
||||
import org.example.steps.serenity.EndUserSteps;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.openqa.selenium.WebDriver;
|
||||
|
||||
@RunWith(SerenityParameterizedRunner.class)
|
||||
@UseTestDataFrom("src/test/resources/WikiTestDataUBB.csv")
|
||||
public class SearchByKeywordStoryDDT {
|
||||
@Managed(uniqueSession = true)
|
||||
public WebDriver webdriver;
|
||||
|
||||
|
||||
@Steps
|
||||
public EndUserSteps endUser;
|
||||
|
||||
public String name;
|
||||
public String definition;
|
||||
|
||||
@Qualifier
|
||||
public String getQualifier() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
@Issue("#WIKI-1")
|
||||
@Test
|
||||
public void searchWikiByKeywordTestDDT() {
|
||||
|
||||
endUser.is_the_home_page();
|
||||
endUser.looks_for(getName());
|
||||
endUser.should_see_definition(getDefinition());
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDefinition() {
|
||||
return definition;
|
||||
}
|
||||
|
||||
public void setDefinition(String definition) {
|
||||
this.definition = definition;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
|
||||
@Narrative(
|
||||
title = "Search for definitions",
|
||||
text = {"In order to impress people",
|
||||
"As a party goer",
|
||||
"I want to be able to look up the meaning of unusual and impressive words"},
|
||||
cardNumber = "#123"
|
||||
)
|
||||
package org.example.features.search;
|
||||
|
||||
import net.thucydides.core.annotations.Narrative;
|
||||
@@ -0,0 +1,51 @@
|
||||
package org.example.pages;
|
||||
|
||||
import net.thucydides.core.annotations.DefaultUrl;
|
||||
import org.openqa.selenium.By;
|
||||
import org.openqa.selenium.WebElement;
|
||||
import net.serenitybdd.core.pages.WebElementFacade;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.serenitybdd.core.annotations.findby.FindBy;
|
||||
|
||||
import net.thucydides.core.pages.PageObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//@DefaultUrl("http://en.wiktionary.org/wiki/Wiktionary")
|
||||
@DefaultUrl("http://www.cs.ubbcluj.ro")
|
||||
public class DictionaryPage extends PageObject {
|
||||
|
||||
@FindBy(id="s")
|
||||
private WebElementFacade searchTerms;
|
||||
|
||||
@FindBy(name="go")
|
||||
private WebElementFacade lookupButton;
|
||||
|
||||
public void enter_keywords(String keyword) {
|
||||
|
||||
//searchTerms.type(keyword);
|
||||
searchTerms.typeAndEnter(keyword);
|
||||
}
|
||||
|
||||
public void lookup_terms() {
|
||||
|
||||
//lookupButton.click();
|
||||
}
|
||||
|
||||
public List<String> getDefinitions() {
|
||||
|
||||
WebElementFacade searchList = find(By.className("post-wrap"));
|
||||
// return searchList.findElements(By.id("post-57228")).stream().map(element->element.getText()).collect(Collectors.toList());
|
||||
return searchList.findElements(By.className("post")).stream().map(element->element.getText()).collect(Collectors.toList());
|
||||
|
||||
/*
|
||||
WebElementFacade definitionList = find(By.tagName("ol"));
|
||||
return definitionList.findElements(By.tagName("li")).stream()
|
||||
.map( element -> element.getText() )
|
||||
.collect(Collectors.toList());
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
package org.example.steps.serenity;
|
||||
|
||||
import org.example.pages.DictionaryPage;
|
||||
import net.thucydides.core.annotations.Step;
|
||||
import net.thucydides.core.steps.ScenarioSteps;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.hasItem;
|
||||
|
||||
public class EndUserSteps {
|
||||
|
||||
DictionaryPage dictionaryPage;
|
||||
|
||||
@Step
|
||||
public void enters(String keyword) {
|
||||
dictionaryPage.enter_keywords(keyword);
|
||||
}
|
||||
|
||||
@Step
|
||||
public void starts_search() {
|
||||
dictionaryPage.lookup_terms();
|
||||
}
|
||||
|
||||
@Step
|
||||
public void should_see_definition(String definition) {
|
||||
assertThat(dictionaryPage.getDefinitions(), hasItem(containsString(definition)));
|
||||
}
|
||||
|
||||
@Step
|
||||
public void is_the_home_page() {
|
||||
dictionaryPage.open();
|
||||
}
|
||||
|
||||
@Step
|
||||
public void looks_for(String term) {
|
||||
enters(term);
|
||||
starts_search();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
Name,Definition
|
||||
love,A deep caring for the existence of another.
|
||||
child," A person who has not yet reached adulthood, whether natural (puberty), cultural (initiation), or legal (majority)."
|
||||
happiness,The emotion of being happy; joy.
|
||||
|
@@ -0,0 +1,4 @@
|
||||
Name,Definition
|
||||
mindfulness,"MSc. Nicoleta PFEFFER-BARBELA, fondator citySTILLE Mindfulness Center Vienna: Focus on mind. Mindfulness science and practice. From mind overload to presence, stillness & focus in research team"
|
||||
students,Opening ceremony for Erasmus students at the Faculty of Mathematics and Computer Science
|
||||
happy,Women in Tech: NI and the University Relations Team are happy to invite you to the round table Women In Tech
|
||||
|
@@ -0,0 +1,4 @@
|
||||
Search for definitions
|
||||
In order to understand a word that I don't know
|
||||
As a user
|
||||
I want to be able to look up the meaning of the word
|
||||
Reference in New Issue
Block a user