blob: 4583a39f4e3f238633ef86a33611e9f917e414cc (
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
|
package com.mavlushechka.a1qa.project.pages;
import aquality.selenium.browser.AqualityServices;
import aquality.selenium.elements.ElementType;
import aquality.selenium.elements.interfaces.IElement;
import aquality.selenium.forms.Form;
import com.mavlushechka.a1qa.framework.utils.StringUtils;
import com.mavlushechka.a1qa.project.constants.Result;
import com.mavlushechka.a1qa.project.models.Test;
import org.openqa.selenium.By;
import java.util.ArrayList;
import java.util.List;
public class TestsPage extends Form {
private final By runningTest = By.xpath("//*[contains(@class,'panel')]//table[contains(@class,'table')]//tbody//td");
public TestsPage() {
super(By.id("pie"), "Tests");
}
public List<Test> getAllRunningTests() {
AqualityServices.getConditionalWait().waitFor(() -> AqualityServices.getElementFactory().findElements(runningTest, ElementType.LABEL).size() > 5);
List<IElement> testsData = AqualityServices.getElementFactory().findElements(runningTest, ElementType.LABEL);
List<Test> runningTests = new ArrayList<>();
for (int i = 0; i < testsData.size(); i += 7) {
runningTests.add(
new Test(
testsData.get(i).getText(),
testsData.get(i + 1).getText(),
Result.valueOf(StringUtils.convertToConstantCase(testsData.get(i + 2).getText())),
testsData.get(i + 3).getText(),
testsData.get(i + 4).getText(),
testsData.get(i + 5).getText()
)
);
}
return runningTests;
}
}
|