2018-05-18 12:46:42 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Faker\Generator;
|
|
|
|
|
2023-06-01 15:27:04 +00:00
|
|
|
#[\AllowDynamicProperties]
|
2018-05-18 12:46:42 +00:00
|
|
|
class CasesCest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var Generator $fakeData
|
|
|
|
*/
|
|
|
|
protected $fakeData;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var integer $fakeDataSeed
|
|
|
|
*/
|
|
|
|
protected $fakeDataSeed;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param AcceptanceTester $I
|
|
|
|
*/
|
|
|
|
public function _before(AcceptanceTester $I)
|
|
|
|
{
|
|
|
|
if (!$this->fakeData) {
|
|
|
|
$this->fakeData = Faker\Factory::create();
|
|
|
|
}
|
|
|
|
|
2019-08-05 15:31:26 +00:00
|
|
|
$this->fakeDataSeed = mt_rand(0, 2048);
|
2018-05-18 12:46:42 +00:00
|
|
|
$this->fakeData->seed($this->fakeDataSeed);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param \AcceptanceTester $I
|
|
|
|
* @param \Step\Acceptance\ListView $listView
|
|
|
|
*
|
|
|
|
* As an administrator I want to view the cases module.
|
|
|
|
*/
|
|
|
|
public function testScenarioViewCasesModule(
|
|
|
|
\AcceptanceTester $I,
|
2019-06-28 17:30:37 +00:00
|
|
|
\Step\Acceptance\ListView $listView
|
2018-05-18 12:46:42 +00:00
|
|
|
) {
|
|
|
|
$I->wantTo('View the cases module for testing');
|
|
|
|
|
|
|
|
// Navigate to cases list-view
|
|
|
|
$I->loginAsAdmin();
|
Change more gotoModule functions to visitPage.
Convert Campaigns, Cases, Documents, Events, Invoices, Leads,
Meetings, Notes, Product Categories, Products, and Tasks.
2019-06-26 18:15:56 +00:00
|
|
|
$I->visitPage('Cases', 'index');
|
2018-05-18 12:46:42 +00:00
|
|
|
$listView->waitForListViewVisible();
|
|
|
|
|
|
|
|
$I->see('Cases', '.module-title-text');
|
|
|
|
}
|
2018-05-22 02:24:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param \AcceptanceTester $I
|
|
|
|
* @param \Step\Acceptance\DetailView $detailView
|
|
|
|
* @param \Step\Acceptance\ListView $listView
|
|
|
|
* @param \Step\Acceptance\Cases $cases
|
|
|
|
* @param \Step\Acceptance\Cases $account
|
|
|
|
*
|
|
|
|
* As administrative user I want to create a case so that I can test
|
|
|
|
* the standard fields.
|
|
|
|
*/
|
|
|
|
public function testScenarioCreateCase(
|
|
|
|
\AcceptanceTester $I,
|
|
|
|
\Step\Acceptance\DetailView $detailView,
|
|
|
|
\Step\Acceptance\ListView $listView,
|
|
|
|
\Step\Acceptance\Cases $cases,
|
2019-07-25 12:00:22 +00:00
|
|
|
\Step\Acceptance\AccountsTester $account
|
2018-05-22 02:24:23 +00:00
|
|
|
) {
|
|
|
|
$I->wantTo('Create a Case');
|
|
|
|
|
|
|
|
// Navigate to accounts list-view
|
|
|
|
$I->loginAsAdmin();
|
2019-06-26 18:00:31 +00:00
|
|
|
$I->visitPage('Accounts', 'index');
|
2018-05-22 02:24:23 +00:00
|
|
|
$listView->waitForListViewVisible();
|
|
|
|
|
|
|
|
// Create account
|
|
|
|
$this->fakeData->seed($this->fakeDataSeed);
|
|
|
|
$account_name = 'Test_'. $this->fakeData->company();
|
|
|
|
$account->createAccount($account_name);
|
|
|
|
|
2018-05-22 15:57:04 +00:00
|
|
|
// Navigate to cases list-view
|
Change more gotoModule functions to visitPage.
Convert Campaigns, Cases, Documents, Events, Invoices, Leads,
Meetings, Notes, Product Categories, Products, and Tasks.
2019-06-26 18:15:56 +00:00
|
|
|
$I->visitPage('Cases', 'index');
|
2018-05-22 15:57:04 +00:00
|
|
|
$listView->waitForListViewVisible();
|
|
|
|
|
|
|
|
// Create case
|
|
|
|
$this->fakeData->seed($this->fakeDataSeed);
|
|
|
|
$cases->createCase('Test_'. $this->fakeData->company(), $account_name);
|
|
|
|
|
|
|
|
// Delete case
|
|
|
|
$detailView->clickActionMenuItem('Delete');
|
|
|
|
$detailView->acceptPopup();
|
|
|
|
$listView->waitForListViewVisible();
|
|
|
|
|
2018-05-22 02:24:23 +00:00
|
|
|
// Delete account
|
2019-06-26 18:00:31 +00:00
|
|
|
$I->visitPage('Accounts', 'index');
|
2018-05-22 02:24:23 +00:00
|
|
|
$listView->waitForListViewVisible();
|
|
|
|
$listView->clickFilterButton();
|
2018-05-22 09:32:08 +00:00
|
|
|
$I->fillField('#name_basic', $account_name);
|
|
|
|
$I->click('#search_form_submit');
|
2018-05-22 02:24:23 +00:00
|
|
|
$listView->waitForListViewVisible();
|
2018-05-22 14:30:10 +00:00
|
|
|
$listView->clickNameLink($account_name);
|
2018-05-22 02:24:23 +00:00
|
|
|
$detailView->waitForDetailViewVisible();
|
|
|
|
$detailView->clickActionMenuItem('Delete');
|
|
|
|
$detailView->acceptPopup();
|
|
|
|
$listView->waitForListViewVisible();
|
|
|
|
}
|
2018-12-20 13:04:52 +00:00
|
|
|
}
|