Beruflich Dokumente
Kultur Dokumente
containedmashup;
import java.io.UnsupportedEncodingException;
import org.testng.Assert;
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.ThingworxRESTUtils;
/**
* This class covers the functional test aspect of the Contained mashup widget.
Scenarios include: 1> Adding gadget to dashboard test 2>
* Refresh service verification test
*
* Support Story TW-23085.
*
* @author rraj
*
*/
@BeforeClass(alwaysRun = true)
public void beforeClass() throws Exception {
// Import entities
getThingworxRESTUtils().importXmlEntities(TEST_ENTITIES_FILE_NAME, true,
ThingworxRESTUtils.HTTP_OK);
navigateToMashupInRuntime(AUTOMATION_CONTAINED_MASHUP);
}
@BeforeMethod(alwaysRun = true)
public void beforeMethod() throws UnsupportedEncodingException {
getWebdriver().navigate().refresh();
// ensuring the DOM gets settled here
getPages().mashupRuntimePage().waitForFocusOfWidget(ADD_GADGET_TO_DASHBOARD_TEST_BU
TTON_WIDGET);
}
@Requirements(reqs = { "TW-25364" })
@Test(
description = "Verify add gadget to dashboard & verify title, source &
reflected textbox values",
groups = { "FUNCTIONAL_TESTING", "CONTAINED_MASHUP" })
public void verifyAddGadgetsToDashboardTest() throws Exception {
getPages().mashupRuntimePage().buttonWidget(ADD_GADGET_TO_DASHBOARD_TEST_BUTTON_WID
GET).click();
// refreshing the page, so that the newly added widget is reflected on the
UI.
getWebdriver().navigate().refresh();
getPages().mashupRuntimePage().waitForFocusOfWidget(ADD_GADGET_TO_DASHBOARD_TEST_BU
TTON_WIDGET);
getPages().mashupRuntimePage().containedMashupDashboardWidget(parentWidgetID,
widgetSequence).getAttribute("ref-title");
// this is the source text box value displayed on the template left panel.
final String sourceTextboxActualTextDescription =
getPages().mashupRuntimePage().textboxWidget(TEMPLATE_MASHUP_CONTAINER
+ "_" + SOURCE_TEXTBOX_GADGET).getAttribute("value");
// this is the reflected text box value displayed on the template left
panel
final String reflectedTextboxActualTextDescription =
getPages().mashupRuntimePage().textboxWidget(TEMPLATE_MASHUP_CONTAINER
+ "_" + REFLECTED_TEXTBOX_GADGET).getAttribute("value");
@Requirements(reqs = { "TW-25364" })
@Test(
description = "Verify refresh service to check that the Textbox Widget
inside the Contained Mashup Widget " +
"contains 'Refresh Service Test Description' on clicking
the 'Refresh Test' button",
groups = { "FUNCTIONAL_TESTING", "CONTAINED_MASHUP" })
public void verifyRefreshServiceTest() throws Exception {
getPages().mashupRuntimePage().buttonWidget(REFRESH_TEST_BUTTON_WIDGET).click();
getPages().mashupRuntimePage().textboxWidget(refreshTestTextBoxGadget).waitForEleme
ntAttributeValueToBeEqualTo("value",
refrestTestExpectedTextDescription);
// this is the refresh test text box value displayed on the template left
panel after executing the Refresh Service.
final String refresTestActualTextDescription =
getPages().mashupRuntimePage().textboxWidget(refreshTestTextBoxGadget).getAttribute
("value");
Assert.assertEquals(refresTestActualTextDescription,
refrestTestExpectedTextDescription,
"The refresh service is not working properly as the text in refresh
test textbox is not correct");
}
@AfterClass(alwaysRun = true)
public void afterClass() throws Exception {
// Delete entities created for test class
getThingworxRESTUtils().deleteEntitiesByApplicationModelTag(ENTITY_APPLICATION_MODE
L_TAG_NAME);
}
}