$book = Book::query()->first();
$bookUrl = $book->getUrl();
- $this->actingAs($this->viewer)
- ->get($bookUrl)
- ->assertElementNotContains('.actions', 'New Page')
+ $resp = $this->actingAs($this->viewer)->get($bookUrl);
+ $this->withHtml($resp)->assertElementNotContains('.actions', 'New Page')
->assertElementNotContains('.actions', 'New Chapter');
- $this->actingAs($this->user)
- ->get($bookUrl)
- ->assertElementContains('.actions', 'New Page')
+ $resp = $this->actingAs($this->user)->get($bookUrl);
+ $this->withHtml($resp)->assertElementContains('.actions', 'New Page')
->assertElementContains('.actions', 'New Chapter');
$this->setRestrictionsForTestRoles($book, ['view', 'delete', 'update']);
$this->get($bookUrl . '/create-page')->assertRedirect('/');
$this->get('/')->assertSee('You do not have permission');
- $this->get($bookUrl)
- ->assertElementNotContains('.actions', 'New Page')
+ $resp = $this->get($bookUrl);
+ $this->withHtml($resp)->assertElementNotContains('.actions', 'New Page')
->assertElementNotContains('.actions', 'New Chapter');
$this->setRestrictionsForTestRoles($book, ['view', 'create']);
]);
$resp->assertRedirect($book->getUrl('/page/test-page'));
- $this->get($bookUrl)
- ->assertElementContains('.actions', 'New Page')
+ $resp = $this->get($bookUrl);
+ $this->withHtml($resp)->assertElementContains('.actions', 'New Page')
->assertElementContains('.actions', 'New Chapter');
}
$chapter = Chapter::query()->first();
$chapterUrl = $chapter->getUrl();
- $this->actingAs($this->user)
- ->get($chapterUrl)
- ->assertElementContains('.actions', 'New Page');
+ $resp = $this->actingAs($this->user)->get($chapterUrl);
+ $this->withHtml($resp)->assertElementContains('.actions', 'New Page');
$this->setRestrictionsForTestRoles($chapter, ['view', 'delete', 'update']);
$this->get($chapterUrl . '/create-page')->assertRedirect('/');
$this->get('/')->assertSee('You do not have permission');
- $this->get($chapterUrl)->assertElementNotContains('.actions', 'New Page');
+ $this->withHtml($this->get($chapterUrl))->assertElementNotContains('.actions', 'New Page');
$this->setRestrictionsForTestRoles($chapter, ['view', 'create']);
]);
$resp->assertRedirect($chapter->book->getUrl('/page/test-page'));
- $this->get($chapterUrl)->assertElementContains('.actions', 'New Page');
+ $this->withHtml($this->get($chapterUrl))->assertElementContains('.actions', 'New Page');
}
public function test_chapter_update_restriction()
$page = Page::query()->first();
$pageUrl = $page->getUrl();
- $this->actingAs($this->user)
- ->get($pageUrl . '/edit')
- ->assertElementExists('input[name="name"][value="' . $page->name . '"]');
+ $resp = $this->actingAs($this->user)
+ ->get($pageUrl . '/edit');
+ $this->withHtml($resp)->assertElementExists('input[name="name"][value="' . $page->name . '"]');
$this->setRestrictionsForTestRoles($page, ['view', 'delete']);
$this->setRestrictionsForTestRoles($page, ['view', 'update']);
- $this->get($pageUrl . '/edit')
- ->assertOk()
- ->assertElementExists('input[name="name"][value="' . $page->name . '"]');
+ $resp = $this->get($pageUrl . '/edit')
+ ->assertOk();
+ $this->withHtml($resp)->assertElementExists('input[name="name"][value="' . $page->name . '"]');
}
public function test_page_delete_restriction()
$this->setRestrictionsForTestRoles($page, []);
- $this->actingAs($this->user)
- ->get($page2->getUrl())
- ->assertElementNotContains('.sidebar-page-list', $page->name);
+ $resp = $this->actingAs($this->user)->get($page2->getUrl());
+ $this->withHtml($resp)->assertElementNotContains('.sidebar-page-list', $page->name);
}
public function test_restricted_pages_not_visible_in_book_navigation_on_chapters()
$this->setRestrictionsForTestRoles($page, []);
- $this->actingAs($this->user)
- ->get($chapter->getUrl())
- ->assertElementNotContains('.sidebar-page-list', $page->name);
+ $resp = $this->actingAs($this->user)->get($chapter->getUrl());
+ $this->withHtml($resp)->assertElementNotContains('.sidebar-page-list', $page->name);
}
public function test_restricted_pages_not_visible_on_chapter_pages()
$book = Book::query()->first();
$bookUrl = $book->getUrl();
- $this->actingAs($this->viewer)
- ->get($bookUrl)
- ->assertElementNotContains('.actions', 'New Page')
+ $resp = $this->actingAs($this->viewer)->get($bookUrl);
+ $this->withHtml($resp)->assertElementNotContains('.actions', 'New Page')
->assertElementNotContains('.actions', 'New Chapter');
$this->setRestrictionsForTestRoles($book, ['view', 'delete', 'update']);
$this->get('/')->assertSee('You do not have permission');
$this->get($bookUrl . '/create-page')->assertRedirect('/');
$this->get('/')->assertSee('You do not have permission');
- $this->get($bookUrl)->assertElementNotContains('.actions', 'New Page')
+ $resp = $this->get($bookUrl);
+ $this->withHtml($resp)->assertElementNotContains('.actions', 'New Page')
->assertElementNotContains('.actions', 'New Chapter');
$this->setRestrictionsForTestRoles($book, ['view', 'create']);
]);
$resp->assertRedirect($book->getUrl('/page/test-page'));
- $this->get($bookUrl)
- ->assertElementContains('.actions', 'New Page')
+ $resp = $this->get($bookUrl);
+ $this->withHtml($resp)->assertElementContains('.actions', 'New Page')
->assertElementContains('.actions', 'New Chapter');
}