Skip to content

Commit

Permalink
Fix dusk tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JhumanJ committed Apr 15, 2021
1 parent 8c0ffc0 commit 84e650d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Laravel-Vue-Tailwind SPA

<a href="https://github.com/jhumanj/laravel-vue-tailwind-spa/actions"><img src="https://github.com/jhumanj/laravel-vue-tailwind-spa/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/jhumanj/laravel-vue-tailwind-spa"><img src="https://poser.pugx.org/jhumanj/laravel-vue-tailwind-spa/d/total.svg" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/jhumanj/laravel-vue-tailwind-spa"><img src="https://poser.pugx.org/jhumanj/laravel-vue-tailwind-spa/v/stable.svg" alt="Latest Stable Version"></a>

Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
<div class="ml-4 flex items-center md:ml-6">
<div class="ml-3 relative">
<div class="relative inline-block text-left">
<dropdown v-if="user">
<dropdown v-if="user" dusk="nav-dropdown">
<template #trigger="{toggle}">
<button type="button" @click.prevent="toggle()"
class="flex items-center justify-center w-full rounded-md px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-50 hover:bg-gray-50 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-gray-500"
id="options-menu">
id="dropdown-menu-button" dusk="nav-dropdown-button">
<img :src="user.photo_url" class="rounded-full w-6 h-6">
<p class="ml-2">{{ user.name }}</p>
</button>
Expand Down
2 changes: 1 addition & 1 deletion resources/js/pages/welcome.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<div class="text-center">
<div class="text-6xl font-thin text-gray-500 mt-16 mb-8">
<div class="text-6xl font-thin text-gray-500 mt-16 mb-8" dusk="title">
{{ title }}
</div>

Expand Down
1 change: 1 addition & 0 deletions tests/Browser/LoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function login_with_invalid_credentials()
$this->browse(function ($browser) {
$browser->visit(new Login)
->submit('[email protected]', 'password')
->pause(100)
->assertSee('These credentials do not match our records.');
});
}
Expand Down
9 changes: 3 additions & 6 deletions tests/Browser/Pages/Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ public function assert(Browser $browser)
*/
public function elements()
{
return [
'@dropdown-toggle' => '.navbar-nav.ml-auto .dropdown-toggle',
'@dropdown-menu' => '.dropdown-menu.show',
];
return [];
}

/**
Expand All @@ -48,8 +45,8 @@ public function elements()
*/
public function clickLogout($browser)
{
$browser->click('@dropdown-toggle')
->waitFor('@dropdown-menu')
$browser->click('@nav-dropdown-button')
->waitFor('@nav-dropdown')
->waitForText('Logout')
->clickLink('Logout')
->pause(100);
Expand Down
2 changes: 1 addition & 1 deletion tests/Browser/WelcomeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function basic_test()
{
$this->browse(function ($browser) {
$browser->visit('/')
->waitFor('.title', 1)
->waitFor('@title', 1)
->assertSee('Laravel');
});
}
Expand Down

0 comments on commit 84e650d

Please sign in to comment.