summaryrefslogtreecommitdiff
path: root/src/main/java/com/mavlushechka/a1qa/pages
diff options
context:
space:
mode:
authorMavlushechka <mavlushechka@gmail.com>2022-10-14 00:03:53 +0500
committerMavlushechka <mavlushechka@gmail.com>2022-10-14 00:03:53 +0500
commit2ec0d544ebfd7657a3a14b37a36db5b46e200b88 (patch)
treebcfc0f445cc394bf5ec454c6ed544035645f1915 /src/main/java/com/mavlushechka/a1qa/pages
parentf8501d374dbd39a66078bad11384ea241848acc6 (diff)
Solve 1st test case
Diffstat (limited to 'src/main/java/com/mavlushechka/a1qa/pages')
-rw-r--r--src/main/java/com/mavlushechka/a1qa/pages/CommentForm.java28
-rw-r--r--src/main/java/com/mavlushechka/a1qa/pages/CommentsForm.java32
-rw-r--r--src/main/java/com/mavlushechka/a1qa/pages/FeedPage.java19
-rw-r--r--src/main/java/com/mavlushechka/a1qa/pages/HomePage.java25
-rw-r--r--src/main/java/com/mavlushechka/a1qa/pages/PostForm.java67
-rw-r--r--src/main/java/com/mavlushechka/a1qa/pages/ProfilePage.java41
-rw-r--r--src/main/java/com/mavlushechka/a1qa/pages/ProfileWallForm.java43
-rw-r--r--src/main/java/com/mavlushechka/a1qa/pages/SideBarForm.java20
-rw-r--r--src/main/java/com/mavlushechka/a1qa/pages/SignInPage.java30
9 files changed, 0 insertions, 305 deletions
diff --git a/src/main/java/com/mavlushechka/a1qa/pages/CommentForm.java b/src/main/java/com/mavlushechka/a1qa/pages/CommentForm.java
deleted file mode 100644
index d087336..0000000
--- a/src/main/java/com/mavlushechka/a1qa/pages/CommentForm.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.mavlushechka.a1qa.pages;
-
-import aquality.selenium.browser.AqualityServices;
-import aquality.selenium.elements.interfaces.ILabel;
-import com.mavlushechka.a1qa.models.Comment;
-import org.openqa.selenium.By;
-
-import java.util.Objects;
-
-public class CommentForm extends BaseForm {
-
- private final ILabel commentLabel;
- private final ILabel commentText;
-
-
- public CommentForm(Comment comment) {
- super(AqualityServices.getElementFactory().getLabel(By.id("post" + comment.user().getId() + "_" + comment.id()), "Comment"), "Comment form");
- String commentXpath = "//*[@id='" + "post" + comment.user().getId() + "_" + comment.id() + "']";
- commentLabel = AqualityServices.getElementFactory().getLabel(By.xpath(commentXpath), "Comment");
- commentText = AqualityServices.getElementFactory().getLabel(By.xpath(commentXpath + "//*[contains(@class, 'wall_reply_text')]"), "Comment");
- }
-
- public boolean contains(Comment comment) {
- return Objects.equals(Integer.parseInt(commentLabel.getAttribute("data-answering-id")), comment.user().getId())
- && Objects.equals(commentText.getText(), comment.message());
- }
-
-}
diff --git a/src/main/java/com/mavlushechka/a1qa/pages/CommentsForm.java b/src/main/java/com/mavlushechka/a1qa/pages/CommentsForm.java
deleted file mode 100644
index 4ae6a01..0000000
--- a/src/main/java/com/mavlushechka/a1qa/pages/CommentsForm.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.mavlushechka.a1qa.pages;
-
-import aquality.selenium.browser.AqualityServices;
-import aquality.selenium.elements.interfaces.IButton;
-import com.mavlushechka.a1qa.models.Comment;
-import com.mavlushechka.a1qa.models.Post;
-import org.openqa.selenium.By;
-
-public class CommentsForm extends BaseForm {
-
- private final IButton nextCommentsButton;
-
-
- public CommentsForm(Post post) {
- super(AqualityServices.getElementFactory().getLabel(By.id("replies_wrap" + post.owner().getId() + "_" + post.id()), "Comments"),
- "Comments form");
- nextCommentsButton = AqualityServices.getElementFactory().getButton(
- By.xpath("//*[@id='" + "replies_wrap" + post.owner().getId() + "_" + post.id() + "']//*[contains(@class, 'replies_next')]"),
- "Next comments"
- );
- }
-
- public boolean contains(Comment comment) {
- CommentForm commentForm = new CommentForm(comment);
-
- if (nextCommentsButton.getElement().isDisplayed()) {
- nextCommentsButton.click();
- }
- return commentForm.contains(comment);
- }
-
-}
diff --git a/src/main/java/com/mavlushechka/a1qa/pages/FeedPage.java b/src/main/java/com/mavlushechka/a1qa/pages/FeedPage.java
deleted file mode 100644
index bebecc1..0000000
--- a/src/main/java/com/mavlushechka/a1qa/pages/FeedPage.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.mavlushechka.a1qa.pages;
-
-import aquality.selenium.browser.AqualityServices;
-import org.openqa.selenium.By;
-
-public class FeedPage extends BaseForm {
-
- private final SideBarForm sideBarForm = new SideBarForm();
-
-
- public FeedPage() {
- super(AqualityServices.getElementFactory().getLabel(By.id("main_feed"), "Main feed"), "Feed");
- }
-
- public void clickMyProfileButton() {
- sideBarForm.clickMyProfileButton();
- }
-
-}
diff --git a/src/main/java/com/mavlushechka/a1qa/pages/HomePage.java b/src/main/java/com/mavlushechka/a1qa/pages/HomePage.java
deleted file mode 100644
index 20339f8..0000000
--- a/src/main/java/com/mavlushechka/a1qa/pages/HomePage.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.mavlushechka.a1qa.pages;
-
-import aquality.selenium.browser.AqualityServices;
-import aquality.selenium.elements.interfaces.IButton;
-import aquality.selenium.elements.interfaces.ITextBox;
-import org.openqa.selenium.By;
-
-public class HomePage extends BaseForm {
-
- private final ITextBox phoneOrEmailTextBox = AqualityServices.getElementFactory().getTextBox(By.id("index_email"), "Phone or email");
- private final IButton signInButton = AqualityServices.getElementFactory().getButton(
- By.xpath("//button[contains(@class, 'VkIdForm__signInButton')]"),"Sign in"
- );
-
-
- public HomePage() {
- super(AqualityServices.getElementFactory().getLabel(By.xpath("//*[contains(@class, 'IndexPageContent')]"), "Index page content"), "Home");
- }
-
- public void performAuthorization(String phoneOrEmail) {
- phoneOrEmailTextBox.clearAndType(phoneOrEmail);
- signInButton.click();
- }
-
-}
diff --git a/src/main/java/com/mavlushechka/a1qa/pages/PostForm.java b/src/main/java/com/mavlushechka/a1qa/pages/PostForm.java
deleted file mode 100644
index dc5f8b0..0000000
--- a/src/main/java/com/mavlushechka/a1qa/pages/PostForm.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.mavlushechka.a1qa.pages;
-
-import aquality.selenium.browser.AqualityServices;
-import aquality.selenium.elements.interfaces.IButton;
-import aquality.selenium.elements.interfaces.ILabel;
-import com.mavlushechka.a1qa.models.Comment;
-import com.mavlushechka.a1qa.models.Post;
-import org.openqa.selenium.By;
-
-import java.util.Objects;
-
-public class PostForm extends BaseForm {
-
- private final ILabel authorLabel;
- private final ILabel textLabel;
- private final ILabel imageLabel;
- private final IButton likeButton;
-
-
- public PostForm(Post post) {
- super(AqualityServices.getElementFactory().getLabel(By.id("post" + post.owner().getId() + "_" + post.id()), "Post"), "Post form");
- String postXpath = "//*[@id='" + "post" + post.owner().getId() + "_" + post.id() + "']";
- authorLabel = AqualityServices.getElementFactory().getLabel(
- By.xpath(postXpath + "//*[contains(@class, 'post_author')]//a[contains(@class, 'author')]"), "Post author"
- );
- textLabel = AqualityServices.getElementFactory().getLabel(By.xpath(postXpath + "//*[contains(@class, 'wall_post_text')]"), "Post text");
- imageLabel = AqualityServices.getElementFactory().getLabel(
- By.xpath(postXpath + "//*[contains(@class, 'page_post_thumb_wrap')]"), "Post image"
- );
- likeButton = AqualityServices.getElementFactory().getButton(By.xpath(postXpath + "//*[@data-reaction-set-id='reactions']"), "Like");
- }
-
- public boolean contains(Post post) {
- boolean containsPost = Objects.equals(authorLabel.getText(), post.owner().getFirstName() + " " + post.owner().getLastName())
- && Objects.equals(textLabel.getText(), post.message());
-
- if (post.attachment() != null) {
- containsPost &= Objects.equals(post.attachment().toString(), imageLabel.getAttribute("href").split("vk.com/")[1]);
- } else {
- containsPost &= !imageLabel.state().isDisplayed();
- }
-
- return containsPost;
- }
-
- public boolean contains(Comment comment) {
- return new CommentsForm(comment.post()).contains(comment);
- }
-
- public void clickLikeButton() {
- likeButton.getElement().click();
- }
-
- public void waitForUpdate() {
- String text = textLabel.getText();
- AqualityServices.getConditionalWait().waitFor(() -> !Objects.equals(textLabel.getText(), text));
- }
-
- public void waitForDelete() {
- AqualityServices.getConditionalWait().waitFor(this::notExists);
- }
-
- public boolean notExists() {
- return !authorLabel.state().isDisplayed();
- }
-
-}
diff --git a/src/main/java/com/mavlushechka/a1qa/pages/ProfilePage.java b/src/main/java/com/mavlushechka/a1qa/pages/ProfilePage.java
deleted file mode 100644
index 816517d..0000000
--- a/src/main/java/com/mavlushechka/a1qa/pages/ProfilePage.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.mavlushechka.a1qa.pages;
-
-import aquality.selenium.browser.AqualityServices;
-import com.mavlushechka.a1qa.models.Comment;
-import com.mavlushechka.a1qa.models.Post;
-import org.openqa.selenium.By;
-
-public class ProfilePage extends BaseForm {
-
- private final ProfileWallForm profileWallForm = new ProfileWallForm();
-
-
- public ProfilePage() {
- super(AqualityServices.getElementFactory().getLabel(By.id("profile"), "Profile"), "Profile");
- }
-
- public boolean contains(Post post) {
- return profileWallForm.contains(post);
- }
-
- public boolean contains(Comment comment) {
- return profileWallForm.contains(comment);
- }
-
- public boolean notContains(Post post) {
- return profileWallForm.notContains(post);
- }
-
- public void clickPostLikeButton(Post post) {
- profileWallForm.clickPostLikeButton(post);
- }
-
- public void waitForPostUpdate(Post post) {
- profileWallForm.waitForPostUpdate(post);
- }
-
- public void waitForPostDelete(Post post) {
- profileWallForm.waitForPostDelete(post);
- }
-
-}
diff --git a/src/main/java/com/mavlushechka/a1qa/pages/ProfileWallForm.java b/src/main/java/com/mavlushechka/a1qa/pages/ProfileWallForm.java
deleted file mode 100644
index d8ddc37..0000000
--- a/src/main/java/com/mavlushechka/a1qa/pages/ProfileWallForm.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.mavlushechka.a1qa.pages;
-
-import aquality.selenium.browser.AqualityServices;
-import com.mavlushechka.a1qa.models.Comment;
-import com.mavlushechka.a1qa.models.Post;
-import org.openqa.selenium.By;
-
-public class ProfileWallForm extends BaseForm {
-
- public ProfileWallForm() {
- super(AqualityServices.getElementFactory().getLabel(By.id("profile_wall"), "Profile wall"), "Profile wall form");
- }
-
- public boolean contains(Post post) {
- PostForm postForm = new PostForm(post);
-
- if (!postForm.isOpened()) {
- return false;
- }
- return postForm.contains(post);
- }
-
- public boolean notContains(Post post) {
- return new PostForm(post).notExists();
- }
-
- public boolean contains(Comment comment) {
- return new PostForm(comment.post()).contains(comment);
- }
-
- public void clickPostLikeButton(Post post) {
- new PostForm(post).clickLikeButton();
- }
-
- public void waitForPostUpdate(Post post) {
- new PostForm(post).waitForUpdate();
- }
-
- public void waitForPostDelete(Post post) {
- new PostForm(post).waitForDelete();
- }
-
-}
diff --git a/src/main/java/com/mavlushechka/a1qa/pages/SideBarForm.java b/src/main/java/com/mavlushechka/a1qa/pages/SideBarForm.java
deleted file mode 100644
index 8df8c3d..0000000
--- a/src/main/java/com/mavlushechka/a1qa/pages/SideBarForm.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.mavlushechka.a1qa.pages;
-
-import aquality.selenium.browser.AqualityServices;
-import aquality.selenium.elements.interfaces.IButton;
-import org.openqa.selenium.By;
-
-public class SideBarForm extends BaseForm {
-
- private final IButton myProfileButton = AqualityServices.getElementFactory().getButton(By.id("l_pr"), "My profile");
-
-
- public SideBarForm() {
- super(AqualityServices.getElementFactory().getLabel(By.id("side_bar"), "Side bar"), "Side bar form");
- }
-
- public void clickMyProfileButton() {
- myProfileButton.click();
- }
-
-}
diff --git a/src/main/java/com/mavlushechka/a1qa/pages/SignInPage.java b/src/main/java/com/mavlushechka/a1qa/pages/SignInPage.java
deleted file mode 100644
index 56c16e7..0000000
--- a/src/main/java/com/mavlushechka/a1qa/pages/SignInPage.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.mavlushechka.a1qa.pages;
-
-import aquality.selenium.browser.AqualityServices;
-import aquality.selenium.elements.interfaces.IButton;
-import aquality.selenium.elements.interfaces.ITextBox;
-import org.openqa.selenium.By;
-
-public class SignInPage extends BaseForm {
-
- private final ITextBox passwordTextBox = AqualityServices.getElementFactory().getTextBox(
- By.xpath("//input[contains(@name, 'password')]"), "Password"
- );
- private final IButton continueButton = AqualityServices.getElementFactory().getButton(
- By.xpath("//*[contains(@class, 'vkc__EnterPasswordNoUserInfo__buttonWrap')]//button[contains(@class, 'vkuiButton')]"), "Continue"
- );
-
-
- public SignInPage() {
- super(
- AqualityServices.getElementFactory().getLabel(By.xpath("//form[contains(@class, 'vkc__EnterPasswordNoUserInfo__content')]"),
- "Password form"), "Sign in"
- );
- }
-
- public void performAuthorization(String password) {
- passwordTextBox.clearAndType(password);
- continueButton.click();
- }
-
-}