Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/DistlistTest.php
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | public function testCreateUpdateDelete(): void | ||||
->assertSeeIn('div.row:nth-child(2) label', 'Email') | ->assertSeeIn('div.row:nth-child(2) label', 'Email') | ||||
->assertValue('div.row:nth-child(2) input[type=text]', '') | ->assertValue('div.row:nth-child(2) input[type=text]', '') | ||||
->assertSeeIn('div.row:nth-child(3) label', 'Recipients') | ->assertSeeIn('div.row:nth-child(3) label', 'Recipients') | ||||
->assertVisible('div.row:nth-child(3) .list-input') | ->assertVisible('div.row:nth-child(3) .list-input') | ||||
->with(new ListInput('#members'), function (Browser $browser) { | ->with(new ListInput('#members'), function (Browser $browser) { | ||||
$browser->assertListInputValue([]) | $browser->assertListInputValue([]) | ||||
->assertValue('@input', ''); | ->assertValue('@input', ''); | ||||
}) | }) | ||||
->assertSeeIn('div.row:nth-child(4) label', 'Subscriptions') | |||||
->with('@skus', function ($browser) { | |||||
$browser->assertElementsCount('tbody tr', 1) | |||||
->assertSeeIn('tbody tr:nth-child(1) td.name', 'Group') | |||||
->assertSeeIn('tbody tr:nth-child(1) td.price', '0,00 CHF/month') | |||||
->assertChecked('tbody tr:nth-child(1) td.selection input') | |||||
->assertDisabled('tbody tr:nth-child(1) td.selection input') | |||||
->assertTip( | |||||
'tbody tr:nth-child(1) td.buttons button', | |||||
'Distribution list' | |||||
); | |||||
}) | |||||
->assertSeeIn('button[type=submit]', 'Submit'); | ->assertSeeIn('button[type=submit]', 'Submit'); | ||||
}) | }) | ||||
// Test error conditions | // Test error conditions | ||||
->type('#name', str_repeat('A', 192)) | ->type('#name', str_repeat('A', 192)) | ||||
->type('#email', 'group-test@kolabnow.com') | ->type('#email', 'group-test@kolabnow.com') | ||||
->click('@general button[type=submit]') | ->click('@general button[type=submit]') | ||||
->waitFor('#members + .invalid-feedback') | ->waitFor('#members + .invalid-feedback') | ||||
->assertSeeIn('#email + .invalid-feedback', 'The specified domain is not available.') | ->assertSeeIn('#email + .invalid-feedback', 'The specified domain is not available.') | ||||
Show All 27 Lines | public function testCreateUpdateDelete(): void | ||||
->assertSeeIn('div.row:nth-child(3) label', 'Email') | ->assertSeeIn('div.row:nth-child(3) label', 'Email') | ||||
->assertValue('div.row:nth-child(3) input[type=text]:disabled', 'group-test@kolab.org') | ->assertValue('div.row:nth-child(3) input[type=text]:disabled', 'group-test@kolab.org') | ||||
->assertSeeIn('div.row:nth-child(4) label', 'Recipients') | ->assertSeeIn('div.row:nth-child(4) label', 'Recipients') | ||||
->assertVisible('div.row:nth-child(4) .list-input') | ->assertVisible('div.row:nth-child(4) .list-input') | ||||
->with(new ListInput('#members'), function (Browser $browser) { | ->with(new ListInput('#members'), function (Browser $browser) { | ||||
$browser->assertListInputValue(['test1@gmail.com', 'test2@gmail.com']) | $browser->assertListInputValue(['test1@gmail.com', 'test2@gmail.com']) | ||||
->assertValue('@input', ''); | ->assertValue('@input', ''); | ||||
}) | }) | ||||
->assertSeeIn('div.row:nth-child(5) label', 'Subscriptions') | |||||
->with('@skus', function ($browser) { | |||||
$browser->assertElementsCount('tbody tr', 1) | |||||
->assertSeeIn('tbody tr:nth-child(1) td.name', 'Group') | |||||
->assertSeeIn('tbody tr:nth-child(1) td.price', '0,00 CHF/month') | |||||
->assertChecked('tbody tr:nth-child(1) td.selection input') | |||||
->assertDisabled('tbody tr:nth-child(1) td.selection input') | |||||
->assertTip( | |||||
'tbody tr:nth-child(1) td.buttons button', | |||||
'Distribution list' | |||||
); | |||||
}) | |||||
->assertSeeIn('button[type=submit]', 'Submit'); | ->assertSeeIn('button[type=submit]', 'Submit'); | ||||
}) | }) | ||||
// Test error handling | // Test error handling | ||||
->with(new ListInput('#members'), function (Browser $browser) { | ->with(new ListInput('#members'), function (Browser $browser) { | ||||
$browser->addListEntry('invalid address'); | $browser->addListEntry('invalid address'); | ||||
}) | }) | ||||
->click('@general button[type=submit]') | ->click('@general button[type=submit]') | ||||
->waitFor('#members + .invalid-feedback') | ->waitFor('#members + .invalid-feedback') | ||||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |