Problem/Motivation

\Drupal\Tests\workspaces\Functional\WorkspaceTestUtilities::createNodeThroughUi exists to test creating nodes by clicking buttons. There may be instances where this is worth testing in the workspaces context, but doing this in a for loop 50 times is excessive and wasteful.

Steps to reproduce

$ grep -r createNodeThroughUi core/modules/workspaces

Proposed resolution

Convert all of them to use $this->drupalCreateNode().

Add one explicit test to verify nodes created via the UI when a workspace is active is assigned to that workspace.

Remaining tasks

Consider doing the same for \Drupal\Tests\workspaces\Functional\WorkspaceTestUtilities::createAndActivateWorkspaceThroughUi

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3612413

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mstrelan created an issue. See original summary.

mstrelan’s picture

Status: Active » Needs work

Here's a start, feel free to pick this up and convert the rest.

mstrelan’s picture

Issue summary: View changes
Status: Needs work » Needs review
mstrelan’s picture

Issue tags: +Test suite performance
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Ran the grep provided $ grep -r createNodeThroughUi core/modules/workspaces

core/modules/workspaces/tests/src/Functional/WorkspaceTestUtilities.php: protected function createNodeThroughUi($label, string $bundle, $publish = TRUE) {
core/modules/workspaces/tests/src/Functional/WorkspaceTest.php: $node = $this->createNodeThroughUi('Test', 'test');

So seems you got all instances, unless I'm missing something.

May be a follow up but do we "want" a createNodeThroughUi function? May be worth dropping.

mstrelan’s picture

So seems you got all instances, unless I'm missing something.

May be a follow up but do we "want" a createNodeThroughUi function? May be worth dropping.

I replaced all instances, but added a new instance, because I believe there is some merit in explicitly testing this, and all existing instances were implicit.

  • amateescu committed 3408229e on 11.x
    task: #3612413 Workspaces tests use createNodeThroughUi excessively
    
    By...

  • amateescu committed f668443b on main
    task: #3612413 Workspaces tests use createNodeThroughUi excessively
    
    By...
amateescu’s picture

Version: main » 11.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed f668443b84d to main and 3408229e85d to 11.x. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.