Please sign in
diff --git a/src/resources/vue/Logout.vue b/src/resources/vue/Logout.vue
--- a/src/resources/vue/Logout.vue
+++ b/src/resources/vue/Logout.vue
@@ -5,7 +5,7 @@
mounted () {
axios.post('/api/auth/logout')
.then(response => {
- this.$toastr('success', response.data.message)
+ this.$toast.success(response.data.message)
})
this.$root.logoutUser()
diff --git a/src/resources/vue/User/Info.vue b/src/resources/vue/User/Info.vue
--- a/src/resources/vue/User/Info.vue
+++ b/src/resources/vue/User/Info.vue
@@ -251,7 +251,7 @@
axios[method](location, this.user)
.then(response => {
if (response.data.status == 'success') {
- this.$toastr('success', response.data.message)
+ this.$toast.success(response.data.message)
}
// on new user redirect to users list
diff --git a/src/resources/vue/User/List.vue b/src/resources/vue/User/List.vue
--- a/src/resources/vue/User/List.vue
+++ b/src/resources/vue/User/List.vue
@@ -89,7 +89,7 @@
axios.delete('/api/v4/users/' + id)
.then(response => {
if (response.data.status == 'success') {
- this.$toastr('success', response.data.message)
+ this.$toast.success(response.data.message)
$('#user' + id).remove()
}
})
diff --git a/src/resources/vue/User/Profile.vue b/src/resources/vue/User/Profile.vue
--- a/src/resources/vue/User/Profile.vue
+++ b/src/resources/vue/User/Profile.vue
@@ -99,7 +99,7 @@
delete this.profile.password_confirm
if (response.data.status == 'success') {
- this.$toastr('success', response.data.message)
+ this.$toast.success(response.data.message)
}
})
}
diff --git a/src/resources/vue/User/ProfileDelete.vue b/src/resources/vue/User/ProfileDelete.vue
--- a/src/resources/vue/User/ProfileDelete.vue
+++ b/src/resources/vue/User/ProfileDelete.vue
@@ -40,7 +40,7 @@
.then(response => {
if (response.data.status == 'success') {
this.$root.logoutUser()
- this.$toastr('success', response.data.message)
+ this.$toast.success(response.data.message)
}
})
}
diff --git a/src/resources/vue/Widgets/ListInput.vue b/src/resources/vue/Widgets/ListInput.vue
--- a/src/resources/vue/Widgets/ListInput.vue
+++ b/src/resources/vue/Widgets/ListInput.vue
@@ -24,8 +24,8 @@
diff --git a/src/resources/vue/Widgets/Toast.vue b/src/resources/vue/Widgets/Toast.vue
new file mode 100644
--- /dev/null
+++ b/src/resources/vue/Widgets/Toast.vue
@@ -0,0 +1,104 @@
+
+
+
+
+
diff --git a/src/resources/vue/Widgets/ToastMessage.vue b/src/resources/vue/Widgets/ToastMessage.vue
new file mode 100644
--- /dev/null
+++ b/src/resources/vue/Widgets/ToastMessage.vue
@@ -0,0 +1,60 @@
+
+
+
+
+
diff --git a/src/tests/Browser.php b/src/tests/Browser.php
--- a/src/tests/Browser.php
+++ b/src/tests/Browser.php
@@ -40,7 +40,8 @@
{
return $this->click($selector)
->withinBody(function ($browser) use ($content) {
- $browser->assertSeeIn('div.tooltip .tooltip-inner', $content);
+ $browser->waitFor('div.tooltip .tooltip-inner')
+ ->assertSeeIn('div.tooltip .tooltip-inner', $content);
})
->click($selector);
}
@@ -48,7 +49,7 @@
/**
* Assert Toast element content (and close it)
*/
- public function assertToast($type, $title, $message)
+ public function assertToast(string $type, string $message, $title = null)
{
return $this->withinBody(function ($browser) use ($type, $title, $message) {
$browser->with(new Toast($type), function (Browser $browser) use ($title, $message) {
diff --git a/src/tests/Browser/Admin/DashboardTest.php b/src/tests/Browser/Admin/DashboardTest.php
--- a/src/tests/Browser/Admin/DashboardTest.php
+++ b/src/tests/Browser/Admin/DashboardTest.php
@@ -49,7 +49,7 @@
// Test search with no results
$browser->type('@search input', 'unknown')
->click('@search form button')
- ->assertToast(Toast::TYPE_INFO, '', '0 user accounts have been found.')
+ ->assertToast(Toast::TYPE_INFO, '0 user accounts have been found.')
->assertMissing('@search table');
$john = $this->getTestUser('john@kolab.org');
@@ -59,7 +59,7 @@
// Test search with multiple results
$browser->type('@search input', 'john.doe.external@gmail.com')
->click('@search form button')
- ->assertToast(Toast::TYPE_INFO, '', '2 user accounts have been found.')
+ ->assertToast(Toast::TYPE_INFO, '2 user accounts have been found.')
->whenAvailable('@search table', function (Browser $browser) {
$browser->assertElementsCount('tbody tr', 2);
// TODO: Assert table content
diff --git a/src/tests/Browser/Admin/DomainTest.php b/src/tests/Browser/Admin/DomainTest.php
--- a/src/tests/Browser/Admin/DomainTest.php
+++ b/src/tests/Browser/Admin/DomainTest.php
@@ -60,8 +60,8 @@
->on(new Dashboard())
->visit($user_page)
->on($user_page)
- ->pause(500)
->click('@nav #tab-domains')
+ ->pause(1000)
->click('@user-domains table tbody tr:first-child td a');
$browser->on($domain_page)
diff --git a/src/tests/Browser/Admin/LogonTest.php b/src/tests/Browser/Admin/LogonTest.php
--- a/src/tests/Browser/Admin/LogonTest.php
+++ b/src/tests/Browser/Admin/LogonTest.php
@@ -57,17 +57,11 @@
{
$this->browse(function (Browser $browser) {
$browser->visit(new Home())
- ->submitLogon('jeroen@jeroen.jeroen', 'wrong');
-
- // Error message
- $browser->with(new Toast(Toast::TYPE_ERROR), function (Browser $browser) {
- $browser->assertToastTitle('Error')
- ->assertToastMessage('Invalid username or password.')
- ->closeToast();
- });
-
- // Checks if we're still on the logon page
- $browser->on(new Home());
+ ->submitLogon('jeroen@jeroen.jeroen', 'wrong')
+ // Error message
+ ->assertToast(Toast::TYPE_ERROR, 'Invalid username or password.')
+ // Checks if we're still on the logon page
+ ->on(new Home());
});
}
@@ -118,11 +112,7 @@
});
// Success toast message
- $browser->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('Successfully logged out')
- ->closeToast();
- });
+ $browser->assertToast(Toast::TYPE_SUCCESS, 'Successfully logged out');
});
}
@@ -149,11 +139,7 @@
});
// Success toast message
- $browser->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('Successfully logged out')
- ->closeToast();
- });
+ $browser->assertToast(Toast::TYPE_SUCCESS, 'Successfully logged out');
});
}
}
diff --git a/src/tests/Browser/Admin/UserTest.php b/src/tests/Browser/Admin/UserTest.php
--- a/src/tests/Browser/Admin/UserTest.php
+++ b/src/tests/Browser/Admin/UserTest.php
@@ -371,7 +371,7 @@
->click('@body select option:nth-child(2)')
->click('@button-action');
})
- ->assertToast(Toast::TYPE_SUCCESS, '', 'User wallet updated successfully.')
+ ->assertToast(Toast::TYPE_SUCCESS, 'User wallet updated successfully.')
->assertSeeIn('#discount span', '10% - Test voucher')
->click('@nav #tab-subscriptions')
->with('@user-subscriptions', function (Browser $browser) {
@@ -388,7 +388,7 @@
->click('@body select option:nth-child(1)')
->click('@button-action');
})
- ->assertToast(Toast::TYPE_SUCCESS, '', 'User wallet updated successfully.')
+ ->assertToast(Toast::TYPE_SUCCESS, 'User wallet updated successfully.')
->assertSeeIn('#discount span', 'none')
->click('@nav #tab-subscriptions')
->with('@user-subscriptions', function (Browser $browser) {
diff --git a/src/tests/Browser/Components/Menu.php b/src/tests/Browser/Components/Menu.php
--- a/src/tests/Browser/Components/Menu.php
+++ b/src/tests/Browser/Components/Menu.php
@@ -7,6 +7,18 @@
class Menu extends BaseComponent
{
+ protected $mode;
+
+ /**
+ * Object constructor
+ *
+ * @param string $mode Menu mode ('header' or 'footer')
+ */
+ public function __construct($mode = 'header')
+ {
+ $this->mode = $mode;
+ }
+
/**
* Get the root selector for the component.
*
@@ -14,7 +26,7 @@
*/
public function selector()
{
- return '#primary-menu';
+ return '#' . $this->mode . '-menu';
}
/**
@@ -27,7 +39,6 @@
public function assert($browser)
{
$browser->assertVisible($this->selector());
- $browser->assertVisible('@brand');
}
/**
@@ -75,9 +86,9 @@
$selector = $this->selector();
return [
- '@list' => "$selector .navbar-nav",
- '@brand' => "$selector .navbar-brand",
- '@toggler' => "$selector .navbar-toggler",
+ '@list' => ".navbar-nav",
+ '@brand' => ".navbar-brand",
+ '@toggler' => ".navbar-toggler",
];
}
}
diff --git a/src/tests/Browser/Components/Toast.php b/src/tests/Browser/Components/Toast.php
--- a/src/tests/Browser/Components/Toast.php
+++ b/src/tests/Browser/Components/Toast.php
@@ -2,6 +2,7 @@
namespace Tests\Browser\Components;
+use Facebook\WebDriver\WebDriverBy;
use Laravel\Dusk\Component as BaseComponent;
use PHPUnit\Framework\Assert as PHPUnit;
@@ -52,21 +53,34 @@
public function elements()
{
return [
- '@title' => ".toast-title",
- '@message' => ".toast-message",
+ '@title' => ".toast-header > strong",
+ '@message' => ".toast-body",
];
}
/**
* Assert title of the toast element
*/
- public function assertToastTitle($browser, string $title)
+ public function assertToastTitle($browser, string $title = null)
{
if (empty($title)) {
- $browser->assertMissing('@title');
- } else {
- $browser->assertSeeIn('@title', $title);
+ switch ($this->type) {
+ case self::TYPE_ERROR:
+ $title = 'Error';
+ break;
+ case self::TYPE_SUCCESS:
+ $title = 'Success';
+ break;
+ case self::TYPE_WARNING:
+ $title = 'Warning';
+ break;
+ case self::TYPE_INFO:
+ $title = 'Information';
+ break;
+ }
}
+
+ $browser->assertSeeIn('@title', $title);
}
/**
@@ -82,6 +96,6 @@
*/
public function closeToast($browser)
{
- $this->element->click();
+ $this->element->findElements(WebDriverBy::cssSelector('button.close'))[0]->click();
}
}
diff --git a/src/tests/Browser/DomainTest.php b/src/tests/Browser/DomainTest.php
--- a/src/tests/Browser/DomainTest.php
+++ b/src/tests/Browser/DomainTest.php
@@ -74,11 +74,7 @@
$browser->assertSeeIn('pre', $domain->namespace);
})
->assertMissing('@verify')
- ->with(new Toast(Toast::TYPE_SUCCESS), function ($browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('Domain verified successfully')
- ->closeToast();
- });
+ ->assertToast(Toast::TYPE_SUCCESS, 'Domain verified successfully.');
// Check that confirmed domain page contains only the config box
$browser->visit('/domain/' . $domain->id)
diff --git a/src/tests/Browser/ErrorTest.php b/src/tests/Browser/ErrorTest.php
--- a/src/tests/Browser/ErrorTest.php
+++ b/src/tests/Browser/ErrorTest.php
@@ -16,19 +16,21 @@
public function testError404Page()
{
$this->browse(function (Browser $browser) {
- $browser->visit('/unknown');
+ $browser->visit('/unknown')
+ ->waitFor('#app > #error-page')
+ ->assertVisible('#app > #header-menu')
+ ->assertVisible('#app > #footer-menu');
- $browser->waitFor('#app > #error-page');
- $browser->assertVisible('#app > #primary-menu');
$this->assertSame('404', $browser->text('#error-page .code'));
$this->assertSame('Not Found', $browser->text('#error-page .message'));
});
$this->browse(function (Browser $browser) {
- $browser->visit('/login/unknown');
+ $browser->visit('/login/unknown')
+ ->waitFor('#app > #error-page')
+ ->assertVisible('#app > #header-menu')
+ ->assertVisible('#app > #footer-menu');
- $browser->waitFor('#app > #error-page');
- $browser->assertVisible('#app > #primary-menu');
$this->assertSame('404', $browser->text('#error-page .code'));
$this->assertSame('Not Found', $browser->text('#error-page .message'));
});
diff --git a/src/tests/Browser/LogonTest.php b/src/tests/Browser/LogonTest.php
--- a/src/tests/Browser/LogonTest.php
+++ b/src/tests/Browser/LogonTest.php
@@ -19,10 +19,13 @@
public function testLogonMenu(): void
{
$this->browse(function (Browser $browser) {
- $browser->visit(new Home());
- $browser->within(new Menu(), function ($browser) {
- $browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'webmail']);
- });
+ $browser->visit(new Home())
+ ->within(new Menu(), function ($browser) {
+ $browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'webmail']);
+ })
+ ->within(new Menu('footer'), function ($browser) {
+ $browser->assertMenuItems(['signup', 'explore', 'blog', 'support', 'tos', 'webmail']);
+ });
});
}
@@ -50,11 +53,7 @@
->submitLogon('john@kolab.org', 'wrong');
// Error message
- $browser->with(new Toast(Toast::TYPE_ERROR), function (Browser $browser) {
- $browser->assertToastTitle('Error')
- ->assertToastMessage('Invalid username or password.')
- ->closeToast();
- });
+ $browser->assertToast(Toast::TYPE_ERROR, 'Invalid username or password.');
// Checks if we're still on the logon page
$browser->on(new Home());
@@ -75,6 +74,9 @@
->within(new Menu(), function ($browser) {
$browser->assertMenuItems(['support', 'contact', 'webmail', 'logout']);
})
+ ->within(new Menu('footer'), function ($browser) {
+ $browser->assertMenuItems(['support', 'contact', 'webmail', 'logout']);
+ })
->assertUser('john@kolab.org');
// Assert no "Account status" for this account
@@ -118,11 +120,7 @@
});
// Success toast message
- $browser->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('Successfully logged out')
- ->closeToast();
- });
+ $browser->assertToast(Toast::TYPE_SUCCESS, 'Successfully logged out');
});
}
@@ -149,11 +147,7 @@
});
// Success toast message
- $browser->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('Successfully logged out')
- ->closeToast();
- });
+ $browser->assertToast(Toast::TYPE_SUCCESS, 'Successfully logged out');
});
}
@@ -176,7 +170,7 @@
'Second factor code is required.'
)
->assertFocused('@second-factor-input')
- ->assertToast(Toast::TYPE_ERROR, 'Error', 'Form validation error');
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
// Test invalid code
$browser->type('@second-factor-input', '123456')
@@ -188,7 +182,7 @@
'Second factor code is invalid.'
)
->assertFocused('@second-factor-input')
- ->assertToast(Toast::TYPE_ERROR, 'Error', 'Form validation error');
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
$code = \App\Auth\SecondFactor::code('ned@kolab.org');
diff --git a/src/tests/Browser/SignupTest.php b/src/tests/Browser/SignupTest.php
--- a/src/tests/Browser/SignupTest.php
+++ b/src/tests/Browser/SignupTest.php
@@ -66,7 +66,7 @@
// FIXME: User will not be able to continue anyway, so we should
// either display 1st step or 404 error page
$browser->waitFor('@step1')
- ->assertToast(Toast::TYPE_ERROR, 'Error', 'Form validation error');
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
});
// Test valid code
@@ -188,7 +188,7 @@
->click('[type=submit]')
->waitFor('#signup_email.is-invalid')
->assertVisible('#signup_email + .invalid-feedback')
- ->assertToast(Toast::TYPE_ERROR, 'Error', 'Form validation error');
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
});
// Submit valid data
@@ -254,7 +254,7 @@
$step->waitFor('#signup_short_code.is-invalid')
->assertVisible('#signup_short_code + .invalid-feedback')
->assertFocused('#signup_short_code')
- ->assertToast(Toast::TYPE_ERROR, 'Error', 'Form validation error');
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
});
// Submit valid code
@@ -341,7 +341,7 @@
->assertVisible('#signup_password.is-invalid')
->assertVisible('#signup_password + .invalid-feedback')
->assertFocused('#signup_login')
- ->assertToast(Toast::TYPE_ERROR, 'Error', 'Form validation error');
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
});
// Submit invalid data (valid login, invalid password)
@@ -353,7 +353,7 @@
->assertMissing('#signup_login.is-invalid')
->assertMissing('#signup_domain + .invalid-feedback')
->assertFocused('#signup_password')
- ->assertToast(Toast::TYPE_ERROR, 'Error', 'Form validation error');
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
});
// Submit valid data
@@ -433,7 +433,7 @@
->assertVisible('#signup_password.is-invalid')
->assertVisible('#signup_password + .invalid-feedback')
->assertFocused('#signup_login')
- ->assertToast(Toast::TYPE_ERROR, 'Error', 'Form validation error');
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
});
// Submit invalid domain
@@ -444,11 +444,11 @@
->type('#signup_confirm', '12345678')
->click('[type=submit]')
->waitUntilMissing('#signup_login.is-invalid')
- ->assertVisible('#signup_domain.is-invalid + .invalid-feedback')
+ ->waitFor('#signup_domain.is-invalid + .invalid-feedback')
->assertMissing('#signup_password.is-invalid')
->assertMissing('#signup_password + .invalid-feedback')
->assertFocused('#signup_domain')
- ->assertToast(Toast::TYPE_ERROR, 'Error', 'Form validation error');
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
});
// Submit invalid domain
@@ -506,7 +506,7 @@
->waitFor('#signup_voucher.is-invalid')
->assertVisible('#signup_voucher + .invalid-feedback')
->assertFocused('#signup_voucher')
- ->assertToast(Toast::TYPE_ERROR, 'Error', 'Form validation error')
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error')
// Submit the correct code
->type('#signup_voucher', 'TEST')
->click('[type=submit]');
diff --git a/src/tests/Browser/UserProfileTest.php b/src/tests/Browser/UserProfileTest.php
--- a/src/tests/Browser/UserProfileTest.php
+++ b/src/tests/Browser/UserProfileTest.php
@@ -100,11 +100,7 @@
->select('#country', '')
->click('button[type=submit]');
})
- ->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('User data updated successfully')
- ->closeToast();
- });
+ ->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.');
// Test error handling
$browser->with('@form', function (Browser $browser) {
@@ -117,12 +113,8 @@
'#external_email + .invalid-feedback',
'The external email must be a valid email address.'
)
- ->assertFocused('#phone');
- })
- ->with(new Toast(Toast::TYPE_ERROR), function (Browser $browser) {
- $browser->assertToastTitle('Error')
- ->assertToastMessage('Form validation error')
- ->closeToast();
+ ->assertFocused('#phone')
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
});
});
}
@@ -184,11 +176,7 @@
->waitForLocation('/profile/delete')
->click('#user-delete .button-delete')
->waitForLocation('/login')
- ->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('User deleted successfully.')
- ->closeToast();
- });
+ ->assertToast(Toast::TYPE_SUCCESS, 'User deleted successfully.');
$this->assertTrue($user->fresh()->trashed());
});
diff --git a/src/tests/Browser/UsersTest.php b/src/tests/Browser/UsersTest.php
--- a/src/tests/Browser/UsersTest.php
+++ b/src/tests/Browser/UsersTest.php
@@ -160,11 +160,7 @@
->type('#last_name', '')
->click('button[type=submit]');
})
- ->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('User data updated successfully')
- ->closeToast();
- });
+ ->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.');
// Test error handling (password)
$browser->with('@form', function (Browser $browser) {
@@ -173,12 +169,8 @@
->click('button[type=submit]')
->waitFor('#password + .invalid-feedback')
->assertSeeIn('#password + .invalid-feedback', 'The password confirmation does not match.')
- ->assertFocused('#password');
- })
- ->with(new Toast(Toast::TYPE_ERROR), function (Browser $browser) {
- $browser->assertToastTitle('Error')
- ->assertToastMessage('Form validation error')
- ->closeToast();
+ ->assertFocused('#password')
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
});
// TODO: Test password change
@@ -193,12 +185,8 @@
->with(new ListInput('#aliases'), function (Browser $browser) {
$browser->addListEntry('invalid address');
})
- ->click('button[type=submit]');
- })
- ->with(new Toast(Toast::TYPE_ERROR), function (Browser $browser) {
- $browser->assertToastTitle('Error')
- ->assertToastMessage('Form validation error')
- ->closeToast();
+ ->click('button[type=submit]')
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error');
})
->with('@form', function (Browser $browser) {
$browser->with(new ListInput('#aliases'), function (Browser $browser) {
@@ -212,12 +200,8 @@
$browser->removeListEntry(2)
->addListEntry('john.test@kolab.org');
})
- ->click('button[type=submit]');
- })
- ->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('User data updated successfully')
- ->closeToast();
+ ->click('button[type=submit]')
+ ->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.');
});
$john = User::where('email', 'john@kolab.org')->first();
@@ -282,12 +266,8 @@
->click('tbody tr:nth-child(4) td.selection input');
})
->assertMissing('@skus table + .hint')
- ->click('button[type=submit]');
- })
- ->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('User data updated successfully')
- ->closeToast();
+ ->click('button[type=submit]')
+ ->assertToast(Toast::TYPE_SUCCESS, 'User data updated successfully.');
});
$expected = ['activesync', 'groupware', 'mailbox', 'storage', 'storage', 'storage'];
@@ -380,15 +360,9 @@
->click('button[type=submit]')
->assertFocused('#password_confirmation')
->type('#password_confirmation', 'simple')
- ->click('button[type=submit]');
- })
- ->with(new Toast(Toast::TYPE_ERROR), function (Browser $browser) {
- $browser->assertToastTitle('Error')
- ->assertToastMessage('Form validation error')
- ->closeToast();
- })
- ->with('@form', function (Browser $browser) {
- $browser->assertSeeIn('#email + .invalid-feedback', 'The specified email is invalid.')
+ ->click('button[type=submit]')
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error')
+ ->assertSeeIn('#email + .invalid-feedback', 'The specified email is invalid.')
->assertSeeIn('#password + .invalid-feedback', 'The password confirmation does not match.');
});
@@ -399,17 +373,11 @@
->with(new ListInput('#aliases'), function (Browser $browser) {
$browser->addListEntry('invalid address');
})
- ->click('button[type=submit]');
- })
- ->with(new Toast(Toast::TYPE_ERROR), function (Browser $browser) {
- $browser->assertToastTitle('Error')
- ->assertToastMessage('Form validation error')
- ->closeToast();
- })
- ->with('@form', function (Browser $browser) {
- $browser->with(new ListInput('#aliases'), function (Browser $browser) {
- $browser->assertFormError(1, 'The specified alias is invalid.', false);
- });
+ ->click('button[type=submit]')
+ ->assertToast(Toast::TYPE_ERROR, 'Form validation error')
+ ->with(new ListInput('#aliases'), function (Browser $browser) {
+ $browser->assertFormError(1, 'The specified alias is invalid.', false);
+ });
});
// Successful account creation
@@ -420,11 +388,7 @@
})
->click('button[type=submit]');
})
- ->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('User created successfully')
- ->closeToast();
- })
+ ->assertToast(Toast::TYPE_SUCCESS, 'User created successfully.')
// check redirection to users list
->waitForLocation('/users')
->on(new UserList())
@@ -474,11 +438,7 @@
->with(new Dialog('#delete-warning'), function (Browser $browser) {
$browser->click('@button-action');
})
- ->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) {
- $browser->assertToastTitle('')
- ->assertToastMessage('User deleted successfully')
- ->closeToast();
- })
+ ->assertToast(Toast::TYPE_SUCCESS, 'User deleted successfully.')
->with('@table', function (Browser $browser) {
$browser->assertElementsCount('tbody tr', 4)
->assertSeeIn('tbody tr:nth-child(1) a', 'jack@kolab.org')
diff --git a/src/tests/TestCaseDusk.php b/src/tests/TestCaseDusk.php
--- a/src/tests/TestCaseDusk.php
+++ b/src/tests/TestCaseDusk.php
@@ -56,7 +56,7 @@
$options->setExperimentalOption('mobileEmulation', ['userAgent' => $ua]);
$options->addArguments(['--window-size=800,640']);
} else {
- $options->addArguments(['--window-size=2560,1440']);
+ $options->addArguments(['--window-size=1280,1024']);
}
// Make sure downloads dir exists and is empty