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
38 changes: 38 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
23 changes: 23 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>cucumberScumSapientia</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
6 changes: 6 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.5
4 changes: 4 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
599 changes: 599 additions & 0 deletions List Story.jmx

Large diffs are not rendered by default.

599 changes: 599 additions & 0 deletions Story.jmx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
package ro.sapientia.mesteri2015.test;

import java.util.List;
import java.util.concurrent.TimeUnit;

import org.junit.Assert;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;

import cucumber.api.java.After;
import cucumber.api.java.Before;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;

public class SCRUMAddCommentDefinition {

protected WebDriver driver;

private static long StoryId;

private static boolean onceFlag=false;

@Before
public void setup() {
driver = new FirefoxDriver();
}

///

@Given("^A Story is already created as \"([^\"]*)\"$")
public void I_assure_that_there_is_a_story(String title) throws Throwable {
if(onceFlag)
return;
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("http://localhost:8080/");
WebElement addButton = driver.findElement(By.id("add-button"));
addButton.click();

WebElement titleField = driver.findElement(By.id("story-title"));
titleField.sendKeys(Keys.CONTROL + "a");
titleField.sendKeys(Keys.DELETE);
titleField.sendKeys(title);

WebElement descField = driver.findElement(By.id("story-description"));
descField.sendKeys(Keys.CONTROL + "a");
descField.sendKeys(Keys.DELETE);
descField.sendKeys("blabla");

WebElement dateField = driver.findElement(By.id("story-dueDate"));
dateField.clear();
dateField.sendKeys("2021-01-21");

WebElement createStoryButton = driver.findElement(By.id("add-story-button"));
createStoryButton.click();

WebElement titleElement = driver.findElement(By.id("story-title"));
String result = titleElement.getText();

String url = driver.getCurrentUrl();
Assert.assertEquals(true,url.contains("story/"));
Assert.assertEquals(result, title);

onceFlag = true;
StoryId = Integer.parseInt(url.substring(url.length() - 1));
//driver.close();
}

/////////////


@Given("^I open the first story in the list$")
public void I_open_the_story_list() throws Throwable {
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("http://localhost:8080/story/"+StoryId);
}

@Given("^I click on add comment button$")
public void I_open_the_story_page() throws Throwable {
WebElement addButton = driver.findElement(By.id("add-comment-button"));
addButton.click();
}

@When("^I enter \"([^\"]*)\" in the message textbox and I push the add button$")
public void I_enter_comment_and_press_add(String message) throws Throwable {

WebElement messageTextBox = driver.findElement(By.id("story-description"));
messageTextBox.clear();
messageTextBox.sendKeys(message);

WebElement addCommentButton = driver.findElement(By.id("add-story-button"));
addCommentButton.click();
}

@Then("^I should see the \"([^\"]*)\" comment under the \"([^\"]*)\" story$")
public void I_should_see_the_comment(String commentText,String storyTitle) throws Throwable {
WebElement commentParagraph = driver.findElement(By.xpath("/html/body/div/div[2]/div[2]/div[2]/div[3]/div[1]/p[1]")); // /html/body/div/div[2]/div[2]/div[2]/div[3]/div[1]/p[1]
String result = commentParagraph.getText();

WebElement storyTitleHeader = driver.findElement(By.id("story-title"));
String title = storyTitleHeader.getText();

Assert.assertEquals(result, commentText);
Assert.assertEquals(title, storyTitle);

//driver.close();
}


///////////////////////


@Given("^I am on a story page already$")
public void I_am_on_a_story_page_already() throws Throwable {
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.get("http://localhost:8080/story/"+StoryId);
}

@Given("^I pressed the comment modify button$")
public void I_edit_the_scrum_list_s_first_story() throws Throwable {
WebElement modifyButton = driver.findElement(By.xpath("/html/body/div/div[2]/div[2]/div[2]/div[3]/div[1]/a[1]"));
modifyButton.click();
}

@When("^I enter \"([^\"]*)\" in the message textbox and I push the update button$")
public void I_enter_in_the_title_textbox_and_I_push_the_update_button(String updatedMessage) throws Throwable {

WebElement messageField = driver.findElement(By.id("story-description"));
messageField.sendKeys(Keys.CONTROL + "a");
messageField.sendKeys(Keys.DELETE);
messageField.sendKeys(updatedMessage);

WebElement updateStoryButton = driver.findElement(By.xpath("//*[@id=\"update-story-button\"]"));
updateStoryButton.click();

}

@Then("^I should see the changed comment \"([^\"]*)\"$")
public void I_should_get_result_in_new_stories_list(String expectedResult) throws Throwable {

WebElement messageText = driver.findElement(By.xpath("/html/body/div/div[2]/div[2]/div[2]/div[3]/div[1]/p[1]"));
String result = messageText.getText();


Assert.assertEquals(result, expectedResult);

//driver.close();
}

///////////////////////////////////////////

@When("^I pressed the comment delete button$")
public void I_press_the_delete_button() throws Throwable {

WebElement deleteButton = driver.findElement(By.xpath("/html/body/div/div[2]/div[2]/div[2]/div[3]/div[1]/a[2]"));
deleteButton.click();

}

@Then("^The comment is gone$")
public void Comment_is_gone() throws Throwable {

List<WebElement> list = driver.findElements(By.xpath("//*[contains(text(),'No entries found.')]"));


Assert.assertEquals(list.size(), 1);

//driver.close();
}

@After
public void closeBrowser() {
driver.quit();
}

}

This file was deleted.

Loading