Skip to content

Commit

Permalink
Acceptance test updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
joegl committed Oct 25, 2024
1 parent 19930c2 commit c4aca68
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,8 @@ public function testAuthenticatedUserRestrictions(AcceptanceTester $I) {
*/
public function testSiteManagerEscalationSelf(AcceptanceTester $I) {
$site_manager = $I->logInWithRole('site_manager');
$site_manager_id = $site_manager->id();
$I->amOnPage('/admin/users');
$I->canSee($site_manager->getDisplayName());
$I->click(['link' => $site_manager->getDisplayName()]);
$I->click('.roles.tabs__tab a');
$I->canSeeInCurrentUrl("/user/$site_manager_id/roles");
$I->amOnPage($site_manager->toUrl('edit-form')->toString());

$I->dontSee('Administrator');
$I->dontSee('Site Builder');
$I->dontSee('Site Developer');
Expand All @@ -95,11 +91,11 @@ public function testSiteManagerEscalationSelf(AcceptanceTester $I) {
* Site Manager cannot escalate others' role above Site Manager.
*/
public function testSiteManagerEscalationOthers(AcceptanceTester $I) {
$name = $this->faker->words(3, TRUE);
$user = $I->createEntity(['name' => $name], 'user');
$I->logInWithRole('site_manager');
$I->amOnPage('/admin/users');
$I->canSee('Morgan');
$I->click('Morgan');
$I->click('.roles.tabs__tab a');
$I->amOnPage($user->toUrl('edit-form')->toString());
$I->canSeeInField('Username', $name);
$I->dontSee('Administrator');
$I->dontSee('Site Builder');
$I->dontSee('Site Developer');
Expand Down Expand Up @@ -152,15 +148,14 @@ public function testPhpUploadInFavicon(AcceptanceTester $I) {
public function testPhpUploadInLogo(AcceptanceTester $I) {
$I->logInWithRole('administrator');
$I->amOnPage('/admin/appearance/settings');
// Uncheck "Use the logo supplied by the theme" checkbox.
$I->seeCheckboxIsChecked('#edit-default-logo');
$I->uncheckOption('#edit-default-logo');
$I->see('Upload logo image');
$I->attachFile('Upload logo image', 'injection.php');
// Click "Save Configuration" button.
$I->click('#edit-submit');
$I->see('Only files with the following extensions are allowed');
$I->see('The image file is invalid or the image type is not allowed.');
$I->checkOption('#edit-default-logo');
$I->click('#edit-submit');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public function testDeletedMenuItems(AcceptanceTester $I) {
$I->canSeeLink($node_title, $node->toUrl()->toString());

$I->amOnPage($node->toUrl('delete-form')->toString());
$I->click('Delete');
$I->click('Delete', 'form');
$I->canSee('has been deleted');

$I->amOnPage('/');
$I->cantSeeLink($node_title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Test the events + importer functionality.
*
* @group content
* @group events
*/
class EventsCest {

Expand Down Expand Up @@ -84,8 +85,7 @@ public function testListIntro(AcceptanceTester $I) {
$I->click('Save');
$I->canSee('Events Importer has been', '.messages-list');

$I->amOnPage($event->toUrl('delete-form')->toString());
$I->click('Delete');
$event->delete();

$I->amOnPage($term->toUrl()->toString());
$I->canSee($term->label(), 'h1');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Test the news functionality.
*
* @group content
* @group news
*/
class NewsCest {

Expand Down Expand Up @@ -102,9 +103,10 @@ public function testXMLMetaDataRevisions(AcceptanceTester $I) {

// Revision Delete is enabled.
$I->amOnPage('/admin/structure/types/manage/stanford_news');
$I->seeCheckboxIsChecked("#edit-node-revision-delete-track");
$I->seeCheckboxIsChecked("#edit-options-revision");
$I->seeInField("#edit-minimum-revisions-to-keep", 5);
// "Delete revisions when a certain amount of revisions is reached."
// settings.
$I->seeCheckboxIsChecked("#edit-amount-status");
$I->seeInField("#edit-amount-settings-amount", 5);

// XML Sitemap.
$I->amOnPage("/admin/config/search/xmlsitemap/settings");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Test the news functionality.
*
* @group content
* @group person
*/
class PersonCest {

Expand Down Expand Up @@ -96,9 +97,10 @@ public function testXMLMetaDataRevisions(AcceptanceTester $I) {

// Revision Delete is enabled.
$I->amOnPage('/admin/structure/types/manage/stanford_person');
$I->seeCheckboxIsChecked('#edit-node-revision-delete-track');
$I->seeCheckboxIsChecked('#edit-options-revision');
$I->seeInField('#edit-minimum-revisions-to-keep', 5);
// "Delete revisions when a certain amount of revisions is reached."
// settings.
$I->seeCheckboxIsChecked("#edit-amount-status");
$I->seeInField("#edit-amount-settings-amount", 5);

// XML Sitemap.
$I->amOnPage('/admin/config/search/xmlsitemap/settings');
Expand Down Expand Up @@ -176,6 +178,7 @@ public function testD8Core2613Terms(AcceptanceTester $I) {
$I->selectOption('Parent term', '<root>');
$I->click('Save');
$I->amOnPage('/user/logout');
$I->click('Log out', 'form');

$I->amOnPage('/people');
$I->canSeeLink($term3->label());
Expand All @@ -185,6 +188,7 @@ public function testD8Core2613Terms(AcceptanceTester $I) {
$I->selectOption('Parent term', $term2->label());
$I->click('Save');
$I->amOnPage('/user/logout');
$I->click('Log out', 'form');

$I->amOnPage('/people');
$I->cantSeeLink($term3->label());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

/**
* Test the node revision delete module functionality.
*
* @group contrib
* @group node_revision_delete
*/
class NodeRevisionDeleteCest {

Expand Down Expand Up @@ -42,7 +45,7 @@ public function testNodeRevisionDelete(AcceptanceTester $I) {
$I->amOnPage("/node/{$node->id()}/revisions");
$I->canSeeNumberOfElements('.diff-revisions tbody tr', 11);

$I->runDrush('cron:run node_revision_delete_cron --force');
$I->runDrush('queue:run node_revision_delete');
$I->amOnPage("/node/{$node->id()}/revisions");
$I->canSeeNumberOfElements('.diff-revisions tbody tr', 5);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testBulkEdits(AcceptanceTester $I) {
$I->checkOption('Publication Types (value 1)');
$I->selectOption('node[stanford_publication][su_publication_topics][0][target_id]', $pubs_foo_bar_baz->id());
$I->click('Apply');
$I->canSee('Action processing results');
$I->canSee('Modify field values', '.messages-list');

foreach ($this->nodes as $node) {
$I->amOnPage($node->toUrl('edit-form')->toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

/**
* Tests for various media functionality.
*
* @group media
*/
class MediaCest {

Expand Down Expand Up @@ -241,7 +243,7 @@ public function testDeleteFiles(AcceptanceTester $I) {
$I->canSee('Are you sure you wish to perform');
$I->canSee($this->filePath);
$I->click('Execute action');
$I->canSee('Action processing results: Delete entities');
$I->canSee('Delete entities');
$I->amOnPage('/admin/content/files');
$I->cantSee($this->filePath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testBulkDeleteHomePage(FunctionalTester $I) {
$I->selectOption('Action', 'Delete selected entities');
$I->click('Apply to selected items');
$I->click('Execute action');
$I->waitForText('Action processing results');
$I->waitForText('Delete entities');
$I->canSee('Access denied (1)');
$I->runDrush('cache-rebuild');
$I->amOnPage('/');
Expand Down

0 comments on commit c4aca68

Please sign in to comment.