diff options
author | Mavlushechka <mavlushechka@gmail.com> | 2022-11-02 21:47:29 +0500 |
---|---|---|
committer | Mavlushechka <mavlushechka@gmail.com> | 2022-11-03 21:22:29 +0500 |
commit | ac1a4d36a14695a2284198574f198997db8fe659 (patch) | |
tree | 8d9f566b14357bed5874926d0ddb36d498e3f540 /src/test | |
parent | 7f42595e4a286fc92ad0ac091dce6c47ae90f6af (diff) |
Solve the 2nd step of the TestCase1 test case
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/java/com/mavlushechka/a1qa/project/TestCase1.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/java/com/mavlushechka/a1qa/project/TestCase1.java b/src/test/java/com/mavlushechka/a1qa/project/TestCase1.java index e50f89b..722b0da 100644 --- a/src/test/java/com/mavlushechka/a1qa/project/TestCase1.java +++ b/src/test/java/com/mavlushechka/a1qa/project/TestCase1.java @@ -1,9 +1,13 @@ package com.mavlushechka.a1qa.project; +import aquality.selenium.browser.AqualityServices; import com.mavlushechka.a1qa.framework.BaseTest; import com.mavlushechka.a1qa.framework.utils.JsonParser; import com.mavlushechka.a1qa.framework.utils.LoggerUtils; +import com.mavlushechka.a1qa.project.models.User; +import com.mavlushechka.a1qa.project.pages.ProjectsPage; import com.mavlushechka.a1qa.project.utils.SiteApiUtils; +import org.openqa.selenium.Cookie; import org.testng.annotations.Test; import java.io.IOException; @@ -14,6 +18,14 @@ public class TestCase1 extends BaseTest { public void test1() throws IOException { LoggerUtils.step("Query the api to retrieve the token according to the option number."); String token = SiteApiUtils.generateToken(Integer.parseInt(JsonParser.parseData("testData", "variant"))); + + ProjectsPage projectsPage = new ProjectsPage(); + User user = JsonParser.convertToObject(JsonParser.parseObject("testData", "user"), User.class); + LoggerUtils.step("Go to the website. Complete the necessary authorisation." + + "Transfer the token (parameter token) generated in step 1 using a cookie. Refresh the page."); + projectsPage.performAuthorization(user); + AqualityServices.getBrowser().getDriver().manage().addCookie(new Cookie("token", token)); + AqualityServices.getBrowser().refresh(); } } |