- Signed in as
+
+
+
+
+
Acebook
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+ Global Posts
+
+
+ Friends' Posts
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
![Post image]()
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
diff --git a/src/main/resources/templates/posts/post.html b/src/main/resources/templates/posts/post.html
new file mode 100644
index 000000000..30d48e75e
--- /dev/null
+++ b/src/main/resources/templates/posts/post.html
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+
Acebook
+
Post Detail
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
![Post image]()
+
+
+
+
+
+
+
0
+
+ Liked by:
+ User,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/users/profile.html b/src/main/resources/templates/users/profile.html
new file mode 100644
index 000000000..1d2ba1642
--- /dev/null
+++ b/src/main/resources/templates/users/profile.html
@@ -0,0 +1,246 @@
+
+
+
+
+
+
+
Profile
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
![]()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Your Friends
+
+
+
+
You have no friends!
+
+
+
+
+
+
+
+
Your Posts
+
+
+
+
You have no posts!
+
+
+
+
+
+
+
+
![Post image]()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/templates/users/settings.html b/src/main/resources/templates/users/settings.html
new file mode 100644
index 000000000..d7b0ec16a
--- /dev/null
+++ b/src/main/resources/templates/users/settings.html
@@ -0,0 +1,136 @@
+
+
+
+
+
+
Settings
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/.DS_Store b/src/test/.DS_Store
new file mode 100644
index 000000000..2b4ee20c6
Binary files /dev/null and b/src/test/.DS_Store differ
diff --git a/src/test/java/.DS_Store b/src/test/java/.DS_Store
new file mode 100644
index 000000000..de3a99e1e
Binary files /dev/null and b/src/test/java/.DS_Store differ
diff --git a/src/test/java/com/.DS_Store b/src/test/java/com/.DS_Store
new file mode 100644
index 000000000..4ed73db6d
Binary files /dev/null and b/src/test/java/com/.DS_Store differ
diff --git a/src/test/java/com/makersacademy/.DS_Store b/src/test/java/com/makersacademy/.DS_Store
new file mode 100644
index 000000000..6700e0985
Binary files /dev/null and b/src/test/java/com/makersacademy/.DS_Store differ
diff --git a/src/test/java/com/makersacademy/acebook/.DS_Store b/src/test/java/com/makersacademy/acebook/.DS_Store
new file mode 100644
index 000000000..cb520e21b
Binary files /dev/null and b/src/test/java/com/makersacademy/acebook/.DS_Store differ
diff --git a/src/test/java/com/makersacademy/acebook/feature/FriendSearchTest.java b/src/test/java/com/makersacademy/acebook/feature/FriendSearchTest.java
new file mode 100644
index 000000000..f429e2478
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/feature/FriendSearchTest.java
@@ -0,0 +1,65 @@
+package com.makersacademy.acebook.feature;
+
+import com.github.javafaker.Faker;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import java.time.Duration;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public class FriendSearchTest {
+
+ WebDriver driver;
+ Faker faker;
+
+ @Before
+ public void setup() {
+ System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
+ driver = new ChromeDriver();
+ faker = new Faker();
+ }
+
+ @After
+ public void tearDown() {
+ driver.close();
+ }
+
+ @Test
+ public void successfulGetRequestOnSettingsPage() {
+ String email = faker.name().username() + "@email.com";
+ String givenName = faker.name().firstName();
+ String familyName = faker.name().lastName();
+
+ driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
+ driver.get("http://localhost:8080/");
+ driver.findElement(By.linkText("Login / Sign Up")).click();
+ driver.findElement(By.xpath("(//a[text()='Sign Up'])[1]")).click();
+ driver.findElement(By.name("email")).sendKeys(email);
+ driver.findElement(By.name("given_name")).sendKeys(givenName);
+ driver.findElement(By.name("family_name")).sendKeys(familyName);
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ WebElement passwordField = wait.until(
+ ExpectedConditions.elementToBeClickable(By.id("1-password"))
+ );
+ passwordField.sendKeys("Password123");
+ driver.findElement(By.className("auth0-label-submit")).click();
+ driver.findElement(By.name("action")).click();
+ WebElement dropdown = wait.until(
+ ExpectedConditions.elementToBeClickable(By.cssSelector("a.nav-link.dropdown-toggle"))
+ );
+ driver.get("http://localhost:8080/friends/search");
+ WebElement h1 = driver.findElement(By.tagName("h1"));
+ String h1Text = h1.getText();
+ assertThat(h1Text, containsString("Find Friends"));
+
+ }
+}
diff --git a/src/test/java/com/makersacademy/acebook/feature/FriendsListTest.java b/src/test/java/com/makersacademy/acebook/feature/FriendsListTest.java
new file mode 100644
index 000000000..b5631f1c4
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/feature/FriendsListTest.java
@@ -0,0 +1,46 @@
+package com.makersacademy.acebook.feature;
+
+import com.github.javafaker.Faker;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.chrome.ChromeDriver;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+
+public class FriendsListTest {
+ WebDriver driver;
+ Faker faker;
+
+ @Before
+ public void setup() {
+ System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
+ driver = new ChromeDriver();
+ faker = new Faker();
+ }
+
+ @After
+ public void tearDown() {
+ driver.close();
+ }
+
+ @Test
+ public void FriendsControllerNavigatesToFriendsList() {
+ String email = faker.name().username() + "@email.com";
+
+ driver.get("http://localhost:8080/");
+ driver.findElement(By.linkText("Sign up")).click();
+ driver.findElement(By.name("email")).sendKeys(email);
+ driver.findElement(By.name("password")).sendKeys("P@55qw0rd");
+ driver.findElement(By.name("action")).click();
+ driver.findElement(By.name("action")).click();
+
+ driver.get("http://localhost:8080/friends");
+ String actualTitle = driver.getTitle();
+ assertThat(actualTitle, containsString("Friends"));
+ }
+}
diff --git a/src/test/java/com/makersacademy/acebook/feature/PostFeatureTest.java b/src/test/java/com/makersacademy/acebook/feature/PostFeatureTest.java
new file mode 100644
index 000000000..563d3ea82
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/feature/PostFeatureTest.java
@@ -0,0 +1,118 @@
+package com.makersacademy.acebook.feature;
+
+import com.github.javafaker.Faker;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.openqa.selenium.*;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.support.ui.*;
+
+import java.time.Duration;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PostFeatureTest {
+
+ WebDriver driver;
+ WebDriverWait wait;
+ Faker faker;
+
+ @Before
+ public void setup() {
+ System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
+ driver = new ChromeDriver();
+ wait = new WebDriverWait(driver, Duration.ofSeconds(15));
+ faker = new Faker();
+ }
+
+ @After
+ public void tearDown() {
+ driver.quit();
+ }
+ //-- login info copied from jordan's test -- required to sign up a new user in order to test
+ private void login() {
+ String email = faker.name().username() + "@email.com";
+ String givenName = faker.name().firstName();
+ String familyName = faker.name().lastName();
+
+ driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
+ driver.get("http://localhost:8080/");
+ driver.findElement(By.linkText("Login / Sign Up")).click();
+ driver.findElement(By.xpath("(//a[text()='Sign Up'])[1]")).click();
+ driver.findElement(By.name("email")).sendKeys(email);
+ driver.findElement(By.name("given_name")).sendKeys(givenName);
+ driver.findElement(By.name("family_name")).sendKeys(familyName);
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ WebElement passwordField = wait.until(
+ ExpectedConditions.elementToBeClickable(By.id("1-password"))
+ );
+ passwordField.sendKeys("Password123");
+ driver.findElement(By.className("auth0-label-submit")).click();
+ driver.findElement(By.name("action")).click();
+ WebElement dropdown = wait.until(
+ ExpectedConditions.elementToBeClickable(By.cssSelector("a.nav-link.dropdown-toggle"))
+ );
+
+ // need to wait for homepage to fully load
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//h1[contains(text(),'Posts')]")));
+ }
+
+ @Test
+ public void testCreatePostCommentAndLike() {
+ login();
+
+ // test post and test comment content
+ String postContent = "TEST_POST_CONTENT";
+ String commentContent = "TEST_COMMENT_CONTENT";
+
+ // -- when a user types a post, it should be appear correctly
+ WebElement postTextArea = wait.until(ExpectedConditions.elementToBeClickable(By.name("content")));
+ postTextArea.sendKeys(postContent);
+ driver.findElement(By.xpath("//input[@value='Post Status']")).click();
+ System.out.println("Post created successfully");
+ // add a wait to make sure post appears
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[contains(text(), '" + postContent + "')]")));
+ System.out.println("Post appears successfully");
+ // locate post container in html to make sure post content is there.
+ WebElement postContainer = driver.findElement(By.xpath("//*[contains(text(), '" + postContent + "')]/ancestor::div[contains(@class, 'post')]"));
+ System.out.println("Post container found successfully");
+
+
+ // -- TEST when a user clicks on 'view post' it should take the user to the individual postId
+ WebElement viewPostLink = postContainer.findElement(By.xpath(".//a[contains(@href, '/posts/')]"));
+ viewPostLink.click();
+ System.out.println("Post navigated successfully");
+
+ // add wait for individual post page to fully load
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("form[action*='/posts/comments']")));
+ System.out.println("Post navigated successfully");
+
+
+ // -- TEST when a user leaves a comment, that comment should appear under the post
+ WebElement commentBox = wait.until(ExpectedConditions.elementToBeClickable(By.name("content")));
+ commentBox.sendKeys(commentContent);
+ WebElement submitButton = wait.until(ExpectedConditions.elementToBeClickable(
+ By.cssSelector("form[action*='/posts/comments'] button[type='submit']")
+ ));
+ submitButton.click();
+ System.out.println("comment submitted successfully");
+ // add a wait and confirm comment appears
+ wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[contains(text(), '" + commentContent + "')]")));
+ assertTrue(driver.getPageSource().contains(commentContent));
+ System.out.println("comment appears successfully");
+
+ // -- TEST when a user likes a post/comment, these should appear successfully
+ WebElement likePostButton = wait.until(ExpectedConditions.elementToBeClickable(
+ By.xpath("//form[contains(@action,'like') and not(contains(@action,'comments'))]//button")
+ ));
+ likePostButton.click();
+ System.out.println("Post/comment liked successfully");
+
+
+ // all elements of test completed successfully
+ System.out.println("Post, comment, and like test successfully completed WOOHOO FINALLY BRUH.");
+ }
+}
diff --git a/src/test/java/com/makersacademy/acebook/feature/ProfilePageTest.java b/src/test/java/com/makersacademy/acebook/feature/ProfilePageTest.java
new file mode 100644
index 000000000..60b9cc085
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/feature/ProfilePageTest.java
@@ -0,0 +1,78 @@
+package com.makersacademy.acebook.feature;
+
+import com.github.javafaker.Faker;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.Duration;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class ProfilePageTest {
+
+ WebDriver driver;
+ Faker faker;
+
+ @Before
+ public void setup() {
+ System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
+ driver = new ChromeDriver();
+ faker = new Faker();
+ }
+
+ @After
+ public void tearDown() {
+ driver.close();
+ }
+
+ @Test
+ public void successfulGetRequestOnProfilePage() {
+ String email = faker.name().username() + "@email.com";
+ String givenName = faker.name().firstName();
+ String familyName = faker.name().lastName();
+
+ driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
+ driver.get("http://localhost:8080/");
+ driver.findElement(By.linkText("Login / Sign Up")).click();
+ driver.findElement(By.xpath("(//a[text()='Sign Up'])[1]")).click();
+ driver.findElement(By.name("email")).sendKeys(email);
+ driver.findElement(By.name("given_name")).sendKeys(givenName);
+ driver.findElement(By.name("family_name")).sendKeys(familyName);
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ WebElement passwordField = wait.until(
+ ExpectedConditions.elementToBeClickable(By.id("1-password"))
+ );
+ passwordField.sendKeys("Password123");
+ driver.findElement(By.className("auth0-label-submit")).click();
+ driver.findElement(By.name("action")).click();
+ WebElement dropdown = wait.until(
+ ExpectedConditions.elementToBeClickable(By.cssSelector("a.nav-link.dropdown-toggle"))
+ );
+ dropdown.click();
+ WebElement ProfileLink = wait.until(
+ ExpectedConditions.elementToBeClickable(By.linkText("My Profile"))
+ );
+ ProfileLink.click();
+ String actualTitle = driver.getTitle();
+ assertThat(actualTitle, containsString("Profile"));
+
+ }
+
+
+}
diff --git a/src/test/java/com/makersacademy/acebook/feature/SettingsTest.java b/src/test/java/com/makersacademy/acebook/feature/SettingsTest.java
new file mode 100644
index 000000000..f9fe6d928
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/feature/SettingsTest.java
@@ -0,0 +1,172 @@
+package com.makersacademy.acebook.feature;
+
+import com.github.javafaker.Faker;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.jupiter.api.Assertions;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.Duration;
+import java.util.List;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class SettingsTest {
+
+ WebDriver driver;
+ Faker faker;
+
+ @Before
+ public void setup() {
+ System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
+ driver = new ChromeDriver();
+ faker = new Faker();
+ }
+
+ @After
+ public void tearDown() {
+ driver.close();
+ }
+
+ @Test
+ public void successfulGetRequestOnSettingsPage() {
+ String email = faker.name().username() + "@email.com";
+ String givenName = faker.name().firstName();
+ String familyName = faker.name().lastName();
+
+ driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
+ driver.get("http://localhost:8080/");
+ driver.findElement(By.linkText("Login / Sign Up")).click();
+ driver.findElement(By.xpath("(//a[text()='Sign Up'])[1]")).click();
+ driver.findElement(By.name("email")).sendKeys(email);
+ driver.findElement(By.name("given_name")).sendKeys(givenName);
+ driver.findElement(By.name("family_name")).sendKeys(familyName);
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ WebElement passwordField = wait.until(
+ ExpectedConditions.elementToBeClickable(By.id("1-password"))
+ );
+ passwordField.sendKeys("Password123");
+ driver.findElement(By.className("auth0-label-submit")).click();
+ driver.findElement(By.name("action")).click();
+ WebElement dropdown = wait.until(
+ ExpectedConditions.elementToBeClickable(By.cssSelector("a.nav-link.dropdown-toggle"))
+ );
+ dropdown.click();
+ WebElement settingsLink = wait.until(
+ ExpectedConditions.elementToBeClickable(By.linkText("Settings"))
+ );
+ settingsLink.click();
+ String actualTitle = driver.getTitle();
+ assertThat(actualTitle, containsString("Settings"));
+
+ }
+
+ @Test
+ public void successfulImageUploadToSettingsPage() {
+ String email = faker.name().username() + "@email.com";
+ String givenName = faker.name().firstName();
+ String familyName = faker.name().lastName();
+
+ driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
+ driver.get("http://localhost:8080/");
+ driver.findElement(By.linkText("Login / Sign Up")).click();
+ driver.findElement(By.xpath("(//a[text()='Sign Up'])[1]")).click();
+ driver.findElement(By.name("email")).sendKeys(email);
+ driver.findElement(By.name("given_name")).sendKeys(givenName);
+ driver.findElement(By.name("family_name")).sendKeys(familyName);
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ WebElement passwordField = wait.until(
+ ExpectedConditions.elementToBeClickable(By.id("1-password"))
+ );
+ passwordField.sendKeys("Password123");
+ driver.findElement(By.className("auth0-label-submit")).click();
+ driver.findElement(By.name("action")).click();
+
+ WebElement dropdown = wait.until(
+ ExpectedConditions.elementToBeClickable(By.cssSelector("a.nav-link.dropdown-toggle"))
+ );
+ dropdown.click();
+ WebElement settingsLink = wait.until(
+ ExpectedConditions.elementToBeClickable(By.linkText("Settings"))
+ );
+ settingsLink.click();
+
+ WebDriverWait waitForImageField = new WebDriverWait(driver, Duration.ofSeconds(10));
+ waitForImageField.until(ExpectedConditions.presenceOfElementLocated(By.xpath("/html/body/div/div/div/form/div[2]/input")));
+
+ Path imagePath = Paths.get("src/test/resources/Test_Profile.png");
+ WebElement fileInput = driver.findElement(By.name("file"));
+ fileInput.sendKeys(imagePath.toAbsolutePath().toString());
+
+ driver.findElement(By.id("submit")).click();
+
+ WebDriverWait waitForImage = new WebDriverWait(driver, Duration.ofSeconds(10));
+ waitForImage.until(ExpectedConditions.presenceOfElementLocated(By.xpath("/html/body/div/div/div/form/div[2]/input")));
+
+ WebElement image = driver.findElement(By.xpath("/html/body/div/div/div/form/div[1]/img"));
+ String src = image.getAttribute("src");
+
+ Assertions.assertFalse(src.contains("default.jpg"));
+ }
+
+ @Test
+ public void successfulNameChangeToSettingsPage() {
+ String email = faker.name().username() + "@email.com";
+ String givenName = faker.name().firstName();
+ String familyName = faker.name().lastName();
+
+ driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
+ driver.get("http://localhost:8080/");
+ driver.findElement(By.linkText("Login / Sign Up")).click();
+ driver.findElement(By.xpath("(//a[text()='Sign Up'])[1]")).click();
+ driver.findElement(By.name("email")).sendKeys(email);
+ driver.findElement(By.name("given_name")).sendKeys(givenName);
+ driver.findElement(By.name("family_name")).sendKeys(familyName);
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ WebElement passwordField = wait.until(
+ ExpectedConditions.elementToBeClickable(By.id("1-password"))
+ );
+ passwordField.sendKeys("Password123");
+ driver.findElement(By.className("auth0-label-submit")).click();
+ driver.findElement(By.name("action")).click();
+
+ WebElement dropdown = wait.until(
+ ExpectedConditions.elementToBeClickable(By.cssSelector("a.nav-link.dropdown-toggle"))
+ );
+ dropdown.click();
+ WebElement settingsLink = wait.until(
+ ExpectedConditions.elementToBeClickable(By.linkText("Settings"))
+ );
+ settingsLink.click();
+
+ WebDriverWait waitForImageField = new WebDriverWait(driver, Duration.ofSeconds(10));
+ waitForImageField.until(ExpectedConditions.presenceOfElementLocated(By.xpath("/html/body/div/div/div/form/div[2]/input")));
+
+ driver.findElement(By.id("lastName")).clear();
+ driver.findElement(By.id("firstName")).clear();
+ driver.findElement(By.id("firstName")).sendKeys("Harry");
+ driver.findElement(By.id("lastName")).sendKeys("Parkes");
+ driver.findElement(By.xpath("//input[@type='submit']")).click();
+
+ waitForImageField.until(ExpectedConditions.presenceOfElementLocated(By.xpath("/html/body/div/div/div/form/div[2]/input")));
+ WebElement firstName = driver.findElement(By.xpath("//*[@id=\"firstName\"]"));
+ WebElement lastName = driver.findElement(By.xpath("//*[@id=\"lastName\"]"));
+ String firstNameValue = firstName.getAttribute("value");
+ assertThat(firstNameValue, equalTo("Harry"));
+ String lastNameValue = lastName.getAttribute("value");
+ assertThat(lastNameValue, equalTo("Parkes"));
+ }
+
+ }
diff --git a/src/test/java/com/makersacademy/acebook/feature/SignUpTest.java b/src/test/java/com/makersacademy/acebook/feature/SignUpTest.java
index dcb1416bb..16ea1f492 100644
--- a/src/test/java/com/makersacademy/acebook/feature/SignUpTest.java
+++ b/src/test/java/com/makersacademy/acebook/feature/SignUpTest.java
@@ -7,7 +7,15 @@
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import java.time.Duration;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
public class SignUpTest {
@@ -27,16 +35,27 @@ public void tearDown() {
}
@Test
- public void successfulSignUpAlsoLogsInUser() {
+ public void userCanSignUp() {
String email = faker.name().username() + "@email.com";
+ String givenName = faker.name().firstName();
+ String familyName = faker.name().lastName();
+ driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5));
driver.get("http://localhost:8080/");
- driver.findElement(By.linkText("Sign up")).click();
+ driver.findElement(By.linkText("Login / Sign Up")).click();
+ driver.findElement(By.xpath("(//a[text()='Sign Up'])[1]")).click();
driver.findElement(By.name("email")).sendKeys(email);
- driver.findElement(By.name("password")).sendKeys("P@55qw0rd");
+ driver.findElement(By.name("given_name")).sendKeys(givenName);
+ driver.findElement(By.name("family_name")).sendKeys(familyName);
+ WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));
+ WebElement passwordField = wait.until(
+ ExpectedConditions.elementToBeClickable(By.id("1-password"))
+ );
+ passwordField.sendKeys("Password123");
+ driver.findElement(By.className("auth0-label-submit")).click();
driver.findElement(By.name("action")).click();
- driver.findElement(By.name("action")).click();
- String greetingText = driver.findElement(By.id("greeting")).getText();
- Assert.assertEquals("Signed in as " + email, greetingText);
+ String actualTitle = driver.getTitle();
+ assertThat(actualTitle, containsString("Acebook"));
+
}
}
diff --git a/src/test/java/com/makersacademy/acebook/model/CommentLikeTest.java b/src/test/java/com/makersacademy/acebook/model/CommentLikeTest.java
new file mode 100644
index 000000000..b1f216ec0
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/model/CommentLikeTest.java
@@ -0,0 +1,20 @@
+package com.makersacademy.acebook.model;
+
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class CommentLikeTest {
+
+ @Test
+ public void commentLikeHasUserIdandCommentId() {
+ CommentLike commentLike = new CommentLike();
+ commentLike.setUserId(1L);
+ commentLike.setCommentId(2L);
+
+ assertEquals(1L, commentLike.getUserId());
+ assertEquals(2L, commentLike.getCommentId());
+ }
+
+
+}
diff --git a/src/test/java/com/makersacademy/acebook/model/FriendRequestTest.java b/src/test/java/com/makersacademy/acebook/model/FriendRequestTest.java
new file mode 100644
index 000000000..5e52d5bae
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/model/FriendRequestTest.java
@@ -0,0 +1,31 @@
+package com.makersacademy.acebook.model;
+
+
+import org.junit.jupiter.api.Test;
+
+import java.sql.Timestamp;
+import java.time.Instant;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+
+
+public class FriendRequestTest {
+
+ Instant instant = Instant.now();
+ Timestamp now = Timestamp.from(instant);
+ FriendRequest request = new FriendRequest(null, 1L, 2L, "pending", now, null);
+
+ @Test
+ public void friendRequestHasRequesterID() {assertThat(request.getRequesterId(), equalTo(1L));}
+
+ @Test
+ public void friendRequestHasReceiverId() {assertThat(request.getReceiverId(), equalTo(2L));}
+
+ @Test
+ public void friendRequestHasStatus() {assertThat(request.getStatus(), containsString("pending"));}
+
+ @Test
+ public void friendRequestHasCreatedAt() {assertThat(request.getCreatedAt(), equalTo(now));}
+}
diff --git a/src/test/java/com/makersacademy/acebook/model/FriendTest.java b/src/test/java/com/makersacademy/acebook/model/FriendTest.java
new file mode 100644
index 000000000..a4b41bae4
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/model/FriendTest.java
@@ -0,0 +1,26 @@
+package com.makersacademy.acebook.model;
+
+import org.junit.jupiter.api.Test;
+
+import java.sql.Timestamp;
+import java.time.Instant;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+
+public class FriendTest {
+
+ Instant instant = Instant.now();
+ Timestamp now = Timestamp.from(instant);
+
+ private Friend friend = new Friend(1L, 2L, now);
+
+ @Test
+ public void friendHasMainUserId() {assertThat(friend.getMainUserId(), equalTo(1L));};
+
+ @Test
+ public void friendHasFriendUserId() {assertThat(friend.getFriendUserId(), equalTo(2L));};
+
+ @Test
+ public void friendHasFriendsSince() {assertThat(friend.getFriendsSince(), equalTo(now));};
+}
diff --git a/src/test/java/com/makersacademy/acebook/model/NotificationTest.java b/src/test/java/com/makersacademy/acebook/model/NotificationTest.java
new file mode 100644
index 000000000..3cacc5c2e
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/model/NotificationTest.java
@@ -0,0 +1,35 @@
+package com.makersacademy.acebook.model;
+
+import org.junit.jupiter.api.Test;
+
+import java.sql.Timestamp;
+import java.time.Instant;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+
+public class NotificationTest {
+
+ Instant instant = Instant.now();
+ Timestamp now = Timestamp.from(instant);
+ private Notification notification = new Notification(1L, 2L, 3L, "commentLike", 4L, 5L, false, now);
+
+ @Test
+ public void notificationReceivingUserId() {assertThat(notification.getReceivingUserId(), equalTo(2L));}
+
+ @Test
+ public void notificationSendingUserId() {assertThat(notification.getSendingUserId(), equalTo(3L));}
+
+ @Test
+ public void notificationType() {assertThat(notification.getType(), containsString("commentLike"));}
+
+ @Test
+ public void notificationPostId() {assertThat(notification.getPostId(), equalTo(4L));}
+
+ @Test
+ public void notificationCommentId() {assertThat(notification.getCommentId(), equalTo(5L));}
+
+ @Test
+ public void notificationCreatedAt() {assertThat(notification.getCreatedAt(), equalTo(now));}
+}
diff --git a/src/test/java/com/makersacademy/acebook/model/PostLikeTest.java b/src/test/java/com/makersacademy/acebook/model/PostLikeTest.java
new file mode 100644
index 000000000..62682ac8f
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/model/PostLikeTest.java
@@ -0,0 +1,17 @@
+package com.makersacademy.acebook.model;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+
+public class PostLikeTest {
+
+ private PostLike postLike = new PostLike(1L, 2L);
+
+ @Test
+ public void postLikeHasUserId() {assertThat(postLike.getUserId(), equalTo(1L));};
+
+ @Test
+ public void postLikeHasPostID() {assertThat(postLike.getPostId(), equalTo(2L));};
+}
diff --git a/src/test/java/com/makersacademy/acebook/model/PostTest.java b/src/test/java/com/makersacademy/acebook/model/PostTest.java
index 926d9b1bf..9f0e94e79 100644
--- a/src/test/java/com/makersacademy/acebook/model/PostTest.java
+++ b/src/test/java/com/makersacademy/acebook/model/PostTest.java
@@ -5,9 +5,15 @@
import org.junit.jupiter.api.Test;
+import java.sql.Timestamp;
+import java.time.Instant;
+
public class PostTest {
- private Post post = new Post("hello");
+ Instant instant = Instant.now();
+ Timestamp now = Timestamp.from(instant);
+
+ private Post post = new Post(null, "hello", 1L, now, null, null);
@Test
public void postHasContent() {
diff --git a/src/test/java/com/makersacademy/acebook/model/UserTest.java b/src/test/java/com/makersacademy/acebook/model/UserTest.java
new file mode 100644
index 000000000..e6d443189
--- /dev/null
+++ b/src/test/java/com/makersacademy/acebook/model/UserTest.java
@@ -0,0 +1,27 @@
+package com.makersacademy.acebook.model;
+
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+public class UserTest {
+
+ private User user = new User("username", "Sasha", "Parkes", "static/images/profile/default.jpeg");
+
+ @Test
+ public void userHasContent() {assertThat(user.getUsername(), containsString("username"));}
+
+ @Test
+ public void userIsEnabled() {assertEquals(true, user.isEnabled());}
+
+ @Test
+ public void userHasFirstName() {assertThat(user.getFirstName(), containsString("Sasha"));}
+
+ @Test
+ public void userHasLastName() {assertThat(user.getLastName(), containsString("Parkes"));}
+
+ @Test
+ public void userHasProfilePic() {assertThat(user.getProfilePic(), containsString("images/profile/default.jpeg"));}
+}
diff --git a/src/test/resources/Test_Profile.png b/src/test/resources/Test_Profile.png
new file mode 100644
index 000000000..a934b14ec
Binary files /dev/null and b/src/test/resources/Test_Profile.png differ
diff --git a/uploads/post_images/30.jpg b/uploads/post_images/30.jpg
new file mode 100644
index 000000000..72576811c
Binary files /dev/null and b/uploads/post_images/30.jpg differ
diff --git a/uploads/post_images/31.jpg b/uploads/post_images/31.jpg
new file mode 100644
index 000000000..686dacc50
Binary files /dev/null and b/uploads/post_images/31.jpg differ
diff --git a/uploads/post_images/37.jpg b/uploads/post_images/37.jpg
new file mode 100644
index 000000000..72576811c
Binary files /dev/null and b/uploads/post_images/37.jpg differ
diff --git a/uploads/post_images/39.jpg b/uploads/post_images/39.jpg
new file mode 100644
index 000000000..ea6a165f9
Binary files /dev/null and b/uploads/post_images/39.jpg differ
diff --git a/uploads/post_images/39.png b/uploads/post_images/39.png
new file mode 100644
index 000000000..536612bfc
Binary files /dev/null and b/uploads/post_images/39.png differ
diff --git a/uploads/post_images/41.jpg b/uploads/post_images/41.jpg
new file mode 100644
index 000000000..5517d911a
Binary files /dev/null and b/uploads/post_images/41.jpg differ
diff --git a/uploads/post_images/82.jpg b/uploads/post_images/82.jpg
new file mode 100644
index 000000000..ea6a165f9
Binary files /dev/null and b/uploads/post_images/82.jpg differ
diff --git a/uploads/post_images/82.png b/uploads/post_images/82.png
new file mode 100644
index 000000000..b48754231
Binary files /dev/null and b/uploads/post_images/82.png differ
diff --git a/uploads/post_images/83.jpg b/uploads/post_images/83.jpg
new file mode 100644
index 000000000..1bc21f017
Binary files /dev/null and b/uploads/post_images/83.jpg differ
diff --git a/uploads/post_images/83.png b/uploads/post_images/83.png
new file mode 100644
index 000000000..93a315713
Binary files /dev/null and b/uploads/post_images/83.png differ
diff --git a/uploads/post_images/abel_post.jpg b/uploads/post_images/abel_post.jpg
new file mode 100644
index 000000000..f74227fe8
Binary files /dev/null and b/uploads/post_images/abel_post.jpg differ
diff --git a/uploads/post_images/adele_post.jpg b/uploads/post_images/adele_post.jpg
new file mode 100644
index 000000000..f44543ec0
Binary files /dev/null and b/uploads/post_images/adele_post.jpg differ
diff --git a/uploads/post_images/ariana_post.jpeg b/uploads/post_images/ariana_post.jpeg
new file mode 100644
index 000000000..81ed03bcc
Binary files /dev/null and b/uploads/post_images/ariana_post.jpeg differ
diff --git a/uploads/post_images/billie_post.jpg b/uploads/post_images/billie_post.jpg
new file mode 100644
index 000000000..b88eb327d
Binary files /dev/null and b/uploads/post_images/billie_post.jpg differ
diff --git a/uploads/post_images/bruno_post.png b/uploads/post_images/bruno_post.png
new file mode 100644
index 000000000..11c0289fa
Binary files /dev/null and b/uploads/post_images/bruno_post.png differ
diff --git a/uploads/post_images/dua_post.jpg b/uploads/post_images/dua_post.jpg
new file mode 100644
index 000000000..3a692e556
Binary files /dev/null and b/uploads/post_images/dua_post.jpg differ
diff --git a/uploads/post_images/ed_post.jpg b/uploads/post_images/ed_post.jpg
new file mode 100644
index 000000000..9c53d421d
Binary files /dev/null and b/uploads/post_images/ed_post.jpg differ
diff --git a/uploads/post_images/folder_for_post_images.txt b/uploads/post_images/folder_for_post_images.txt
new file mode 100644
index 000000000..e69de29bb
diff --git a/uploads/post_images/harry_post.jpg b/uploads/post_images/harry_post.jpg
new file mode 100644
index 000000000..42fd1baeb
Binary files /dev/null and b/uploads/post_images/harry_post.jpg differ
diff --git a/uploads/post_images/justin_post.jpg b/uploads/post_images/justin_post.jpg
new file mode 100644
index 000000000..91482ad81
Binary files /dev/null and b/uploads/post_images/justin_post.jpg differ
diff --git a/uploads/post_images/olivia_post.jpg b/uploads/post_images/olivia_post.jpg
new file mode 100644
index 000000000..bafe78bab
Binary files /dev/null and b/uploads/post_images/olivia_post.jpg differ
diff --git a/uploads/post_images/selena_post.png b/uploads/post_images/selena_post.png
new file mode 100644
index 000000000..536612bfc
Binary files /dev/null and b/uploads/post_images/selena_post.png differ
diff --git a/uploads/post_images/shanni_post.jpg b/uploads/post_images/shanni_post.jpg
new file mode 100644
index 000000000..4808e8b3b
Binary files /dev/null and b/uploads/post_images/shanni_post.jpg differ
diff --git a/uploads/post_images/taylor_post.jpg b/uploads/post_images/taylor_post.jpg
new file mode 100644
index 000000000..f63b55945
Binary files /dev/null and b/uploads/post_images/taylor_post.jpg differ
diff --git a/uploads/user_profile/13.jpg b/uploads/user_profile/13.jpg
new file mode 100644
index 000000000..690a83bd4
Binary files /dev/null and b/uploads/user_profile/13.jpg differ
diff --git a/uploads/user_profile/13.png b/uploads/user_profile/13.png
new file mode 100644
index 000000000..536612bfc
Binary files /dev/null and b/uploads/user_profile/13.png differ
diff --git a/uploads/user_profile/28.jpg b/uploads/user_profile/28.jpg
new file mode 100644
index 000000000..690a83bd4
Binary files /dev/null and b/uploads/user_profile/28.jpg differ
diff --git a/uploads/user_profile/abel.jpg b/uploads/user_profile/abel.jpg
new file mode 100644
index 000000000..5517d911a
Binary files /dev/null and b/uploads/user_profile/abel.jpg differ
diff --git a/uploads/user_profile/adele.jpg b/uploads/user_profile/adele.jpg
new file mode 100644
index 000000000..c7bfdfe20
Binary files /dev/null and b/uploads/user_profile/adele.jpg differ
diff --git a/uploads/user_profile/ariana.jpg b/uploads/user_profile/ariana.jpg
new file mode 100644
index 000000000..036593119
Binary files /dev/null and b/uploads/user_profile/ariana.jpg differ
diff --git a/uploads/user_profile/avian.jpg b/uploads/user_profile/avian.jpg
new file mode 100644
index 000000000..88fe53c8e
Binary files /dev/null and b/uploads/user_profile/avian.jpg differ
diff --git a/uploads/user_profile/beyonce.jpeg b/uploads/user_profile/beyonce.jpeg
new file mode 100644
index 000000000..234b0fb8c
Binary files /dev/null and b/uploads/user_profile/beyonce.jpeg differ
diff --git a/uploads/user_profile/billie.jpg b/uploads/user_profile/billie.jpg
new file mode 100644
index 000000000..7102018df
Binary files /dev/null and b/uploads/user_profile/billie.jpg differ
diff --git a/uploads/user_profile/bruno.jpg b/uploads/user_profile/bruno.jpg
new file mode 100644
index 000000000..09ea1af38
Binary files /dev/null and b/uploads/user_profile/bruno.jpg differ
diff --git a/uploads/user_profile/bts.jpeg b/uploads/user_profile/bts.jpeg
new file mode 100644
index 000000000..2c0d30813
Binary files /dev/null and b/uploads/user_profile/bts.jpeg differ
diff --git a/uploads/user_profile/camila.jpg b/uploads/user_profile/camila.jpg
new file mode 100644
index 000000000..59929a5f3
Binary files /dev/null and b/uploads/user_profile/camila.jpg differ
diff --git a/uploads/user_profile/charlie.jpg b/uploads/user_profile/charlie.jpg
new file mode 100644
index 000000000..1e63c6aed
Binary files /dev/null and b/uploads/user_profile/charlie.jpg differ
diff --git a/uploads/user_profile/doja.jpg b/uploads/user_profile/doja.jpg
new file mode 100644
index 000000000..fd76b4c04
Binary files /dev/null and b/uploads/user_profile/doja.jpg differ
diff --git a/uploads/user_profile/drake.jpeg b/uploads/user_profile/drake.jpeg
new file mode 100644
index 000000000..c81e7580c
Binary files /dev/null and b/uploads/user_profile/drake.jpeg differ
diff --git a/uploads/user_profile/dua.jpg b/uploads/user_profile/dua.jpg
new file mode 100644
index 000000000..c15dfc96a
Binary files /dev/null and b/uploads/user_profile/dua.jpg differ
diff --git a/uploads/user_profile/ed.jpg b/uploads/user_profile/ed.jpg
new file mode 100644
index 000000000..b2d0388c3
Binary files /dev/null and b/uploads/user_profile/ed.jpg differ
diff --git a/uploads/user_profile/folder_for_profile_images.txt b/uploads/user_profile/folder_for_profile_images.txt
new file mode 100644
index 000000000..897cd7f7a
--- /dev/null
+++ b/uploads/user_profile/folder_for_profile_images.txt
@@ -0,0 +1 @@
+git m
\ No newline at end of file
diff --git a/uploads/user_profile/gaga.jpg b/uploads/user_profile/gaga.jpg
new file mode 100644
index 000000000..8c6219a62
Binary files /dev/null and b/uploads/user_profile/gaga.jpg differ
diff --git a/uploads/user_profile/halsey.jpg b/uploads/user_profile/halsey.jpg
new file mode 100644
index 000000000..65f73dceb
Binary files /dev/null and b/uploads/user_profile/halsey.jpg differ
diff --git a/uploads/user_profile/harry.jpg b/uploads/user_profile/harry.jpg
new file mode 100644
index 000000000..6efad45da
Binary files /dev/null and b/uploads/user_profile/harry.jpg differ
diff --git a/uploads/user_profile/harrymc.jpg b/uploads/user_profile/harrymc.jpg
new file mode 100644
index 000000000..3118aace1
Binary files /dev/null and b/uploads/user_profile/harrymc.jpg differ
diff --git a/uploads/user_profile/justin.jpg b/uploads/user_profile/justin.jpg
new file mode 100644
index 000000000..5ffbb5d6a
Binary files /dev/null and b/uploads/user_profile/justin.jpg differ
diff --git a/uploads/user_profile/khalid.jpeg b/uploads/user_profile/khalid.jpeg
new file mode 100644
index 000000000..9bdbf39e7
Binary files /dev/null and b/uploads/user_profile/khalid.jpeg differ
diff --git a/uploads/user_profile/lizzo.jpeg b/uploads/user_profile/lizzo.jpeg
new file mode 100644
index 000000000..35844d0ad
Binary files /dev/null and b/uploads/user_profile/lizzo.jpeg differ
diff --git a/uploads/user_profile/nicki.jpg b/uploads/user_profile/nicki.jpg
new file mode 100644
index 000000000..0702366fe
Binary files /dev/null and b/uploads/user_profile/nicki.jpg differ
diff --git a/uploads/user_profile/olivia.jpg b/uploads/user_profile/olivia.jpg
new file mode 100644
index 000000000..5492f0ad3
Binary files /dev/null and b/uploads/user_profile/olivia.jpg differ
diff --git a/uploads/user_profile/rihanna.jpg b/uploads/user_profile/rihanna.jpg
new file mode 100644
index 000000000..d900a2abd
Binary files /dev/null and b/uploads/user_profile/rihanna.jpg differ
diff --git a/uploads/user_profile/sasha.png b/uploads/user_profile/sasha.png
new file mode 100644
index 000000000..bc01e1868
Binary files /dev/null and b/uploads/user_profile/sasha.png differ
diff --git a/uploads/user_profile/selena.jpg b/uploads/user_profile/selena.jpg
new file mode 100644
index 000000000..ebfa1e070
Binary files /dev/null and b/uploads/user_profile/selena.jpg differ
diff --git a/uploads/user_profile/shanni.png b/uploads/user_profile/shanni.png
new file mode 100644
index 000000000..f636ed8ac
Binary files /dev/null and b/uploads/user_profile/shanni.png differ
diff --git a/uploads/user_profile/shawn.jpg b/uploads/user_profile/shawn.jpg
new file mode 100644
index 000000000..f400241c2
Binary files /dev/null and b/uploads/user_profile/shawn.jpg differ
diff --git a/uploads/user_profile/sza.jpg b/uploads/user_profile/sza.jpg
new file mode 100644
index 000000000..3002feb2e
Binary files /dev/null and b/uploads/user_profile/sza.jpg differ
diff --git a/uploads/user_profile/taylor.jpg b/uploads/user_profile/taylor.jpg
new file mode 100644
index 000000000..91ba659f7
Binary files /dev/null and b/uploads/user_profile/taylor.jpg differ
diff --git a/uploads/user_profile/zayn.jpg b/uploads/user_profile/zayn.jpg
new file mode 100644
index 000000000..24f439ecb
Binary files /dev/null and b/uploads/user_profile/zayn.jpg differ
Comments
+No comments yet. Be the first to comment!
+1 comment so far.
+