drupalLogin($this->drupalCreateUser(['access site-wide contact form'])); $this->drupalGet('contact'); // Ensure that there is no textfield for name. $this->assertFalse($this->xpath('//input[@name=:name]', [':name' => 'name'])); // Ensure that there is no textfield for email. $this->assertFalse($this->xpath('//input[@name=:name]', [':name' => 'mail'])); } }