1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Updated tests to use ssddanbrown/asserthtml package

Closes #3519
This commit is contained in:
Dan Brown
2022-07-23 15:10:18 +01:00
parent cf73e5f2c6
commit 72c8b138e1
48 changed files with 869 additions and 1014 deletions

View File

@ -247,7 +247,7 @@ class SortTest extends TestCase
$bookToSort = Book::query()->first();
$resp = $this->asAdmin()->get($bookToSort->getUrl());
$resp->assertElementExists('a[href="' . $bookToSort->getUrl('/sort') . '"]');
$this->withHtml($resp)->assertElementExists('a[href="' . $bookToSort->getUrl('/sort') . '"]');
$resp = $this->get($bookToSort->getUrl('/sort'));
$resp->assertStatus(200);
@ -456,14 +456,14 @@ class SortTest extends TestCase
$book->pages()->whereNotIn('id', $pages->pluck('id'))->delete();
$resp = $this->asEditor()->get($book->getUrl());
$resp->assertElementContains('.content-wrap a.page:nth-child(1)', $pages[0]->name);
$resp->assertElementContains('.content-wrap a.page:nth-child(2)', $pages[1]->name);
$this->withHtml($resp)->assertElementContains('.content-wrap a.page:nth-child(1)', $pages[0]->name);
$this->withHtml($resp)->assertElementContains('.content-wrap a.page:nth-child(2)', $pages[1]->name);
$pages[0]->forceFill(['priority' => 10])->save();
$pages[1]->forceFill(['priority' => 5])->save();
$resp = $this->asEditor()->get($book->getUrl());
$resp->assertElementContains('.content-wrap a.page:nth-child(1)', $pages[1]->name);
$resp->assertElementContains('.content-wrap a.page:nth-child(2)', $pages[0]->name);
$this->withHtml($resp)->assertElementContains('.content-wrap a.page:nth-child(1)', $pages[1]->name);
$this->withHtml($resp)->assertElementContains('.content-wrap a.page:nth-child(2)', $pages[0]->name);
}
}