summaryrefslogtreecommitdiff
path: root/src/main/java/com/mavlushechka/a1qa/pages/GamePage.java
blob: 2e80d323959757da238078416dec71f49cda22b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.mavlushechka.a1qa.pages;

import com.mavlushechka.a1qa.elements.Label;
import com.mavlushechka.a1qa.models.Interest;
import com.mavlushechka.a1qa.models.User;
import org.openqa.selenium.By;

public class GamePage extends BaseForm {

    private final FirstCardForm firstCardForm = new FirstCardForm();
    private final SecondCardForm secondCardForm = new SecondCardForm();
    private final HelpForm helpForm = new HelpForm();
    private final CookiesForm cookiesForm = new CookiesForm();
    private final Label timer = new Label(By.xpath("//*[contains(@class, 'timer')]"), "Timer");


    public GamePage() {
        super(new Label(By.xpath("//*[@id='app']//*[contains(@class, 'game')]"), "Game view"), "Game");
    }

    public boolean isFirstCardFormOpened() {
        return firstCardForm.isOpened();
    }

    public void performAuthorization(User user) {
        firstCardForm.performAuthorization(user);
    }

    public boolean isSecondCardOpened() {
        return secondCardForm.isOpened();
    }

    public void select(Interest interest) {
        secondCardForm.select(interest);
    }

    public void clickDownloadImageButton() {
        secondCardForm.clickDownloadImageButton();
    }

    public void hideHelpForm() {
        helpForm.hide();
    }

    public boolean isHelpFormHidden() {
        return helpForm.isHidden();
    }

    public void acceptCookies() {
        cookiesForm.accept();
    }

    public boolean isCookiesFormHidden() {
        return cookiesForm.isHidden();
    }

    public String getTimerText() {
        return timer.getText();
    }

}