Skip to content

Commit

Permalink
Implement a test for adding a schedule.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbillion committed Jan 17, 2024
1 parent 9b45425 commit 8842549
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ public function amOnCronEventListingPage() {
return $this->amOnAdminPage( 'tools.php?page=crontrol_admin_manage_page' );
}

/**
* Go to the cron schedule listing page in the admininstration area of the site.
*
* @return string The admin page path.
*/
public function amOnCronScheduleListingPage() {
return $this->amOnAdminPage( 'options-general.php?page=crontrol_admin_options_page' );
}

/**
* Create a cron event to work with.
*
Expand Down
31 changes: 31 additions & 0 deletions tests/acceptance/AddScheduleCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* Acceptance tests for adding cron schedules.
*/

/**
* Test class.
*/
class AddScheduleCest {
public function _before( AcceptanceTester $I ) {
$I->loginAsAdmin();
}

public function NavigatingToTheAddCronSchedulesScreen( AcceptanceTester $I ) {
$I->amOnCronScheduleListingPage();
$I->see( 'Cron Schedules', '#crontrol-header' );
$I->see( 'Cron Schedules', 'h1' );
$I->see( 'Add Cron Schedule', 'h2' );
}

public function AddingANewSchedule( AcceptanceTester $I ) {
$I->amOnCronScheduleListingPage();
$I->fillField( 'Internal Name', 'my_schedule_name' );
$I->fillField( 'Interval (seconds)', '123' );
$I->fillField( 'Display Name', 'My Schedule Name' );
$I->click( 'Add Cron Schedule' );
$I->see( 'Cron Schedules', '#crontrol-header' );
$I->see( 'Cron Schedules', 'h1' );
$I->seeAdminSuccessNotice( 'Added the cron schedule my_schedule_name.' );
}
}

0 comments on commit 8842549

Please sign in to comment.