Professional Documents
Culture Documents
timeserieschart;
import java.awt.Robot;
import java.awt.event.InputEvent;
import org.openqa.selenium.Point;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.twx.base.BaseTest;
import com.twx.common.TWWebElement;
import com.twx.common.requirements.Requirements;
import com.twx.common.utilities.ScreenCapture;
import com.twx.common.utilities.ThingworxRESTUtils;
@BeforeClass(alwaysRun = true)
public void beforeClass() throws Exception {
// Import entities
getThingworxRESTUtils().importXmlEntities(TEST_ENTITIES_FILE_NAME, true,
ThingworxRESTUtils.HTTP_OK);
navigateToMashupInRuntime(AUTOMATION_TIMESERIES_MASHUP_CHART);
}
// from baseTest.
@BeforeMethod(alwaysRun = true)
public void beforeMethod() {
getWebdriver().navigate().refresh();
getPages().mashupRuntimePage().waitForLoadIconToBeInvisible(TIMESERIES_CHART_1, 1);
}
@Requirements(reqs = { "TW-25352" })
@Test(description = "Verify single data source & other visual scenarios",
groups = { "VISUAL_TESTING", "TIMESERIES_CHART" })
public void mashupLoadedTest() throws Exception {
ScreenCapture.captureScreenshot(webdriver.getWebDriver(),
getScreenshotDestination(1, "SingleDataSourceAndOtherVisualScenarios"));
}
@Requirements(reqs = { "TW-25352" })
@Test(description = "Verify zoom functionality for second chart", groups =
{ "VISUAL_TESTING", "TIMESERIES_CHART" }, enabled = false)
// This is a part of functional scenario test, however we are covering this
test under the visual scenarios, as it consists of taking a
// screenshot
// TODO: Due to the current Selenium version shortcomings, we're unable to
perform this scenario.
public void verifyZoomFunctionalityForSecondChartTest() throws Exception {
final int circleNumber3 = 3;
final int circleNumber10 = 10;
TWWebElement firstElement =
getPages().mashupRuntimePage().timeSeriesChartCircleMarker(TIMESERIES_CHART_16,
circleNumber3);
Point pointOne = firstElement.getLocation();
TWWebElement secondElement =
getPages().mashupRuntimePage().timeSeriesChartCircleMarker(TIMESERIES_CHART_16,
circleNumber10);
Point pointTwo = secondElement.getLocation();
@Requirements(reqs = { "TW-25352" })
@Test(description = "Verify allow selection of markers on charts", groups =
{ "VISUAL_TESTING", "TIMESERIES_CHART" })
// This is a part of functional scenario test, however we are covering this
test under the visual scenarios, as it consists of taking a
// screenshot
public void verifyAllowSelectionOfMarkersOnChartsTest() throws Exception {
final int circleNumber22 = 22;
final int circleNumber170 = 170;
getPages().mashupRuntimePage().timeSeriesChartCircleMarker(TIMESERIES_CHART_1,
circleNumber22).click();
ScreenCapture.captureScreenshot(webdriver.getWebDriver(),
getScreenshotDestination(1, "FirstAllowSelectionOfMarkersOnCharts"));
getPages().mashupRuntimePage().timeSeriesChartCircleMarker(TIMESERIES_CHART_16,
circleNumber170).click();
ScreenCapture.captureScreenshot(webdriver.getWebDriver(),
getScreenshotDestination(1, "SecondAllowSelectionOfMarkersOnCharts"));
}
@Requirements(reqs = { "TW-25352" })
@Test(description = "Verify enable hover of markers on charts", groups =
{ "VISUAL_TESTING", "TIMESERIES_CHART" })
// This is a part of functional scenario test, however we are covering this
test under the visual scenarios, as it consists of taking a
// screenshot
public void verifyEnableHoverOfMarkersOnChartsTest() throws Exception {
final int circleNumber22 = 22;
final int circleNumber170 = 170;
getPages().mashupRuntimePage().timeSeriesChartCircleMarker(TIMESERIES_CHART_1,
circleNumber22).click();
ScreenCapture.captureScreenshot(webdriver.getWebDriver(),
getScreenshotDestination(1, "FirstEnableHoverOfMarkersOnCharts"));
getPages().mashupRuntimePage().timeSeriesChartCircleMarker(TIMESERIES_CHART_16,
circleNumber170).mouseOver();
ScreenCapture.captureScreenshot(webdriver.getWebDriver(),
getScreenshotDestination(1, "SecondEnableHoverOfMarkersOnCharts"));
}
@AfterClass(alwaysRun = true)
public void afterClass() throws Exception {
// Delete entities created for test class
getThingworxRESTUtils()
.deleteEntitiesByModelTags("{\"tags\":
[{\"vocabulary\": \"NextGenGridTesting\", \"vocabularyTerm\": \"Weather\"}]}");
}
}