Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"drush generate test:browser" no longer generates a passing test by default #5864

Closed
ultimike opened this issue Feb 8, 2024 · 3 comments
Closed

Comments

@ultimike
Copy link

ultimike commented Feb 8, 2024

Describe the bug
At some point in the not-too-distant past, the boilerplate code that drush generate test:browser generated passed without making any changes. I'm pretty sure that it was passing within the last 6 months.

But, when I tried to run the tests as-is today, the test failed. I'm pretty sure this is due to a change to Drupal core code, but I have been unsuccessful so far in tracking it down.

I did figure out (with the help of some of my students) that if the $admin_user is given an additional permission, then the test passes:

Before (test fails):

$admin_user = $this->drupalCreateUser(['access administration pages]);

After (test passes):

$admin_user = $this->drupalCreateUser([
      'access administration pages',
      'administer site configuration',
    ]);

I'm pretty sure that the administer site configuration permission needs to be added to the drush generate test:browser output, but what I'd really like is to figure out exactly why it is now needed. The route for the 'admin' path indicates that only the "access administration pages" permission is required. From system.routing.yml:

  path: '/admin'
  defaults:
    _controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
    _title: 'Administration'
  requirements:
    _permission: 'access administration pages'

I'm going to continue to research why this permission is now required - if I find anything I'll add it in a comment below.

To Reproduce
Run drush generate test:browser in a Drupal 10.2.3 environment and run the test. It will fail.

Expected behavior
What did you expect would happen?

Actual behavior
What happened instead?

Workaround
Is there another way to do the desired action?

System Configuration

Q A
Drush version? 12.4.3
Drupal version? 10.2.3
PHP version 8.1.18
OS? Linux
@ultimike
Copy link
Author

ultimike commented Feb 8, 2024

Someone helped me find a core issue that might explain what is going on: https://www.drupal.org/project/drupal/issues/3413508

I'll test the patch in the AM and report back.

@ultimike
Copy link
Author

ultimike commented Feb 8, 2024

I lied - I just tested the patch and it works. I don't think any change is necessary here. 👍

@ultimike ultimike closed this as completed Feb 8, 2024
@weitzman
Copy link
Member

weitzman commented Feb 8, 2024

Thanks for tracking that down ... FYI, generate issues should actually be filed upstream at https://github.com/Chi-teck/drupal-code-generator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants