Skip to content

Commit 7684b32

Browse files
committed
timeout chagnes for cdf login page
1 parent f3880b3 commit 7684b32

8 files changed

Lines changed: 63 additions & 28 deletions

File tree

src/main/java/io/cdap/e2e/pages/actions/CdfSignInActions.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import io.cdap.e2e.utils.WaitHelper;
2323

2424
import java.io.IOException;
25-
25+
import java.time.Duration;
2626

2727

2828
/**
@@ -41,13 +41,17 @@ public static void login() throws IOException, InterruptedException {
4141
ElementHelper.clickOnElement(cdfSignInLocator.nextButton);
4242

4343
ElementHelper.clickIfDisplayed(cdfSignInLocator.selectTestAccount(ConstantsUtil.CDF_TEST_ACCOUNT_NAME),
44-
ConstantsUtil.SMALL_TIMEOUT_SECONDS, cdfSignInLocator.clickOnContinueButton());
44+
ConstantsUtil.CDF_LOGIN_TIMEOUT_SECONDS, cdfSignInLocator.clickOnContinueButton());
4545

46-
ElementHelper.clickIfDisplayed(cdfSignInLocator.clickOnContinueButton(), ConstantsUtil.SMALL_TIMEOUT_SECONDS,
47-
cdfSignInLocator.locatePluginNameInList(ConstantsUtil.FIRST_PLUGIN_IN_LIST, "Source"));
46+
ElementHelper.clickIfDisplayed(cdfSignInLocator.clickOnContinueButton());
47+
ElementHelper.clickIfDisplayed(cdfSignInLocator.clickOnAllowButton());
48+
Thread.sleep(20000);
4849

49-
ElementHelper.clickIfDisplayed(cdfSignInLocator.clickOnAllowButton(), ConstantsUtil.SMALL_TIMEOUT_SECONDS,
50-
cdfSignInLocator.locatePluginNameInList(ConstantsUtil.FIRST_PLUGIN_IN_LIST, "Source"));
50+
// ElementHelper.clickIfDisplayed(cdfSignInLocator.clickOnContinueButton(), ConstantsUtil.SMALL_TIMEOUT_SECONDS,
51+
// cdfSignInLocator.locatePluginNameInList(ConstantsUtil.FIRST_PLUGIN_IN_LIST, "Source"));
52+
//
53+
// ElementHelper.clickIfDisplayed(cdfSignInLocator.clickOnAllowButton(), ConstantsUtil.SMALL_TIMEOUT_SECONDS,
54+
// cdfSignInLocator.locatePluginNameInList(ConstantsUtil.FIRST_PLUGIN_IN_LIST, "Source"));
5155

5256
}
5357

src/main/java/io/cdap/e2e/pages/actions/CdfStudioActions.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import io.cdap.e2e.utils.SeleniumDriver;
2626
import io.cdap.e2e.utils.SeleniumHelper;
2727
import io.cdap.e2e.utils.WaitHelper;
28+
import io.cucumber.java8.Th;
2829
import org.openqa.selenium.By;
2930
import org.openqa.selenium.ElementClickInterceptedException;
3031
import org.openqa.selenium.TimeoutException;
@@ -33,6 +34,7 @@
3334
import org.slf4j.LoggerFactory;
3435

3536
import java.net.URISyntaxException;
37+
import java.time.Duration;
3638

3739
/**
3840
* Represents Cdf Studio Page Actions
@@ -178,8 +180,9 @@ public static void fillPipelineNameAndSave(String pipelineName) {
178180
pipelineName();
179181
pipelineNameIp(pipelineName);
180182
pipelineSave();
181-
WaitHelper.waitForElementToBeDisplayed(CdfStudioLocators.statusBanner);
182-
WaitHelper.waitForElementToBeHidden(CdfStudioLocators.statusBanner);
183+
WaitHelper.waitForElementToBeOptionallyDisplayed(CdfStudioLocators.statusBannerDisplay(),
184+
ConstantsUtil.SMALL_TIMEOUT_SECONDS);
185+
WaitHelper.waitForElementToBeHidden(CdfStudioLocators.statusBannerDisplay(), ConstantsUtil.SMALL_TIMEOUT_SECONDS);
183186
}
184187

185188
/**
@@ -217,7 +220,8 @@ public static void closePreviewMenu() {
217220
* @param runtimeArgumentKey macro argument
218221
* @param value actual value to enter
219222
*/
220-
public static void enterRuntimeArgumentValue(String runtimeArgumentKey, String value) {
223+
public static void enterRuntimeArgumentValue(String runtimeArgumentKey, String value) throws InterruptedException {
224+
Thread.sleep(3000);
221225
ElementHelper.sendKeys(CdfStudioLocators.runtimeArgsValue(runtimeArgumentKey), value);
222226
}
223227

@@ -286,16 +290,18 @@ public static void clickPreviewLogsButton() {
286290
*
287291
* @param status
288292
*/
289-
public static void verifyPipelinePreviewStatusInLogs(String status) {
290-
AssertionHelper.verifyElementDisplayed(CdfLogLocators.getPipelineStatusFromLogs(status));
293+
public static void verifyPipelinePreviewStatusInLogs(String status) throws InterruptedException {
294+
WaitHelper.waitForElementToBeDisplayed(CdfLogLocators.getPipelineStatusFromLogs(status));
295+
// AssertionHelper.verifyElementDisplayed(CdfLogLocators.getPipelineStatusFromLogs(status));
291296
}
292297

293298
/**
294299
* Click on the Deploy button
295300
*/
296301
public static void pipelineDeploy() {
297302
ElementHelper.clickOnElement(CdfStudioLocators.pipelineDeploy);
298-
WaitHelper.waitForElementToBeDisplayed(CdfStudioLocators.deployingPipelineMessage);
303+
WaitHelper.waitForElementToBeOptionallyDisplayed(CdfStudioLocators.locatorOfdeployingPipelineMessage(),
304+
ConstantsUtil.SMALL_TIMEOUT_SECONDS);
299305
WaitHelper.waitForElementToBeHidden(
300306
CdfStudioLocators.locatorOfdeployingPipelineMessage(), ConstantsUtil.PIPELINE_DEPLOY_TIMEOUT_SECONDS);
301307
}
@@ -529,10 +535,14 @@ public static void clickOnFixAllButtonIfDisplayed() {
529535
* Imports a pipeline from the specified file path.
530536
* @param filePath The path to the file containing the pipeline to be imported.
531537
**/
532-
public static void importPipeline(String filePath) throws URISyntaxException {
538+
public static void importPipeline(String filePath) throws URISyntaxException, InterruptedException {
533539
WaitHelper.waitForElementToBeDisplayed(CdfStudioLocators.importPipelineButton);
534540
FileImportUtil.uploadFile(CdfStudioLocators.importPipelineInputTag(), filePath);
535-
clickOnFixAllButtonIfDisplayed();
541+
542+
// clickOnFixAllButtonIfDisplayed();
543+
ElementHelper.clickOnElement(CdfStudioLocators.fixAllButtonWrangler);
544+
Thread.sleep(20000);
545+
WaitHelper.waitForPageToLoad();
536546
}
537547

538548
/**

src/main/java/io/cdap/e2e/pages/locators/CdfSignInLocator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public By clickOnContinueButton() {
5151
}
5252

5353
public static By locatePluginNameInList(String pluginName, String pluginGroupName) {
54-
return By.xpath("//div[@data-cy='plugin-" + pluginGroupName + "-group']" +
54+
return By.xpath("//div[@data-testid='plugin-" + pluginGroupName + "-group']" +
5555
"//div[contains(@class, 'PluginNameContainer')][normalize-space(text()) = '" + pluginName + "' " +
5656
"or translate(normalize-space(text()),' ','') = '" + pluginName + "']");
5757
}

src/main/java/io/cdap/e2e/pages/locators/CdfStudioLocators.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,12 @@ public static By locateDataPipelineTypeSelectedOption(String option) {
171171
}
172172

173173
public static WebElement locatePluginGroupExpanded(String pluginGroupName) {
174-
String xpath = "//div[@data-cy='plugin-" + pluginGroupName + "-group-summary' and @aria-expanded='true']";
174+
String xpath = "//div[@data-testid='plugin-" + pluginGroupName + "-group-summary' and @aria-expanded='true']";
175175
return SeleniumDriver.getDriver().findElement(By.xpath(xpath));
176176
}
177177

178178
public static By locatorOfPluginGroupCollapsed(String pluginGroupName) {
179-
String xpath = "//div[@data-cy='plugin-" + pluginGroupName + "-group-summary' and @aria-expanded='false']";
179+
String xpath = "//div[@data-testid='plugin-" + pluginGroupName + "-group-summary' and @aria-expanded='false']";
180180
return By.xpath(xpath);
181181
}
182182

@@ -185,19 +185,19 @@ public static WebElement locatePluginGroupCollapsed(String pluginGroupName) {
185185
}
186186

187187
public static WebElement locatePluginNameInList(String pluginName, String pluginGroupName) {
188-
String xpath = "//div[@data-cy='plugin-" + pluginGroupName + "-group']" +
188+
String xpath = "//div[@data-testid='plugin-" + pluginGroupName + "-group']" +
189189
"//div[contains(@class, 'PluginNameContainer')][normalize-space(text()) = '" + pluginName + "' " +
190190
"or translate(normalize-space(text()),' ','') = '" + pluginName + "']";
191191
return SeleniumDriver.getDriver().findElement(By.xpath(xpath));
192192
}
193193

194194
public static WebElement locateSinkPluginNameInList(String pluginName) {
195-
String xpath = "//*[@data-cy='plugin-" + pluginName + "-batchsink']";
195+
String xpath = "//*[@data-testid='plugin-" + pluginName + "-batchsink']";
196196
return SeleniumDriver.getDriver().findElement(By.xpath(xpath));
197197
}
198198

199199
public static WebElement locateRealtimeSourcePluginNameInList(String pluginName) {
200-
String xpath = "//*[@data-cy='plugin-" + pluginName + "-streamingsource']";
200+
String xpath = "//*[@data-testid='plugin-" + pluginName + "-streamingsource']";
201201
return SeleniumDriver.getDriver().findElement(By.xpath(xpath));
202202
}
203203

@@ -272,8 +272,15 @@ public static By locatorOfLoadingSpinnerOnValidateButton() {
272272
@FindBy(how = How.XPATH, using = "//*[@id='import-pipeline']")
273273
public static WebElement importPipelineButton;
274274

275+
@FindBy(how = How.XPATH, using = "//button[@data-testid='fix-all-btn']")
276+
public static WebElement fixAllButtonWrangler;
277+
275278
public static By fixAllButton() {
276-
return By.xpath("//button[@data-cy='fix-all-btn']");
279+
return By.xpath("//button[@data-testid='fix-all-btn']");
280+
}
281+
282+
public static By statusBannerDisplay() {
283+
return By.xpath("//*[@data-cy='valium-banner-hydrator']");
277284
}
278285

279286
public static WebElement importPipelineInputTag() {

src/main/java/io/cdap/e2e/utils/CdfHelper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@
3030
import org.openqa.selenium.By;
3131
import org.openqa.selenium.WebElement;
3232
import org.openqa.selenium.support.ui.ExpectedConditions;
33+
import org.openqa.selenium.support.ui.Wait;
3334
import org.openqa.selenium.support.ui.WebDriverWait;
3435
import stepsdesign.BeforeActions;
3536

3637
import java.io.IOException;
38+
import java.time.Duration;
3739
import java.util.HashMap;
3840
import java.util.Map;
3941
import java.util.UUID;

src/main/java/io/cdap/e2e/utils/ConstantsUtil.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,20 @@ public class ConstantsUtil {
8383
/**
8484
* DEFAULT_TIMEOUT_SECONDS: To be used in external wait helpers defined in {@link WaitHelper}
8585
*/
86-
public static final int DEFAULT_TIMEOUT_SECONDS = 180;
86+
public static final int DEFAULT_TIMEOUT_SECONDS = 300;
8787
/**
8888
* PAGE_LOAD_TIMEOUT_SECONDS: To be used as Selenium driver's default page load timeout
8989
*/
90-
public static final int PAGE_LOAD_TIMEOUT_SECONDS = 50;
90+
public static final int PAGE_LOAD_TIMEOUT_SECONDS = 300;
9191
/**
9292
* SMALL_TIMEOUT_SECONDS: To be used as a small static wait (only if needed)
9393
*/
94-
public static final int SMALL_TIMEOUT_SECONDS = 5;
94+
public static final int SMALL_TIMEOUT_SECONDS = 20;
95+
/**
96+
* CDFLOGIN_TIMEOUT_SECONDS: To be used as a small static wait (only if needed) for cdf login page
97+
*/
98+
public static final int CDF_LOGIN_TIMEOUT_SECONDS = 50;
99+
95100
/**
96101
* MEDIUM_TIMEOUT_SECONDS: To be used as a medium static wait (only if needed)
97102
*/

src/main/java/io/cdap/e2e/utils/WaitHelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ public static boolean waitForElementToBeOptionallyDisplayed(By locator, long tim
138138
} catch (StaleElementReferenceException e) {
139139
logger.info("Element is not interactable");
140140
return false;
141+
} catch (TimeoutException e) {
142+
logger.info("Element not found withing timeout");
143+
return false;
141144
}
142145
}
143146

src/main/java/stepsdesign/PipelineSteps.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
import io.cdap.e2e.utils.CdfHelper;
2525
import io.cdap.e2e.utils.ConstantsUtil;
2626
import io.cdap.e2e.utils.PluginPropertyUtils;
27+
import io.cdap.e2e.utils.SeleniumDriver;
2728
import io.cdap.e2e.utils.SeleniumHelper;
29+
import io.cdap.e2e.utils.WaitHelper;
2830
import io.cucumber.datatable.DataTable;
2931
import io.cucumber.java.en.Given;
3032
import io.cucumber.java.en.Then;
@@ -36,6 +38,7 @@
3638

3739
import java.io.IOException;
3840
import java.net.URISyntaxException;
41+
import java.time.Duration;
3942
import java.util.ArrayList;
4043
import java.util.HashMap;
4144
import java.util.List;
@@ -104,6 +107,7 @@ public void selectRealtimeSourcePlugin(String pluginName) {
104107

105108
@Then("Verify plugin: {string} node is displayed on the canvas with a timeout of {long} seconds")
106109
public void verifyPluginNodeIsDisplayedOnTheCanvas(String pluginName, long timeoutInSeconds) {
110+
SeleniumDriver.getDriver().manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
107111
CdfStudioActions.verifyPluginNodeIsDisplayedOnCanvas(pluginName, timeoutInSeconds);
108112
}
109113

@@ -275,13 +279,13 @@ public void previewAndRunThePipeline() {
275279
}
276280

277281
@Then("Enter runtime argument value {string} for key {string}")
278-
public void enterRuntimeArgumentValueForKey(String value, String runtimeArgumentKey) {
282+
public void enterRuntimeArgumentValueForKey(String value, String runtimeArgumentKey) throws InterruptedException {
279283
CdfStudioActions.enterRuntimeArgumentValue(runtimeArgumentKey, PluginPropertyUtils.pluginProp(value));
280284
}
281285

282286
@Then("Enter runtime argument value from environment variable {string} for key {string}")
283287
public void enterRuntimeArgumentValueFromEnvironmentVariableForKey(String envVariableKey,
284-
String runtimeArgumentKey) {
288+
String runtimeArgumentKey) throws InterruptedException {
285289
CdfStudioActions.enterRuntimeArgumentValue(runtimeArgumentKey,
286290
System.getenv(PluginPropertyUtils.pluginProp(envVariableKey)));
287291
}
@@ -317,7 +321,7 @@ public void openAndCapturePipelinePreviewLogs() {
317321
}
318322

319323
@Then("Verify the preview run status of pipeline in the logs is {string}")
320-
public void verifyThePreviewRunStatusOfOfPipelineInTheLogsIs(String previewStatus) {
324+
public void verifyThePreviewRunStatusOfOfPipelineInTheLogsIs(String previewStatus) throws InterruptedException {
321325
CdfStudioActions.verifyPipelinePreviewStatusInLogs(previewStatus);
322326
}
323327

@@ -733,7 +737,7 @@ public void clickOnPlusGreenButton () {
733737
}
734738

735739
@Then("Select the file for importing the pipeline for the plugin {string}")
736-
public void selectFileForImport(String path) throws URISyntaxException {
740+
public void selectFileForImport(String path) throws URISyntaxException, InterruptedException {
737741
CdfStudioActions.importPipeline(PluginPropertyUtils.pluginProp(path));
738742
}
739743

0 commit comments

Comments
 (0)