Skip to content

Commit

Permalink
Merge pull request #95 from Alfresco/model-manager-fix
Browse files Browse the repository at this point in the history
add fix for failing tests activateModel and deactivateModel()
  • Loading branch information
bogdanbocancea authored Mar 25, 2021
2 parents eed830a + cfc619d commit bc0d0ea
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,20 +438,20 @@ protected WebElement waitUntilElementIsPresent(By locator)
}
}

protected WebElement waitUntilChildElementIsPresent(By parentLocator, By childLocator)
protected WebElement waitUntilChildElementIsPresent(By parentLocator, By childLocator, long secondsToWait)
{
try
{
return setWaitingTime(getDefaultProperties().getExplicitWait(), getDefaultProperties().getPollingTimeInMillis())
.until(ExpectedConditions.presenceOfNestedElementLocatedBy(parentLocator, childLocator));
return setWaitingTime(secondsToWait, getDefaultProperties().getPollingTimeInMillis())
.until(ExpectedConditions.presenceOfNestedElementLocatedBy(parentLocator, childLocator));
}
catch (NoSuchElementException | StaleElementReferenceException | ElementNotInteractableException | TimeoutException exception)
{
try
{
log.warn("Unable to find parent locator {} with child {}", parentLocator, childLocator);
return setWaitingTime(getDefaultProperties().getExplicitWait(), getDefaultProperties().getPollingTimeInMillis())
.until(ExpectedConditions.presenceOfNestedElementLocatedBy(parentLocator, childLocator));
return setWaitingTime(secondsToWait, getDefaultProperties().getPollingTimeInMillis())
.until(ExpectedConditions.presenceOfNestedElementLocatedBy(parentLocator, childLocator));
}
catch (ElementNotVisibleException elementNotVisibleException)
{
Expand All @@ -462,18 +462,24 @@ protected WebElement waitUntilChildElementIsPresent(By parentLocator, By childLo
}
}

protected WebElement waitUntilChildElementIsPresent(WebElement parentLocator, By childLocator) {
protected WebElement waitUntilChildElementIsPresent(By parentLocator, By childLocator)
{
return waitUntilChildElementIsPresent(parentLocator, childLocator, getDefaultProperties().getExplicitWait());
}

protected WebElement waitUntilChildElementIsPresent(WebElement parentLocator, By childLocator, long waitInSeconds)
{
try
{
return setWaitingTime(getDefaultProperties().getExplicitWait(), getDefaultProperties().getPollingTimeInMillis())
.until(ExpectedConditions.presenceOfNestedElementLocatedBy(parentLocator, childLocator));
return setWaitingTime(waitInSeconds, getDefaultProperties().getPollingTimeInMillis())
.until(ExpectedConditions.presenceOfNestedElementLocatedBy(parentLocator, childLocator));
}
catch (NoSuchElementException | StaleElementReferenceException | ElementNotInteractableException | TimeoutException exception)
{
try
{
log.warn("Unable to find parent locator {} with child {}", parentLocator, childLocator);
return setWaitingTime(getDefaultProperties().getExplicitWait(), getDefaultProperties().getPollingTimeInMillis())
return setWaitingTime(waitInSeconds, getDefaultProperties().getPollingTimeInMillis())
.until(ExpectedConditions.presenceOfNestedElementLocatedBy(parentLocator, childLocator));
}
catch (NoSuchElementException noSuchElementException)
Expand All @@ -485,6 +491,11 @@ protected WebElement waitUntilChildElementIsPresent(WebElement parentLocator, By
}
}

protected WebElement waitUntilChildElementIsPresent(WebElement parentLocator, By childLocator)
{
return waitUntilChildElementIsPresent(parentLocator, childLocator, getDefaultProperties().getExplicitWait());
}

protected List<WebElement> waitUntilElementsAreVisible(By locator)
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
import static org.alfresco.common.Wait.WAIT_1;

import org.alfresco.po.share.BaseDialogComponent;
import org.alfresco.po.share.user.admin.adminTools.modelManager.ModelManagerPage;
Expand Down Expand Up @@ -63,6 +64,8 @@ public ModelManagerPage clickImportButton()
waitUntilElementDisappears(importModelWindow);
ModelManagerPage modelManagerPage = new ModelManagerPage(webDriver);
modelManagerPage.waitForContentModelTableToBeLoaded();
waitInSeconds(WAIT_1.getValue());

return modelManagerPage;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.alfresco.po.share.user.admin.adminTools.modelManager;

import static org.alfresco.common.RetryTime.RETRY_TIME_15;
import static org.alfresco.common.Wait.WAIT_1;
import static org.alfresco.common.Wait.WAIT_2;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
Expand All @@ -12,10 +14,7 @@
import org.alfresco.rest.model.RestCustomTypeModel;
import org.alfresco.utility.model.CustomAspectModel;
import org.alfresco.utility.model.CustomContentModel;
import org.openqa.selenium.By;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.*;

/**
* @author Bogdan Bocancea
Expand Down Expand Up @@ -168,13 +167,14 @@ private void waitForContentModelStatus(By modelStatus)
{
try
{
waitUntilChildElementIsPresent(getModelRow(), modelStatus);
waitForContentModelTableToBeLoaded();
waitUntilChildElementIsPresent(getModelRow(), modelStatus, WAIT_1.getValue());
retryCounter++;
break;
}
catch (StaleElementReferenceException e)
catch (StaleElementReferenceException | TimeoutException e)
{
log.error("Wait for custom model status to change");
retryCounter++;
}
}
}
Expand Down

0 comments on commit bc0d0ea

Please sign in to comment.