Sie sind auf Seite 1von 3

package com.twx.ux.composer.classic.mashup.widgets.charts.

bubblechart;

import java.io.UnsupportedEncodingException;

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.requirements.Requirements;
import com.twx.common.utilities.ScreenCapture;
import com.twx.common.utilities.ThingworxRESTUtils;

/***
* This is the visual test for Bubble Chart Widget. It consists of 9 main scenarios
as follows: 1)Visibility of X/Y-axis, 2)Regular tick
* marks on X/Y-axis, 3)Minor tick marks on X/Y-axis, 4)X/YAxisAutoscale
5)X/YAxisZeroScales enabled, 6)Intervals on X/Y-axis,
* 7)YAxisStyle,BubbleStyle 8)Visibility/Invisibility of the Bubble Chart Widget,
9)Visibility/Invisibility of the X/YAxisLabels.
*
* Story ID : TW-23116
*
* Bug ID : TW-26951
*
* @author snkulkarni
*
*/
public class VisualBubbleChartTests extends BaseTest {

public static final String TEST_SPECIFIC_ENTITY =


"Widgets_BubbleChart_Entities.xml";

public static final String TEST_MASHUP_NAME =


"Widgets_BubbleChart_VisualTests";

public static final String WIDGET_BUBBLE_CHART_MODEL_TAG =


"Widget_BubbleChart";

public static final String BUBBLE_CHART_WIDGET_ID = "bubblechart-10";

public static final String BUBBLE_CHART_CHECKBOX_WIDGET_ID = "checkbox-12";

@BeforeClass(alwaysRun = true)
public void beforeClass() throws Exception {
getThingworxRESTUtils().importXmlEntities(TEST_SPECIFIC_ENTITY, true,
ThingworxRESTUtils.HTTP_OK);
navigateToMashupInRuntime(TEST_MASHUP_NAME);

try {
// Wait for the Bubble Chart's checkBox widget named 'Visible' to gain
focus automatically.

getPages().mashupRuntimePage().waitForFocusOfWidget(BUBBLE_CHART_CHECKBOX_WIDGET_ID
);
} catch (Exception e) {
// Safeguard in case the timeout above fails. Just click twice on the
checkBox to get the focus explicitly.

getPages().mashupRuntimePage().checkBoxWidget(BUBBLE_CHART_CHECKBOX_WIDGET_ID).clic
k();

getPages().mashupRuntimePage().checkBoxWidget(BUBBLE_CHART_CHECKBOX_WIDGET_ID).clic
k();
}

// TODO : Bug ID : TW-26951 : All the grid axis lines will appear after
this bug's fix.
// This 'asIs test' covers following scenarios:6.Visibility of X/Y-axis,
7.Regular tick marks on X/Y-axis,
// 8.Minor tick marks on X/Y-axis, 9.X/YAxisAutoscale, X/YAxisLabels and
YAxisZeroScales enabled , 10.Intervals on X/Y-axis,
// 11.YAxisStyle,BubbleStyle, 12.Invisibility of the BubbleChart.
ScreenCapture.captureScreenshot(webdriver.getWebDriver(),
getScreenshotDestination(1, "BubbleChartWidgetAsIs"));
}

@AfterClass(alwaysRun = true)
public void afterClass() throws Exception {

getThingworxRESTUtils().deleteEntitiesByApplicationModelTag(WIDGET_BUBBLE_CHART_MOD
EL_TAG);
}

@BeforeMethod(alwaysRun = true)
public void beforeMethod() throws UnsupportedEncodingException {
getWebdriver().navigate().refresh();
try {
// Wait for the Bubble Chart's checkBox widget named 'Visible' to gain
focus automatically.

getPages().mashupRuntimePage().waitForFocusOfWidget(BUBBLE_CHART_CHECKBOX_WIDGET_ID
);
} catch (Exception e) {
// Safeguard in case the timeout above fails. Just click twice on the
checkBox to get the focus explicitly.

getPages().mashupRuntimePage().checkBoxWidget(BUBBLE_CHART_CHECKBOX_WIDGET_ID).clic
k();

getPages().mashupRuntimePage().checkBoxWidget(BUBBLE_CHART_CHECKBOX_WIDGET_ID).clic
k();
}
}

@Requirements(reqs = { "TW-23116" })
@Test(description = "This test covers invisibility of the Bubble Chart
Widget.", groups = { "VISUAL_TESTING", "BUBBLE_CHART" })
public void bubbleChartVisibilityTest() throws Exception {

// Click on checkBox Widget with label 'Visible' to select it.

getPages().mashupRuntimePage().checkBoxWidget(BUBBLE_CHART_CHECKBOX_WIDGET_ID).clic
k();

// Wait till the Bubble Chart Widget appears.


getPages().mashupRuntimePage().bubbleChartWidget(BUBBLE_CHART_WIDGET_ID).waitForVis
ibilityOfElement();

// Take a screenshot of the invisible Bubble Chart Widget.


ScreenCapture.captureScreenshot(webdriver.getWebDriver(),
getScreenshotDestination(1, "Visible"));
}
}

Das könnte Ihnen auch gefallen