@Test(groups = "Enterprise4.2", dependsOnMethods = "selectStartWorkflowButton") public void getWorkFlowDetails() { List<WorkFlowDetails> workFlowDetailsList = myWorkFlowsPage.getWorkFlowDetails(workFlow1); assertEquals(workFlowDetailsList.size(), 1, "Verifying there is only one workflow that matches the workflow name"); assertEquals(workFlowDetailsList.get(0).getWorkFlowName(), workFlow1); assertEquals(workFlowDetailsList.get(0).getDue(), DateTimeFormat.forPattern("dd/MM/yyyy").parseDateTime(dueDate)); assertEquals(workFlowDetailsList.get(0).getStartDate().toLocalDate(), new DateTime().toLocalDate()); assertNull(workFlowDetailsList.get(0).getEndDate()); assertEquals(workFlowDetailsList.get(0).getType(), NEW_WORKFLOW); assertEquals(workFlowDetailsList.get(0).getDescription(), WorkFlowDescription.ASSIGN_NEW_TASK_TO_YOUR_SELF_OR_COLLEAGUE); }
public List<WorkFlowDetails> getWorkFlowDetails(String workFlowName) { if (StringUtils.isEmpty(workFlowName)) { throw new IllegalArgumentException("Workflow Name cannot be null"); } try { List<WebElement> workFlowRow = findWorkFlowRow(workFlowName); if (workFlowRow.size() > 0) { List<WorkFlowDetails> workFlowDetailsList = new ArrayList<WorkFlowDetails>(); for (WebElement workflow : workFlowRow) { drone.mouseOverOnElement(workflow); waitUntilAlert(); WorkFlowDetails workFlowDetails = new WorkFlowDetails(); workFlowDetails.setWorkFlowName(workflow.findElement(By.cssSelector("div.yui-dt-liner>h3>a")).getText()); workFlowDetails.setDue(workflow.findElement(By.cssSelector("div.due>span")).getText()); workFlowDetails.setStartDate(workflow.findElement(By.cssSelector("div[class^='started']>span")).getText()); workFlowDetails.setType(workflow.findElement(By.cssSelector("div.type>span")).getText()); workFlowDetails.setDescription(workflow.findElement(By.cssSelector("div.description>span")).getText()); workFlowDetails.setPriority(workflow.findElement(By.cssSelector("img")).getAttribute("title")); workFlowDetails.setViewHistoryDisplayed(workflow.findElement(By.cssSelector("div[class$='view-link'] a")).isDisplayed()); try { workFlowDetails.setCancelWorkFlowDisplayed(workflow.findElement(By.cssSelector("div[class$='cancel-link'] a")).isDisplayed()); } catch (NoSuchElementException e) { if (logger.isDebugEnabled()) { logger.debug("Cancel workflow button don't displayed.", e); } } try { workFlowDetails.setDeleteWorkFlowDisplayed(workflow.findElement(By.cssSelector("div[class$='delete-link'] a")).isDisplayed()); } catch (NoSuchElementException e) { if (logger.isDebugEnabled()) { logger.debug("Delete workflow button don't displayed.", e); } } try { if (workflow.findElement(By.cssSelector("div[class^='started']>span")).isDisplayed()) { workFlowDetails.setEndDate(workflow.findElement(By.cssSelector("div[class^='ended']>span")).getText()); } } catch (NoSuchElementException nse) { if (logger.isDebugEnabled()) { logger.debug("End date don't displayed.", nse); } } workFlowDetailsList.add(workFlowDetails); } return workFlowDetailsList; } } catch (StaleElementReferenceException e) { return getWorkFlowDetails(workFlowName); } return Collections.emptyList(); }
MyWorkFlowsPage extends SharePage { public List<WorkFlowDetails> getWorkFlowDetails(String workFlowName) { if (StringUtils.isEmpty(workFlowName)) { throw new IllegalArgumentException("Workflow Name cannot be null"); } try { List<WebElement> workFlowRow = findWorkFlowRow(workFlowName); if (workFlowRow.size() > 0) { List<WorkFlowDetails> workFlowDetailsList = new ArrayList<WorkFlowDetails>(); for (WebElement workflow : workFlowRow) { drone.mouseOverOnElement(workflow); waitUntilAlert(); WorkFlowDetails workFlowDetails = new WorkFlowDetails(); workFlowDetails.setWorkFlowName(workflow.findElement(By.cssSelector("div.yui-dt-liner>h3>a")).getText()); workFlowDetails.setDue(workflow.findElement(By.cssSelector("div.due>span")).getText()); workFlowDetails.setStartDate(workflow.findElement(By.cssSelector("div[class^='started']>span")).getText()); workFlowDetails.setType(workflow.findElement(By.cssSelector("div.type>span")).getText()); workFlowDetails.setDescription(workflow.findElement(By.cssSelector("div.description>span")).getText()); workFlowDetails.setPriority(workflow.findElement(By.cssSelector("img")).getAttribute("title")); workFlowDetails.setViewHistoryDisplayed(workflow.findElement(By.cssSelector("div[class$='view-link'] a")).isDisplayed()); try { workFlowDetails.setCancelWorkFlowDisplayed(workflow.findElement(By.cssSelector("div[class$='cancel-link'] a")).isDisplayed()); } catch (NoSuchElementException e) { if (logger.isDebugEnabled()) { logger.debug("Cancel workflow button don't displayed.", e); } } try { workFlowDetails.setDeleteWorkFlowDisplayed(workflow.findElement(By.cssSelector("div[class$='delete-link'] a")).isDisplayed()); } catch (NoSuchElementException e) { if (logger.isDebugEnabled()) { logger.debug("Delete workflow button don't displayed.", e); } } try { if (workflow.findElement(By.cssSelector("div[class^='started']>span")).isDisplayed()) { workFlowDetails.setEndDate(workflow.findElement(By.cssSelector("div[class^='ended']>span")).getText()); } } catch (NoSuchElementException nse) { if (logger.isDebugEnabled()) { logger.debug("End date don't displayed.", nse); } } workFlowDetailsList.add(workFlowDetails); } return workFlowDetailsList; } } catch (StaleElementReferenceException e) { return getWorkFlowDetails(workFlowName); } return Collections.emptyList(); } }
MyWorkFlowsPage extends SharePage { public List<WorkFlowDetails> getWorkFlowDetails(String workFlowName) { if (StringUtils.isEmpty(workFlowName)) { throw new IllegalArgumentException("Workflow Name cannot be null"); } try { List<WebElement> workFlowRow = findWorkFlowRow(workFlowName); if (workFlowRow.size() > 0) { List<WorkFlowDetails> workFlowDetailsList = new ArrayList<WorkFlowDetails>(); for (WebElement workflow : workFlowRow) { drone.mouseOverOnElement(workflow); waitUntilAlert(); WorkFlowDetails workFlowDetails = new WorkFlowDetails(); workFlowDetails.setWorkFlowName(workflow.findElement(By.cssSelector("div.yui-dt-liner>h3>a")).getText()); workFlowDetails.setDue(workflow.findElement(By.cssSelector("div.due>span")).getText()); workFlowDetails.setStartDate(workflow.findElement(By.cssSelector("div[class^='started']>span")).getText()); workFlowDetails.setType(workflow.findElement(By.cssSelector("div.type>span")).getText()); workFlowDetails.setDescription(workflow.findElement(By.cssSelector("div.description>span")).getText()); workFlowDetails.setPriority(workflow.findElement(By.cssSelector("img")).getAttribute("title")); workFlowDetails.setViewHistoryDisplayed(workflow.findElement(By.cssSelector("div[class$='view-link'] a")).isDisplayed()); try { workFlowDetails.setCancelWorkFlowDisplayed(workflow.findElement(By.cssSelector("div[class$='cancel-link'] a")).isDisplayed()); } catch (NoSuchElementException e) { if (logger.isDebugEnabled()) { logger.debug("Cancel workflow button don't displayed.", e); } } try { workFlowDetails.setDeleteWorkFlowDisplayed(workflow.findElement(By.cssSelector("div[class$='delete-link'] a")).isDisplayed()); } catch (NoSuchElementException e) { if (logger.isDebugEnabled()) { logger.debug("Delete workflow button don't displayed.", e); } } try { if (workflow.findElement(By.cssSelector("div[class^='started']>span")).isDisplayed()) { workFlowDetails.setEndDate(workflow.findElement(By.cssSelector("div[class^='ended']>span")).getText()); } } catch (NoSuchElementException nse) { if (logger.isDebugEnabled()) { logger.debug("End date don't displayed.", nse); } } workFlowDetailsList.add(workFlowDetails); } return workFlowDetailsList; } } catch (StaleElementReferenceException e) { return getWorkFlowDetails(workFlowName); } return Collections.emptyList(); } MyWorkFlowsPage(WebDrone drone); }
MyWorkFlowsPage extends SharePage { public List<WorkFlowDetails> getWorkFlowDetails(String workFlowName) { if (StringUtils.isEmpty(workFlowName)) { throw new IllegalArgumentException("Workflow Name cannot be null"); } try { List<WebElement> workFlowRow = findWorkFlowRow(workFlowName); if (workFlowRow.size() > 0) { List<WorkFlowDetails> workFlowDetailsList = new ArrayList<WorkFlowDetails>(); for (WebElement workflow : workFlowRow) { drone.mouseOverOnElement(workflow); waitUntilAlert(); WorkFlowDetails workFlowDetails = new WorkFlowDetails(); workFlowDetails.setWorkFlowName(workflow.findElement(By.cssSelector("div.yui-dt-liner>h3>a")).getText()); workFlowDetails.setDue(workflow.findElement(By.cssSelector("div.due>span")).getText()); workFlowDetails.setStartDate(workflow.findElement(By.cssSelector("div[class^='started']>span")).getText()); workFlowDetails.setType(workflow.findElement(By.cssSelector("div.type>span")).getText()); workFlowDetails.setDescription(workflow.findElement(By.cssSelector("div.description>span")).getText()); workFlowDetails.setPriority(workflow.findElement(By.cssSelector("img")).getAttribute("title")); workFlowDetails.setViewHistoryDisplayed(workflow.findElement(By.cssSelector("div[class$='view-link'] a")).isDisplayed()); try { workFlowDetails.setCancelWorkFlowDisplayed(workflow.findElement(By.cssSelector("div[class$='cancel-link'] a")).isDisplayed()); } catch (NoSuchElementException e) { if (logger.isDebugEnabled()) { logger.debug("Cancel workflow button don't displayed.", e); } } try { workFlowDetails.setDeleteWorkFlowDisplayed(workflow.findElement(By.cssSelector("div[class$='delete-link'] a")).isDisplayed()); } catch (NoSuchElementException e) { if (logger.isDebugEnabled()) { logger.debug("Delete workflow button don't displayed.", e); } } try { if (workflow.findElement(By.cssSelector("div[class^='started']>span")).isDisplayed()) { workFlowDetails.setEndDate(workflow.findElement(By.cssSelector("div[class^='ended']>span")).getText()); } } catch (NoSuchElementException nse) { if (logger.isDebugEnabled()) { logger.debug("End date don't displayed.", nse); } } workFlowDetailsList.add(workFlowDetails); } return workFlowDetailsList; } } catch (StaleElementReferenceException e) { return getWorkFlowDetails(workFlowName); } return Collections.emptyList(); } MyWorkFlowsPage(WebDrone drone); @SuppressWarnings("unchecked") @Override MyWorkFlowsPage render(RenderTime timer); @SuppressWarnings("unchecked") @Override MyWorkFlowsPage render(); @SuppressWarnings("unchecked") @Override MyWorkFlowsPage render(final long time); HtmlPage selectStartWorkflowButton(); List<WorkFlowDetails> getWorkFlowDetails(String workFlowName); HtmlPage selectWorkFlow(String workFlowName); boolean isWorkFlowPresent(String workFlowName); String getSubTitle(); HtmlPage selectActiveWorkFlows(); HtmlPage selectCompletedWorkFlows(); HtmlPage cancelWorkFlow(String workFlowName); void deleteWorkFlow(String workFlowName); int getDisplayedWorkFlowCount(); WorkFlowFilters getWorkFlowsFilter(); }
MyWorkFlowsPage extends SharePage { public List<WorkFlowDetails> getWorkFlowDetails(String workFlowName) { if (StringUtils.isEmpty(workFlowName)) { throw new IllegalArgumentException("Workflow Name cannot be null"); } try { List<WebElement> workFlowRow = findWorkFlowRow(workFlowName); if (workFlowRow.size() > 0) { List<WorkFlowDetails> workFlowDetailsList = new ArrayList<WorkFlowDetails>(); for (WebElement workflow : workFlowRow) { drone.mouseOverOnElement(workflow); waitUntilAlert(); WorkFlowDetails workFlowDetails = new WorkFlowDetails(); workFlowDetails.setWorkFlowName(workflow.findElement(By.cssSelector("div.yui-dt-liner>h3>a")).getText()); workFlowDetails.setDue(workflow.findElement(By.cssSelector("div.due>span")).getText()); workFlowDetails.setStartDate(workflow.findElement(By.cssSelector("div[class^='started']>span")).getText()); workFlowDetails.setType(workflow.findElement(By.cssSelector("div.type>span")).getText()); workFlowDetails.setDescription(workflow.findElement(By.cssSelector("div.description>span")).getText()); workFlowDetails.setPriority(workflow.findElement(By.cssSelector("img")).getAttribute("title")); workFlowDetails.setViewHistoryDisplayed(workflow.findElement(By.cssSelector("div[class$='view-link'] a")).isDisplayed()); try { workFlowDetails.setCancelWorkFlowDisplayed(workflow.findElement(By.cssSelector("div[class$='cancel-link'] a")).isDisplayed()); } catch (NoSuchElementException e) { if (logger.isDebugEnabled()) { logger.debug("Cancel workflow button don't displayed.", e); } } try { workFlowDetails.setDeleteWorkFlowDisplayed(workflow.findElement(By.cssSelector("div[class$='delete-link'] a")).isDisplayed()); } catch (NoSuchElementException e) { if (logger.isDebugEnabled()) { logger.debug("Delete workflow button don't displayed.", e); } } try { if (workflow.findElement(By.cssSelector("div[class^='started']>span")).isDisplayed()) { workFlowDetails.setEndDate(workflow.findElement(By.cssSelector("div[class^='ended']>span")).getText()); } } catch (NoSuchElementException nse) { if (logger.isDebugEnabled()) { logger.debug("End date don't displayed.", nse); } } workFlowDetailsList.add(workFlowDetails); } return workFlowDetailsList; } } catch (StaleElementReferenceException e) { return getWorkFlowDetails(workFlowName); } return Collections.emptyList(); } MyWorkFlowsPage(WebDrone drone); @SuppressWarnings("unchecked") @Override MyWorkFlowsPage render(RenderTime timer); @SuppressWarnings("unchecked") @Override MyWorkFlowsPage render(); @SuppressWarnings("unchecked") @Override MyWorkFlowsPage render(final long time); HtmlPage selectStartWorkflowButton(); List<WorkFlowDetails> getWorkFlowDetails(String workFlowName); HtmlPage selectWorkFlow(String workFlowName); boolean isWorkFlowPresent(String workFlowName); String getSubTitle(); HtmlPage selectActiveWorkFlows(); HtmlPage selectCompletedWorkFlows(); HtmlPage cancelWorkFlow(String workFlowName); void deleteWorkFlow(String workFlowName); int getDisplayedWorkFlowCount(); WorkFlowFilters getWorkFlowsFilter();  }