Project

General

Profile

« Previous | Next » 

Revision e249276f

Added by Andreas Kohlbecker over 3 years ago

ref #4372 adapting media gallery to zen theme

View differences:

modules/cdm_dataportal/includes/media.inc
345 345
  for ($r = 0; ($r < $maxRows || !$maxRows) && count($mediaList) > 0; $r++) {
346 346
    $captionParts = array();
347 347
    $mediaIndex = 0;
348
    $out .= '<tr>';
348
    $out .= '<tr class="media-row">';
349 349
    for ($c = 0; $c < $cols; $c++) {
350 350
      $media = array_shift($mediaList);
351 351
      if(!$media){
......
481 481
    $out .= '</tr>'; // End of media parts.
482 482
    if ($showCaption) {
483 483
      if ( (is_array($captionElements) && count($captionElements) > 0) || $caption_link_uri) {
484
        $out .= '<tr>';
484
        $out .= '<tr class="caption-row">';
485 485
        // Add caption row.
486 486
        foreach ($captionParts as $captionPartHtml) {
487 487
          $out .= '<td class="caption">' . $captionPartHtml . '</td>';
......
499 499
      $moreHtml = t('open gallery');
500 500
    }
501 501
    $moreHtml = l($moreHtml, $galleryLinkUri);
502
    $out .= '<tr><td colspan="' . $cols . '">' . $moreHtml . '</td></tr>';
502
    $out .= '<tr class="more-items-row"><td colspan="' . $cols . '">' . $moreHtml . '</td></tr>';
503 503
  }
504 504
  $out .= '</table>';
505 505

  
src/main/java/eu/etaxonomy/dataportal/ElementUtils.java
65 65

  
66 66
        ArrayList<List<GalleryImage>> galleryImageRows = new ArrayList<List<GalleryImage>>();
67 67

  
68
        List<WebElement> tableRows = gallery.findElements(By.tagName("tr"));
68
        List<WebElement> tableRows = gallery.findElements(By.cssSelector("tr.media-row"));
69 69
        logger.debug("GalleryImages - total rows " + tableRows.size());
70 70
        // loop table rows
71 71
        for(int rowId = 0; rowId * 2 < tableRows.size() && tableRows.size() > 0; rowId++ ){
......
74 74
            logger.debug("GalleryImages - number of image cells: " + imageCells.size());
75 75
            List<WebElement> captionCells = null;
76 76
            if(tableRows.size() > rowId * 2 + 1){
77
                captionCells = tableRows.get(rowId * 2 + 1).findElements(By.tagName("td"));
77
                captionCells = tableRows.get(rowId * 2 + 1).findElements(By.cssSelector("tr.caption-row"));
78 78
                logger.debug("GalleryImages - number of caption cells: " + captionCells.size());
79 79
            }
80 80

  
src/main/java/eu/etaxonomy/dataportal/pages/GenericPortalPage.java
54 54
        wait.until(
55 55
                    new AllTrue(
56 56
                                new PageTitleValidated(context.prepareTitle("Search results")),
57
                                new VisibilityOfElementLocated(By.id("container"))
57
                                new VisibilityOfElementLocated(By.id("search_results"))
58 58
                                )
59 59
                    );
60 60
        return new TaxonSearchResultPage(driver, context);
src/main/java/eu/etaxonomy/dataportal/pages/PortalPage.java
413 413
     */
414 414
    public <T extends PortalPage> T clickLink(BaseElement element, Function<? super WebDriver, Boolean> isTrue, Class<T> pageType, Long duration, TimeUnit waitUnit) {
415 415

  
416
        if( pageType.getClass().equals(PortalPage.class) ) {
416
        if( pageType!= null && pageType.getClass().equals(PortalPage.class) ) {
417 417
            throw new RuntimeException("Parameter pageType must be a subclass of PortalPage");
418 418
        }
419 419
        String targetWindow = null;
......
447 447

  
448 448
        Constructor<T> constructor;
449 449
        T pageInstance;
450
        try {
451
            constructor = pageType.getConstructor(WebDriver.class, DataPortalContext.class);
452
            pageInstance = constructor.newInstance(driver, context);
453
        } catch (Exception e) {
454
            throw new RuntimeException(e);
450
            if(pageType != null) {
451
            try {
452
                constructor = pageType.getConstructor(WebDriver.class, DataPortalContext.class);
453
                pageInstance = constructor.newInstance(driver, context);
454
            } catch (Exception e) {
455
                throw new RuntimeException(e);
456
            }
457
            // take screenshot of new page
458
            takeScreenShot();
459
            return pageInstance;
460
        } else {
461
            return null;
455 462
        }
456
        // take screenshot of new page
457
        takeScreenShot();
458
        return pageInstance;
459 463
    }
460 464

  
461 465

  
src/test/java/eu/etaxonomy/dataportal/selenium/tests/cichorieae/Cichorieae_SearchTest.java
25 25
import eu.etaxonomy.dataportal.pages.GenericPortalPage;
26 26
import eu.etaxonomy.dataportal.pages.PortalPage;
27 27
import eu.etaxonomy.dataportal.pages.TaxonSearchResultPage;
28
import eu.etaxonomy.dataportal.selenium.UrlLoaded;
28 29
import eu.etaxonomy.dataportal.selenium.VisibilityOfElementLocated;
29 30
import junit.framework.Assert;
30 31

  
......
34 35
    private static final UUID UUID_L_COMMUNIS = UUID.fromString("5d65f017-0c23-43e4-888d-9649de50dd45");
35 36
    private static GenericPortalPage homePage = null;
36 37

  
38

  
37 39
    @Before
38 40
    public void setUp() throws Exception {
39 41

  
......
42 44

  
43 45
    }
44 46

  
45
    @Test
47
    // @Test
46 48
    public void testSearchLCommunis() throws Exception {
47 49

  
48 50
        TaxonSearchResultPage searchResultPage = homePage.submitQuery("Lapsana com*");
......
86 88

  
87 89
        GalleryImage firstImage = galleryImageRows.get(0).get(0);
88 90
        assertNull("caption should be off", firstImage.getCaptionText());
89
        searchResultPage.clickLink(firstImage.getImageLink(), new VisibilityOfElementLocated(By.id("images")), GenericPortalPage.class);
91
        if(searchResultPage.isZenTheme()) {
92
            searchResultPage.clickLink(firstImage.getImageLink(), new UrlLoaded("http://media.bgbm.org/erez/erez?src=EditWP6/photos/Lactuca_triquetra_Bc_01.JPG"), null);
93
        } else {
94
            searchResultPage.clickLink(firstImage.getImageLink(), new VisibilityOfElementLocated(By.id("images")), GenericPortalPage.class);
95
        }
90 96
    }
91 97

  
92 98
}

Also available in: Unified diff