*** Settings ***

Library  Selenium2Library  timeout=5 seconds  implicit_wait=3 seconds
Resource  keywords.txt
Resource  workflow.txt
Resource  cover_keywords.txt
Variables  plone/app/testing/interfaces.py

Suite Setup  Start Browser and Log In
Suite Teardown  Close Browser

*** Variables ***

${collection_tile_location}  "collective.cover.collection"
${collection_uuid}  12345
${collection_selector}  .ui-draggable .contenttype-collection
${tile_selector}  div.tile-container div.tile

*** Test cases ***

Test Collection Tile
    # XXX: should we create the cover object programmatically?
    Create Cover  Title  Description  Empty layout
    Click Link  link=Layout

    Add Tile
    Select Tile to Add  ${collection_tile_location}
    Save Cover Layout

    Click Link  link=Compose
    Page Should Contain  Please drop a collection here to fill the tile

    Click Element  css=div#screenlet-content-show-button

    Drag And Drop  css=${collection_selector}  css=${tile_selector}
    Page Should Contain  The collection doesn't have any results

    Click Link  My collection
    Workflow Make Private
    Log out

    Click Link  Title
    Page Should Not Contain  The collection doesn't have any results
    And Page Should Not Contain  Forgot your password?

    Log In As Site Owner
    Click Link  My collection
    Workflow Promote to Draft

    Click Link  Title
    Click Link  link=Layout
    Delete Tile
    Save Cover Layout
