*** Settings ***

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

Suite Setup  Start Browser and Log In
Suite Teardown  Close Browser

*** Variables ***

${list_tile_location}  /html/body/div/div[2]/div/div[2]/div[2]/div[3]/div[9]
${document_selector}  .ui-draggable .contenttype-document
${file_selector}  .ui-draggable .contenttype-file
${image_selector}  .ui-draggable .contenttype-image
${link_selector}  .ui-draggable .contenttype-link
${news-item_selector}  .ui-draggable .contenttype-news-item
${tile_selector}  div.tile-container div.tile

*** Test cases ***

Test List 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  ${list_tile_location}
    Save Cover Layout

    Click Link  link=Compose
    Page Should Contain  Please add up to 5 objects to the tile.

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

    Drag And Drop  css=${document_selector}  css=${tile_selector}
    Page Should Contain  My document
    Page Should Contain  This document was created for testing purposes

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

    Drag And Drop  css=${file_selector}  css=${tile_selector}
    Page Should Contain  My file
	Page Should Contain  This file was created for testing purposes
	
#    Click Element  css=div#screenlet-content-show-button

    Drag And Drop  css=${image_selector}  css=${tile_selector}
    Page Should Contain  Test image
	Page Should Contain  This image was created for testing purposes
	
#    Click Element  css=div#screenlet-content-show-button

    Drag And Drop  css=${link_selector}  css=${tile_selector}
    Page Should Contain  Test link
	Page Should Contain  This link was created for testing purposes

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

    Drag And Drop  css=${news-item_selector}  css=${tile_selector}
    Page Should Contain  Test news item
    Page Should Contain  This news item was created for testing purposes

    Click Element  link=Layout
    Delete Tile
    Save Cover Layout
