/**
 * 
 */
package org.richfaces.realworld.testng;

import org.richfaces.realworld.RealWorldHelper;
import org.richfaces.realworld.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;

/**
 * @author Andrey Markavtsov
 *
 */
public class ShelfsImagesUseCasesTest extends SeleniumTestBase {

	@Test
	public void testAlbumOpen () {
		renderPage();
		RealWorldHelper.Login(selenium);
		
		String shelfName = selenium.getText(RealWorldHelper.HtmlConstants.IndexPage.ALBUM_NAME_PATH);
		
		selenium.click(RealWorldHelper.HtmlConstants.IndexPage.ALBUM_PATH);
		waitForAjaxCompletion();
		
		Assert.assertTrue(shelfName.equals(selenium.getText(RealWorldHelper.HtmlConstants.AlbumArea.ALBUM_HEADER_NAME)), "Incorrect data was opened after click by album");
		
		int imagesCount = selenium.getXpathCount(RealWorldHelper.HtmlConstants.AlbumArea.IMAGES_CONTAINER + "/div").intValue();
		Assert.assertTrue(imagesCount > 0, "Opened album has no images, but should.");
		
	}
}
