koel/tests/e2e/SideBarTest.php

43 lines
1.5 KiB
PHP
Raw Normal View History

2016-11-15 10:03:59 +00:00
<?php
namespace E2E;
class SideBarTest extends TestCase
{
public function testSideBar()
{
$this->loginAndWait();
// All basic navigation
foreach (['home', 'queue', 'songs', 'albums', 'artists', 'youtube', 'settings', 'users'] as $screen) {
2016-11-24 03:56:00 +00:00
$this->goto($screen)
->waitUntil(function () use ($screen) {
return $this->driver->getCurrentURL() === $this->url.'/#!/'.$screen;
});
2016-11-15 10:03:59 +00:00
}
// Add a playlist
$this->click('#playlists > h1 > i.create');
2016-11-24 03:56:00 +00:00
$this->see('#playlists > form.create')
->typeIn('#playlists > form > input[type="text"]', 'Bar')
->enter()
->waitUntil(function () {
$list = $this->els('#playlists .playlist');
2016-11-24 04:12:28 +00:00
2016-11-24 03:56:00 +00:00
return end($list)->getText() === 'Bar';
});
2016-11-15 10:03:59 +00:00
// Double click to edit/rename a playlist
2016-11-24 03:56:00 +00:00
$this->doubleClick('#playlists .playlist:nth-child(2)')
->see('#playlists .playlist:nth-child(2) input[type="text"]')
->typeIn('#playlists .playlist:nth-child(2) input[type="text"]', 'Qux')
->enter()
->seeText('Qux', '#playlists .playlist:nth-child(2)');
2016-11-15 10:03:59 +00:00
// Edit with an empty name shouldn't do anything.
$this->doubleClick('#playlists .playlist:nth-child(2)');
$this->click('#playlists .playlist:nth-child(2) input[type="text"]')->clear();
2016-11-24 03:56:00 +00:00
$this->enter()->seeText('Qux', '#playlists .playlist:nth-child(2)');
2016-11-15 10:03:59 +00:00
}
}