summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/att/ecomp/dcae/ci/ui/rule_editor/components/RuleComponent.java
blob: 94bf547c18db93ef84a24f7c27023d0a82ec9700 (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
package com.att.ecomp.dcae.ci.ui.rule_editor.components;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.WebDriverWait;

import com.att.ecomp.dcae.ci.ui.utils.ByTest;
import com.att.ecomp.dcae.ci.ui.utils.Locator;
import com.att.ecomp.dcae.ci.utilities.Report;
import com.aventstack.extentreports.Status;

public class RuleComponent extends BaseComponenet {

	public RuleComponent(WebDriverWait timeout, WebElement element) {
		super(timeout, element);
	}
	
	public String getDescription(){
		Report.log(Status.INFO, "Get rule description");
		return root.getText();
	}
	
	public RulePopup clickEdit(WebDriver driver, WebElement homePageRoot){
		Report.log(Status.INFO, "Click on edit...");
		Actions action  = new Actions(driver);
		action.moveToElement(root).perform();
		wait.until(Locator.from(root).findVisible(ByTest.id("editRule"), 0)).click();
		WebElement rulePopupElem = wait.until(Locator.from(homePageRoot).findVisible(ByTest.id("popupRuleEditor"), 0));
		return new RulePopup(wait, rulePopupElem);
	}
	
	public void clickDelete(WebDriver driver){
		Report.log(Status.INFO, "Click on delete...");
		Actions action  = new Actions(driver);
		action.moveToElement(root).perform();
		wait.until(Locator.from(root).findVisible(ByTest.id("deleteRule"), 0)).click();
	}

}