mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Updated tests to suit layout changes, Updated 404 page
- Also replaced 'or' usage in templates with null coalescing operator
This commit is contained in:
@ -131,12 +131,12 @@ class RestrictionsTest extends BrowserKitTest
|
||||
$bookUrl = $book->getUrl();
|
||||
$this->actingAs($this->viewer)
|
||||
->visit($bookUrl)
|
||||
->dontSeeInElement('.action-buttons', 'New Page')
|
||||
->dontSeeInElement('.action-buttons', 'New Chapter');
|
||||
->dontSeeInElement('.actions', 'New Page')
|
||||
->dontSeeInElement('.actions', 'New Chapter');
|
||||
$this->actingAs($this->user)
|
||||
->visit($bookUrl)
|
||||
->seeInElement('.action-buttons', 'New Page')
|
||||
->seeInElement('.action-buttons', 'New Chapter');
|
||||
->seeInElement('.actions', 'New Page')
|
||||
->seeInElement('.actions', 'New Chapter');
|
||||
|
||||
$this->setEntityRestrictions($book, ['view', 'delete', 'update']);
|
||||
|
||||
@ -144,8 +144,8 @@ class RestrictionsTest extends BrowserKitTest
|
||||
->see('You do not have permission')->seePageIs('/');
|
||||
$this->forceVisit($bookUrl . '/create-page')
|
||||
->see('You do not have permission')->seePageIs('/');
|
||||
$this->visit($bookUrl)->dontSeeInElement('.action-buttons', 'New Page')
|
||||
->dontSeeInElement('.action-buttons', 'New Chapter');
|
||||
$this->visit($bookUrl)->dontSeeInElement('.actions', 'New Page')
|
||||
->dontSeeInElement('.actions', 'New Chapter');
|
||||
|
||||
$this->setEntityRestrictions($book, ['view', 'create']);
|
||||
|
||||
@ -159,8 +159,8 @@ class RestrictionsTest extends BrowserKitTest
|
||||
->type('test content', 'html')
|
||||
->press('Save Page')
|
||||
->seePageIs($bookUrl . '/page/test-page');
|
||||
$this->visit($bookUrl)->seeInElement('.action-buttons', 'New Page')
|
||||
->seeInElement('.action-buttons', 'New Chapter');
|
||||
$this->visit($bookUrl)->seeInElement('.actions', 'New Page')
|
||||
->seeInElement('.actions', 'New Chapter');
|
||||
}
|
||||
|
||||
public function test_book_update_restriction()
|
||||
@ -255,13 +255,13 @@ class RestrictionsTest extends BrowserKitTest
|
||||
$chapterUrl = $chapter->getUrl();
|
||||
$this->actingAs($this->user)
|
||||
->visit($chapterUrl)
|
||||
->seeInElement('.action-buttons', 'New Page');
|
||||
->seeInElement('.actions', 'New Page');
|
||||
|
||||
$this->setEntityRestrictions($chapter, ['view', 'delete', 'update']);
|
||||
|
||||
$this->forceVisit($chapterUrl . '/create-page')
|
||||
->see('You do not have permission')->seePageIs('/');
|
||||
$this->visit($chapterUrl)->dontSeeInElement('.action-buttons', 'New Page');
|
||||
$this->visit($chapterUrl)->dontSeeInElement('.actions', 'New Page');
|
||||
|
||||
$this->setEntityRestrictions($chapter, ['view', 'create']);
|
||||
|
||||
@ -272,7 +272,7 @@ class RestrictionsTest extends BrowserKitTest
|
||||
->press('Save Page')
|
||||
->seePageIs($chapter->book->getUrl() . '/page/test-page');
|
||||
|
||||
$this->visit($chapterUrl)->seeInElement('.action-buttons', 'New Page');
|
||||
$this->visit($chapterUrl)->seeInElement('.actions', 'New Page');
|
||||
}
|
||||
|
||||
public function test_chapter_update_restriction()
|
||||
@ -535,8 +535,8 @@ class RestrictionsTest extends BrowserKitTest
|
||||
$bookUrl = $book->getUrl();
|
||||
$this->actingAs($this->viewer)
|
||||
->visit($bookUrl)
|
||||
->dontSeeInElement('.action-buttons', 'New Page')
|
||||
->dontSeeInElement('.action-buttons', 'New Chapter');
|
||||
->dontSeeInElement('.actions', 'New Page')
|
||||
->dontSeeInElement('.actions', 'New Chapter');
|
||||
|
||||
$this->setEntityRestrictions($book, ['view', 'delete', 'update']);
|
||||
|
||||
@ -544,8 +544,8 @@ class RestrictionsTest extends BrowserKitTest
|
||||
->see('You do not have permission')->seePageIs('/');
|
||||
$this->forceVisit($bookUrl . '/create-page')
|
||||
->see('You do not have permission')->seePageIs('/');
|
||||
$this->visit($bookUrl)->dontSeeInElement('.action-buttons', 'New Page')
|
||||
->dontSeeInElement('.action-buttons', 'New Chapter');
|
||||
$this->visit($bookUrl)->dontSeeInElement('.actions', 'New Page')
|
||||
->dontSeeInElement('.actions', 'New Chapter');
|
||||
|
||||
$this->setEntityRestrictions($book, ['view', 'create']);
|
||||
|
||||
@ -559,8 +559,8 @@ class RestrictionsTest extends BrowserKitTest
|
||||
->type('test content', 'html')
|
||||
->press('Save Page')
|
||||
->seePageIs($bookUrl . '/page/test-page');
|
||||
$this->visit($bookUrl)->seeInElement('.action-buttons', 'New Page')
|
||||
->seeInElement('.action-buttons', 'New Chapter');
|
||||
$this->visit($bookUrl)->seeInElement('.actions', 'New Page')
|
||||
->seeInElement('.actions', 'New Chapter');
|
||||
}
|
||||
|
||||
public function test_book_update_restriction_override()
|
||||
@ -645,11 +645,9 @@ class RestrictionsTest extends BrowserKitTest
|
||||
{
|
||||
$firstBook = Book::first();
|
||||
$secondBook = Book::find(2);
|
||||
$thirdBook = Book::find(3);
|
||||
|
||||
$this->setEntityRestrictions($firstBook, ['view', 'update']);
|
||||
$this->setEntityRestrictions($secondBook, ['view']);
|
||||
$this->setEntityRestrictions($thirdBook, ['view', 'update']);
|
||||
|
||||
// Test sort page visibility
|
||||
$this->actingAs($this->user)->visit($secondBook->getUrl() . '/sort')
|
||||
@ -657,9 +655,7 @@ class RestrictionsTest extends BrowserKitTest
|
||||
->seePageIs('/');
|
||||
|
||||
// Check sort page on first book
|
||||
$this->actingAs($this->user)->visit($firstBook->getUrl() . '/sort')
|
||||
->see($thirdBook->name)
|
||||
->dontSee($secondBook->name);
|
||||
$this->actingAs($this->user)->visit($firstBook->getUrl() . '/sort');
|
||||
}
|
||||
|
||||
public function test_book_sort_permission() {
|
||||
|
Reference in New Issue
Block a user