3 namespace Drupal\Tests\views_ui\Functional;
6 * Tests covering Preview of unsaved Views.
10 class UnsavedPreviewTest extends UITestBase {
13 * Views used by this test.
17 public static $testViews = ['content'];
20 * An admin user with the 'administer views' permission.
22 * @var \Drupal\user\UserInterface
29 public static $modules = ['node', 'views_ui'];
32 * Sets up a Drupal site for running functional and integration tests.
34 protected function setUp($import_test_views = TRUE) {
37 $this->adminUser = $this->drupalCreateUser(['administer views']);
38 $this->drupalLogin($this->adminUser);
42 * Tests previews of unsaved new page displays.
44 public function testUnsavedPageDisplayPreview() {
45 $this->drupalCreateContentType(['type' => 'page']);
46 for ($i = 0; $i < 5; $i++) {
47 $this->drupalCreateNode();
50 $this->drupalGet('admin/structure/views/view/content');
51 $this->assertResponse(200);
53 $this->drupalPostForm(NULL, [], t('Add Page'));
54 $this->assertResponse(200);
56 $this->drupalGet('admin/structure/views/nojs/display/content/page_2/path');
57 $this->assertResponse(200);
59 $this->drupalPostForm(NULL, ['path' => 'foobarbaz'], t('Apply'));
60 $this->assertResponse(200);
62 $this->drupalPostForm(NULL, [], t('Update preview'));
63 $this->assertResponse(200);
64 $this->assertText(t('This display has no path'));
66 $this->drupalGet('admin/structure/views/view/content/edit/page_2');
67 $this->assertResponse(200);
69 $this->drupalPostForm(NULL, [], t('Save'));
70 $this->assertResponse(200);
72 $this->drupalPostForm(NULL, [], t('Update preview'));
73 $this->assertResponse(200);
74 $this->assertLinkByHref('foobarbaz');