koel/tests/e2e/AlbumsScreenTest.php
2016-11-15 18:03:59 +08:00

25 lines
1.1 KiB
PHP

<?php
namespace E2E;
use Facebook\WebDriver\WebDriverBy;
class AlbumsScreenTest extends TestCase
{
public function testAlbumsScreen()
{
$this->loginAndWait()->goto('albums');
static::assertNotEmpty($this->els('#albumsWrapper .albums article.item'));
$firstAlbum = $this->el('#albumsWrapper .albums article.item:nth-child(1)');
static::assertNotEmpty($firstAlbum->findElement(WebDriverBy::cssSelector('.info .name'))->getText());
static::assertNotEmpty($firstAlbum->findElement(WebDriverBy::cssSelector('.info .artist'))->getText());
static::assertContains('10 songs', $firstAlbum->findElement(WebDriverBy::cssSelector('.meta'))->getText());
// test the view modes
$this->click('#albumsWrapper > h1.heading > span.view-modes > a:nth-child(2)');
static::assertCount(1, $this->els('#albumsWrapper > div.albums.as-list'));
$this->click('#albumsWrapper > h1.heading > span.view-modes > a:nth-child(1)');
static::assertCount(1, $this->els('#albumsWrapper > div.albums.as-thumbnails'));
}
}