Improve automated functional acceptance testing with user roles
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3591668. --> Reported by: [rajab natshah](https://www.drupal.org/user/1414312) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>This issue improves the automated functional acceptance testing of the Web Releases module so that every default role on the Standard profile is exercised end-to-end, and the rest of the module is tightened up around real-world product / release content.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Changes Acceptance test suite &mdash; role-based, UI-driven</p> <ul> <li><code>cucumber.js</code> registers a <code>worldParameters.users</code> fixture for every default role on the Standard<br> profile &mdash; <em>Webmaster</em> (site-install super-admin), <em>Content editor</em>, <em>Authenticated user</em> &mdash; matching the<br> pattern used by the Webpage and Webblog modules.</li> <li>New custom step definitions in <code>tests/step-definitions/webreleases.steps.js</code>: <ul> <li><code>Given I am a logged in user with the "Webmaster" user</code> &mdash; log in as any registered fixture.</li> <li><code>Given I add testing users</code> &mdash; provisions the non-admin fixtures via <code>/admin/people/create</code><br> (idempotent).</li> <li><code>Given the product "X" has N releases</code> / <code>Given the product "X" has the following releases:</code> &mdash;<br> seed products and releases purely through the Drupal UI (no shell, no PHP).</li> <li><code>Then I should see N "&amp;lt;selector&amp;gt;" elements</code>, <code>When I log out</code>,<br> <pre>When I select "X" from<br>&nbsp; the "Product" autocomplete</pre><p>.</p></li> </ul> </li> <li>Feature files reorganised so the suite reads as a numbered acceptance plan: <ol> <li><code>01-01-01-users-login.feature</code></li> <li><code>02-01-01-product-content.feature</code></li> <li><code>02-02-01-product-and-release-life-cycle.feature</code></li> <li><code>03-01-01-release-content.feature</code></li> <li><code>03-02-01-releases-view.feature</code></li> <li><code>03-02-02-releases-pagination.feature</code></li> <li><code>03-03-01-releases-advanced-seeding.feature</code></li> <li><code>04-01-01-role-access-matrix.feature</code></li> <li><code>05-01-01-recipe-and-views-thorough.feature</code></li> </ol> </li> <li>The role-access matrix verifies, for every role and the anonymous user, who can reach the product / release add forms, the<br> content admin listing, the content-type settings, the products listing and per-product release pages, plus that anonymous users<br> can view published products and releases.</li> <li>Release content covers Semantic Versioning 2.0.0 channels &mdash; alpha, beta, rc and stable &mdash; in one scenario per product.</li> <li>Final result: <strong>46 scenarios, 277 steps, all green</strong>.</li> </ul> <h3>Module &mdash; config-driven release label</h3> <ul> <li>Each release display (<em>default</em>, <em>teaser</em>, <em>full</em>) places <code>field_product</code><br> (entity_reference_label, label hidden, linked to the product) immediately before the title field in its Layout Builder<br> section.</li> <li>Editors store only the SemVer-style version in the release title (e.g. <code>1.0.0-alpha.1</code>); the linked product name<br> shows next to it at render time. No <code>.module</code> file is needed.</li> </ul> <h3>Module &mdash; view smart-slug resolution</h3> <ul> <li>New <code>WebReleasesProductPathProcessor</code> rewrites <code>/products/&amp;lt;slug&amp;gt;/releases</code> to<br> <code>/products/&amp;lt;nid&amp;gt;/releases</code> before routing.</li> <li>Slug resolution: (1) path alias, (2) exact title match, (3) dash / underscore replaced with space.</li> <li><code>views.view.releases.yml</code> contextual filter switched from a title-string match to a numeric<br> <code>field_product</code> target_id match. Editors can now name products <em>Webship-JS</em> (literal dash slug), <em>Webshop<br> Portal</em> (space-to-dash slug), <em>Drupal CMS</em> (multi-word) or <em>webship_js</em> (underscore) and the per-product release<br> page resolves correctly.</li> </ul> <h3>Recipe</h3> <ul> <li><code>recipes/default/recipe.yml</code> adds <code>menu_link_content</code> to the install list.</li> <li><code>recipes/default/config/core.entity_form_display.node.release.default.yml</code> adds <code>field_release_link</code><br> so editors can fill the Release Link field.</li> <li>Default content slimmed to the Products landing webpage (Layout Builder: page title, body, products view block) and a<br> main-menu link to <code>/products</code>. All sample product / release nodes removed &mdash; tests seed their own content.</li> </ul> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <ul> <li>&#9989; File an issue</li> <li>&#9989; Addition/Change/Update/Fix</li> <li>&#9989; Merge request, Patch, or Commit</li> <li>&#9989; Testing to ensure no regression</li> <li>&#9989; Automated unit testing coverage</li> <li>&#9989; Automated functional testing coverage</li> <li>&#10134; UX/UI designer responsibilities</li> <li>&#10134; Readability</li> <li>&#10134; Accessibility</li> <li>&#10134; Performance</li> <li>&#10134; Security</li> <li>&#10134; Documentation</li> <li>&#9989; Code review by maintainers</li> <li>&#9989; Full testing and approval</li> <li>&#9989; Credit contributors</li> <li>&#9989; Review with the product owner</li> <li>&#9989; Release notes snippet</li> <li>&#9989; Release <a href="https://www.drupal.org/project/webreleases/releases/11.0.1">webreleases-11.0.1</a></li> </ul> <h3 id="summary-ui-changes">User interface changes</h3> <ul> <li>N/A</li> </ul> <h3 id="summary-api-changes">API changes</h3> <ul> <li>N/A</li> </ul> <h3 id="summary-data-model-changes">Data model changes</h3> <ul> <li>N/A</li> </ul> <h3 id="summary-release-notes">Release notes snippet</h3> <ul> <li>ci: <a href="https://www.drupal.org/i/3591668">#3591668</a> Improve automated functional acceptance testing with user roles</li> </ul>
issue