diff options
author | Mavlushechka <mavlushechka@gmail.com> | 2022-10-14 00:03:53 +0500 |
---|---|---|
committer | Mavlushechka <mavlushechka@gmail.com> | 2022-10-14 00:03:53 +0500 |
commit | 2ec0d544ebfd7657a3a14b37a36db5b46e200b88 (patch) | |
tree | bcfc0f445cc394bf5ec454c6ed544035645f1915 /src/test/java/com/mavlushechka | |
parent | f8501d374dbd39a66078bad11384ea241848acc6 (diff) |
Solve 1st test case
Diffstat (limited to 'src/test/java/com/mavlushechka')
-rw-r--r-- | src/test/java/com/mavlushechka/a1qa/TestCase1.java | 71 |
1 files changed, 11 insertions, 60 deletions
diff --git a/src/test/java/com/mavlushechka/a1qa/TestCase1.java b/src/test/java/com/mavlushechka/a1qa/TestCase1.java index c6b3b2d..985ca56 100644 --- a/src/test/java/com/mavlushechka/a1qa/TestCase1.java +++ b/src/test/java/com/mavlushechka/a1qa/TestCase1.java @@ -1,73 +1,24 @@ package com.mavlushechka.a1qa; -import aquality.selenium.browser.AqualityServices; -import com.mavlushechka.a1qa.models.Attachment; -import com.mavlushechka.a1qa.models.Comment; -import com.mavlushechka.a1qa.models.Post; -import com.mavlushechka.a1qa.models.User; -import com.mavlushechka.a1qa.pages.FeedPage; -import com.mavlushechka.a1qa.pages.HomePage; -import com.mavlushechka.a1qa.pages.ProfilePage; -import com.mavlushechka.a1qa.pages.SignInPage; +import com.mavlushechka.a1qa.utils.Database; import com.mavlushechka.a1qa.utils.JsonParser; import com.mavlushechka.a1qa.utils.LoggerUtils; -import com.mavlushechka.a1qa.utils.StringUtils; -import com.mavlushechka.a1qa.utils.VkApiUtils; -import org.testng.Assert; import org.testng.annotations.Test; -import java.io.IOException; +import java.time.LocalDate; public class TestCase1 extends BaseTest { @Test - public void test1() throws IOException { - HomePage homePage = new HomePage(); - Assert.assertTrue(homePage.isOpened(), "This is not the " + homePage.getName() + " page."); - LoggerUtils.step("[UI] Authorize."); - homePage.performAuthorization(JsonParser.parseData("testData", "vkontakte.account.login")); - - SignInPage signInPage = new SignInPage(); - Assert.assertTrue(signInPage.isOpened(), "This is not the " + signInPage.getName() + " page."); - signInPage.performAuthorization(JsonParser.parseData("testData", "vkontakte.account.password")); - - FeedPage feedPage = new FeedPage(); - Assert.assertTrue(feedPage.isOpened(), "This is not the " + feedPage.getName() + " page."); - AqualityServices.getBrowser().waitForPageToLoad(); - LoggerUtils.step("[UI] Go to \"My profile\"."); - feedPage.clickMyProfileButton(); - - ProfilePage profilePage = new ProfilePage(); - Assert.assertTrue(profilePage.isOpened(), "This is not the " + profilePage.getName() + " page."); - User user = VkApiUtils.getCurrentUser(); - int textLettersLowerBound = Integer.parseInt(JsonParser.parseData("config", "randomTextGenerator.lettersLowerBound")); - int textLettersUpperBound = Integer.parseInt(JsonParser.parseData("config", "randomTextGenerator.lettersUpperBound")); - int textLength = Integer.parseInt(JsonParser.parseData("config", "randomTextGenerator.length")); - String postRandomText = StringUtils.generateRandomText(textLettersLowerBound, textLettersUpperBound, textLength); - LoggerUtils.step("[API] Create post on the wall with randomly generated text using API-request and save id of the post from the API-response."); - Post post = new Post(VkApiUtils.createPost(postRandomText), user, postRandomText, null); - LoggerUtils.step("[UI] Check that post with the sent text from the correct user appeared on the wall without refreshing the page."); - Assert.assertTrue(profilePage.contains(post), "This is not the correct post."); - Attachment picture = new Attachment(com.mavlushechka.a1qa.constants.Attachment.PHOTO, user.getId(), Integer.parseInt(JsonParser.parseData("testData", "vkontakte.photoFromAlbum.id"))); - LoggerUtils.step("[API] Edit the added post using API-request - change text and add(upload) a picture."); - Post editedPost = new Post(post.id(), user, post.message() + "[edited]", picture); - VkApiUtils.editPost(post, editedPost); - profilePage.waitForPostUpdate(editedPost); - LoggerUtils.step("[UI] Check that text was updated and the picture was uploaded(make sure that pictures are the same) without refreshing the page."); - Assert.assertTrue(profilePage.contains(editedPost), "This is not the correct post."); - String commentRandomText = StringUtils.generateRandomText(textLettersLowerBound, textLettersUpperBound, textLength); - LoggerUtils.step("[API] Add a comment to the post with the randomly generated text using API-request."); - Comment comment = new Comment(VkApiUtils.createComment(editedPost.id(), commentRandomText), user, editedPost, commentRandomText); - LoggerUtils.step("[UI] Check that comment from the correct user was added to the post without refreshing the page."); - Assert.assertTrue(profilePage.contains(comment), "This is not the correct comment."); - LoggerUtils.step("[UI] Like the post using UI."); - profilePage.clickPostLikeButton(post); - LoggerUtils.step("[API] Check that the post received like from the correct user using API-request."); - Assert.assertTrue(VkApiUtils.containsLike(editedPost, user), "The post did not receive like from the correct user."); - LoggerUtils.step("[API] Delete the post using API-request."); - VkApiUtils.deletePost(editedPost); - profilePage.waitForPostDelete(editedPost); - Assert.assertTrue(profilePage.notContains(editedPost), "The post is not deleted."); + public void test1() { + LoggerUtils.step("Для каждого теста вывести минимальное время работы. Сортировать по проектам, и по тестам внутри проектов."); + LoggerUtils.info(Database.getTests().toString()); + LoggerUtils.step("Вывести в лог все проекты с указанием количества уникальных тестов на проекте."); + LoggerUtils.info(Database.getTestsCount().toString()); + LoggerUtils.step("Вывести тесты для каждого проекта, которые выполнялись не раньше 7 ноября 2015. Сортировать по проектам, и по тестам внутри проектов."); + LoggerUtils.info(Database.getTestsByLowerDate(LocalDate.parse(JsonParser.parseData("testData", "testsLowerDate"))).toString()); + LoggerUtils.step("Вывести количество тестов, выполнявшихся на Firefox и на Chrome."); + LoggerUtils.info(Database.getBrowserTestsCount().toString()); } } |