Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F120822620
SupportTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
SupportTest.php
View Options
<?php
namespace
Tests\Browser
;
use
Tests\Browser
;
use
Tests\Browser\Components\Dialog
;
use
Tests\Browser\Components\Menu
;
use
Tests\Browser\Components\Toast
;
use
Tests\TestCaseDusk
;
class
SupportTest
extends
TestCaseDusk
{
/**
* Test support contact form
*/
public
function
testSupportForm
():
void
{
$this
->
browse
(
static
function
(
Browser
$browser
)
{
$browser
->
withConfig
([
'app.support_email'
=>
""
])
->
visit
(
'/'
)
->
within
(
new
Menu
(),
static
function
(
$browser
)
{
$browser
->
clickMenuItem
(
'support'
);
})
->
waitFor
(
'#support'
)
->
assertElementsCount
(
'.card-title'
,
2
)
->
with
(
'.row .col:last-child'
,
static
function
(
$card
)
{
$card
->
assertSeeIn
(
'.card-title'
,
'Contact Support'
)
->
assertSeeIn
(
'.btn-primary'
,
'Contact Support'
)
->
click
(
'.btn-primary'
);
})
->
with
(
new
Dialog
(
'#support-dialog'
),
static
function
(
Browser
$browser
)
{
$browser
->
assertSeeIn
(
'@title'
,
'Contact Support'
)
->
assertFocused
(
'#support-user'
)
->
assertSeeIn
(
'@button-cancel'
,
'Cancel'
)
->
assertSeeIn
(
'@button-action'
,
'Submit'
)
->
assertVisible
(
'#support-name'
)
->
assertVisible
(
'#support-email'
)
->
assertVisible
(
'#support-summary'
)
->
assertVisible
(
'#support-body'
)
->
type
(
'#support-email'
,
'email@address.com'
)
->
type
(
'#support-summary'
,
'Summary'
)
->
type
(
'#support-body'
,
'Body'
)
->
click
(
'@button-cancel'
);
})
->
assertMissing
(
'#support-dialog'
)
->
with
(
'.row .col:last-child'
,
static
function
(
$card
)
{
$card
->
click
(
'.btn-primary'
);
})
->
with
(
new
Dialog
(
'#support-dialog'
),
static
function
(
Browser
$browser
)
{
$browser
->
assertSeeIn
(
'@title'
,
'Contact Support'
)
->
assertFocused
(
'#support-user'
)
->
assertValue
(
'#support-email'
,
'email@address.com'
)
->
assertValue
(
'#support-summary'
,
'Summary'
)
->
assertValue
(
'#support-body'
,
'Body'
)
->
click
(
'@button-action'
);
})
->
assertToast
(
Toast
::
TYPE_ERROR
,
'Failed to submit the support request'
)
->
assertVisible
(
'#support-dialog'
);
});
}
/**
* Test disabled support contact form
*/
public
function
testNoSupportForm
():
void
{
$this
->
browse
(
static
function
(
Browser
$browser
)
{
$browser
->
withConfig
([
'app.support_email'
=>
null
])
->
visit
(
'/'
)
->
within
(
new
Menu
(),
static
function
(
$browser
)
{
$browser
->
clickMenuItem
(
'support'
);
})
->
waitFor
(
'#support'
)
->
assertElementsCount
(
'.card-title'
,
1
)
->
assertSeeIn
(
'.card-title'
,
'Documentation'
)
->
assertSeeIn
(
'.btn-primary'
,
'Search Knowledgebase'
);
});
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Apr 24, 9:53 AM (1 w, 21 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18847492
Default Alt Text
SupportTest.php (3 KB)
Attached To
Mode
rK kolab
Attached
Detach File
Event Timeline