aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java
diff options
context:
space:
mode:
authorSonsino, Ofir (os0695) <os0695@intl.att.com>2018-08-12 14:51:28 +0300
committerSonsino, Ofir (os0695) <os0695@intl.att.com>2018-08-12 15:02:57 +0300
commit4a4dcc5185f8ba5a28c7f9fef509f32c0c2389e6 (patch)
tree23e55ee7e1ad9b91bcc3ef1dbe1fb7b183f8b2b6 /vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java
parent661a24fd57de02869a9771761e0fcba7eb77d121 (diff)
vid-automation selenium tests
Change-Id: I6c1b0a0cf3bbfa4314c81f0cc72507db805ec632 Issue-ID: VID-281 Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
Diffstat (limited to 'vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java')
-rw-r--r--vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java b/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java
new file mode 100644
index 000000000..e5dd1bb39
--- /dev/null
+++ b/vid-automation/src/main/java/vid/automation/test/sections/InstantiationStatusPage.java
@@ -0,0 +1,59 @@
+package vid.automation.test.sections;
+
+import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+import vid.automation.test.infra.Get;
+
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+public abstract class InstantiationStatusPage extends VidBasePage {
+
+ public static final String refreshButtonId = "refresh-btn";
+
+ public static String getWebTrTdSpanElementByParentID(WebElement tr, String id, int timeout) {
+ return tr.findElements(By.xpath(".//*[@id='" + id + "']//span")).get(0).getText();
+ }
+
+ public static int getNumberOfTableRows(int timeout){
+ WebDriverWait wait = waitUntilDriverIsReady(timeout);
+ return wait.until(ExpectedConditions.visibilityOfAllElementsLocatedBy(By.xpath("//*[table]//tbody/tr"))).size();
+ }
+
+ public static WebElement assertInstantiationStatusRow(String spanIdSelector, Map<String, String> fieldsIdsAndExpected) {
+ try {
+ WebElement newTrRow = getInstantiationStatusRow(spanIdSelector);
+ final Map<String, String> fieldIdAndActual = fieldsIdsAndExpected.entrySet().stream()
+ .collect(Collectors.toMap(
+ kv -> kv.getKey(),
+ kv -> getWebTrTdSpanElementByParentID(newTrRow, kv.getKey(), 1)
+ ));
+
+ assertThat("failed comparing spanIdSelector " + spanIdSelector, fieldIdAndActual, is(fieldsIdsAndExpected));
+
+ return newTrRow;
+ } catch (Exception e) {
+ throw new RuntimeException("error while assertInstantiationStatusRow with: String spanIdSelector=" +
+ spanIdSelector + ", fieldsIdsAndExpected=" + fieldsIdsAndExpected, e);
+ }
+ }
+
+ public static WebElement getInstantiationStatusRow(String spanIdSelector) {
+ GeneralUIUtils.ultimateWait();
+ return Get.byXpath("//*[@id='" + spanIdSelector + "']/parent::*/parent::*/parent::*", 0);
+ }
+
+ public static void clickRefreshButton() {
+ WebDriverWait wait = waitUntilDriverIsReady(0);
+ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='"+ refreshButtonId + "']"))).click();
+ GeneralUIUtils.ultimateWait();
+ }
+
+
+}