public void PerformanceTabTest() { Reporter.log("In to PerformanceTabTest"); logger.info("Switching to Performance Tab"); PerformanceTab.click(); logger.info("Fetching Performance Cycle duration"); logger.info(PerformanceCycle.getText()); logger.info("Fetching Performance Details"); List<WebElement> EmployeePerformanceDetails = driver.findElements(By.xpath(Constants.Employeedetaillistxpath)); for (int i = 0; i < EmployeePerformanceDetails.size(); i++) { logger.info(EmployeePerformanceDetails.get(i).getText()); System.out.println( "Employee Performance Details " + EmployeePerformanceDetails.get(i).getText()); } logger.info("Navigating user to Performance Review section"); s_assert.assertNotNull( EmployeePerformanceDetails.get(0).findElement(By.tagName("a")), "First employee not found"); EmployeePerformanceDetails.get(0).findElement(By.tagName("a")).click(); logger.info("Displaying Review Information"); logger.info(Section1.getText()); logger.info(Userinfo.getText()); logger.info(Section2.getText()); logger.info("Switching to Self Review Tab"); Selfreviewsection.click(); List<WebElement> THeader = driver.findElements(By.xpath(Constants.TableHeaderxpath)); for (int j = 0; j < THeader.size(); j++) { logger.info(THeader.get(j).getText()); System.out.println("Printing table header " + THeader.get(j).getText()); } List<WebElement> Ratings = driver.findElements(By.xpath(Constants.ActualTablexpath)); int count = Ratings.size(); for (int k = 0; k < Ratings.size(); k++) { logger.info(Ratings.get(k).getText()); System.out.println("Printing real ratings " + Ratings.get(k).getText()); } if (count == 0) { s_assert.fail("User does not have any ratings"); } s_assert.assertAll(); }
/** * Test list feed instances using custom filter. Expecting list of feed instances which satisfy * custom filters. */ @Test public void testFeedCustomFilter() throws URISyntaxException, IOException, AuthenticationException, InterruptedException { String params = "start=" + startTime + "&filterBy=status:RUNNING"; InstancesResult r = prism.getFeedHelper().listInstances(feedName, params, null); InstanceUtil.validateResponse(r, 1, 1, 0, 0, 0); params = "start=" + startTime + "&end=" + endTime + "&filterBy=status:RUNNING&offset=2"; r = prism.getFeedHelper().listInstances(feedName, params, null); InstanceUtil.validateSuccessWOInstances(r); params = "start=" + startTime + "&end=" + endTime + "&filterBy=status:WAITING"; r = prism.getFeedHelper().listInstances(feedName, params, null); InstanceUtil.validateResponse(r, 4, 0, 0, 4, 0); params = "start=" + startTime + "&end=" + TimeUtil.addMinsToTime(startTime, 41) + "&filterBy=status:WAITING"; r = prism.getFeedHelper().listInstances(feedName, params, null); InstanceUtil.validateResponse(r, 3, 0, 0, 3, 0); params = "start=" + startTime + "&offset=1&numResults=1&filterBy=status:WAITING"; r = prism.getFeedHelper().listInstances(feedName, params, null); InstanceUtil.validateResponse(r, 1, 0, 0, 1, 0); params = "start=" + TimeUtil.addMinsToTime(startTime, 16) + "&offset=2&numResults=12"; r = prism.getFeedHelper().listInstances(feedName, params, null); InstanceUtil.validateResponse(r, 6, 0, 1, 3, 2); String sourceCluster = bundles[0].getClusterNames().get(0); String clusterName = bundles[1].getClusterNames().get(0); params = "start=" + startTime + "&filterBy=STATUS:KILLED,CLUSTER:" + clusterName + "&numResults=5&orderBy=startTime&sortOrder=desc"; r = prism.getFeedHelper().listInstances(feedName, params, null); InstanceUtil.validateResponse(r, 5, 0, 0, 0, 5); // should be ordered by a start time SoftAssert softAssert = new SoftAssert(); InstancesResult.Instance[] instances = r.getInstances(); Date previousDate = new Date(); for (InstancesResult.Instance instance : instances) { Date current = instance.getStartTime(); softAssert.assertNotNull(current, "Start time shouldn't be null for KILLED instance."); softAssert.assertTrue( current.before(previousDate) || current.equals(previousDate), "Wrong order. Current startTime :" + current + " Previous: " + previousDate); previousDate = (Date) current.clone(); } softAssert.assertAll(); // missing 1st, 11th, 12th instances, all other instances should be retrieved. params = "start=" + TimeUtil.addMinsToTime(startTime, 2) + "&offset=2"; r = prism.getFeedHelper().listInstances(feedName, params, null); InstanceUtil.validateResponse(r, 9, 0, 1, 3, 5); // missing the 1st, 11th, 12th instance, all instances which have progressed should be present: // 5 killed + 1 suspended, but numResults=5, so expecting 1 suspended and 4 killed instances. params = "start=" + TimeUtil.addMinsToTime(startTime, 2) + "&filterBy=SOURCECLUSTER:" + sourceCluster + "&offset=1&numResults=5"; r = prism.getFeedHelper().listInstances(feedName, params, null); InstanceUtil.validateResponse(r, 5, 0, 1, 0, 4); }