Complete the code to start a Dusk browser test session.
public function testHomePage() {
$this->browse(function (Browser $browser) {
$browser->[1]('/');
});
}The visit method opens the given URL in the browser session.
Complete the code to check if the page contains the text 'Welcome'.
$browser->[1]('Welcome');
The assertSee method checks if the given text is visible on the page.
Fix the error in the code to click a button with the selector '#submit'.
$browser->[1]('#submit');
The click method simulates clicking an element matching the selector.
Fill both blanks to type 'hello@example.com' into an input with name 'email' and then submit the form.
$browser->[1]('input[name="email"]', 'hello@example.com') ->[2]('button[type="submit"]');
First, type inputs text into the field named 'email'. Then, click submits the form by clicking the submit button.
Fill all three blanks to assert the current path is '/dashboard', then wait for an element with id 'profile', and finally assert the element contains the text 'User'.
$browser->[1]('/dashboard') ->[2]('#profile') ->[3]('#profile', 'User');
assertPathIs checks the current URL path, waitFor waits for the element to appear, and assertSeeIn checks text inside a specific element.