@api
Feature: Football Score Calculation
In order to calculate the score in a football match accurately
As a team manager
I need to assign goals to players in the match.
Background:
Given I am logged in as a user with the "Administrator" role
Scenario: Calculating the number of goals in a football match
Given I am at "node/add/match"
And for "title[0][value]" I enter "Dodgeball Championship"
And I press the "Add new statistic entity" button
And I wait for AJAX to finish
And I select the first autocomplete option for "Peter La Fleur" on the "Player" field
And I select the first autocomplete option for "Goal" on the "Match Event" field
And I press the "Create statistic entity" button
And I wait for AJAX to finish
And I select the first autocomplete option for "Globo Gym" on the "Away Team" field
And I select the first autocomplete option for "Average Joes" on the "Home Team" field
And I press the "Save" button
Then I should see the text "Home Team Score 1"
And I should see the text "Away Team Score 0"
I repeat the same steps manually and everything works as expected.
Almost certainly this is because the node is not saving, because of something about the interaction between Mink and your form. This extension doesn't do anything that could influence whether a presave hook fires.
Issue
When saving a node manually my xdebug fires for the node entity inside hook_entity_presave. Notice $entity is of type Node.
When I run my behat test the hook fires but not for the node entity. Only for the user entity. $entity is of type User.
As a result my behat test fails because the presave hook can't act on the Node entity.
Versions
Drupal version: Drupal 8.5.1
behat composer.json
Test
I repeat the same steps manually and everything works as expected.