Overview
We added #3489354: Connect the "Publish" button with the entity update controller we didn't add test probably because this button is temporary. Until we have the "Publish All" button that is being worked on various issues
But this is our only really way to test actual saving from the front-end. Therefore for front-end to back end entity conversion we don't have full test coverage.
Although the "Publish" button is temporary until #3497530: Implement the "Publish All" button. We changed ApiContentUpdateForDemoController in #3493889: Change ApiContentUpdateForDemoController to save from auto-save instead of request data to work the same way that ApiPublishAllController. Therefore it would probably find a lot of the same bugs as the final "Publish all" button would hit.
a couple of example of bugs found in manual testing
- We have
ClientDataToEntityConverterTestbut we just make up what we think front-end data will be. for instance #3495752: Send page data to Drupal for storage in auto-save store changes this test and it passes but when I actually test the functionality with the Publish button it errors out with violations such as- The current user is not allowed to update the field 'changed'.
- Field field_image_0_upload_button is unknown.
If we already had a e2e test for the "Publish" button presumably it would have just started to fail rather than only being able to find this via manual testing or completely missing it
- Using "Publish" button when Drupalicon component is placed. gets
AssertionError: assert(str_starts_with($value, '{')) in assert() (line 66 of /Users/ted.bowman/sites/exp-d-core/modules/contrib/experience_builder/src/Plugin/DataType/ComponentPropsValues.php).
#0 /Users/ted.bowman/sites/exp-d-core/modules/contrib/experience_builder/src/Plugin/DataType/ComponentPropsValues.php(66): assert(false, 'assert(str_star...')
#1 /Users/ted.bowman/sites/exp-d-core/core/lib/Drupal/Core/Field/FieldItemBase.php(139): Drupal\experience_builder\Plugin\DataType\ComponentPropsValues->setValue('[]', false)
#2 /Users/ted.bowman/sites/exp-d-core/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php(134): Drupal\Core\Field\FieldItemBase->writePropertyValue('props', '[]')
#3 /Users/ted.bowman/sites/exp-d-core/modules/contrib/experience_builder/src/Plugin/Field/FieldType/ComponentTreeItem.php(225): Drupal\Core\TypedData\Plugin\DataType\Map->set('props', '[]', false)
#4 /Users/ted.bowman/sites/exp-d-core/modules/contrib/experience_builder/src/ClientDataToEntityConverter.php(36): Drupal\experience_builder\Plugin\Field\FieldType\ComponentTreeItem->setValue(Array)
#5 /Users/ted.bowman/sites/exp-d-core/modules/contrib/experience_builder/src/Controller/ApiContentUpdateForDemoController.php(36): Drupal\experience_builder\ClientDataToEntityConverter->convert(Array, Object(Drupal\node\Entity\Node))
#6 [internal function]: Drupal\experience_builder\Controller\ApiContentUpdateForDemoController->__invoke(Object(Drupal\node\Entity\Node))
#7 /Users/ted.bowman/sites/exp-d-core/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Object(Drupal\experience_builder\Controller\ApiContentUpdateForDemoController), Array)
#8 /Users/ted.bowman/sites/exp-d-core/core/lib/Drupal/Core/Render/Renderer.php(593): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#9 /Users/ted.bowman/sites/exp-d-core/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#10 /Users/ted.bowman/sites/exp-d-core/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Object(Drupal\experience_builder\Controller\ApiContentUpdateForDemoController), Array)
Proposed resolution
Create a very basic test for the "Publish" button that
adds 1 component
presses the "Publish button"
loads the node view. (node/1)
confirms the component is visible
User interface changes
Issue fork experience_builder-3498219
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
Comment #2
wim leersComment #4
callumharrod commentedComment #6
callumharrod commentedComment #7
callumharrod commentedHey @tedbow this could do with a review please 😊
Comment #8
tedbowComment #9
tedbowI updated the issue summary to change the scope of the test to be more inline with my new comments on the MR
Comment #10
tedbowI chatted to @callumharrod about this I am going to push up some debug cod to see what is failing on the server side
Comment #11
tedbow@callumharrod I pushed an idea I think could work but I don't have much experience with Cypress. will comment on the MR
Comment #12
tedbowIt was not failing locally because the requirements for validating openapi.yml are not installed, composer require league/openapi-psr7-validator webflo/drupal-finder devizzent/cebe-php-openapi --dev
if I install them locally it fails. These are installed on gitlab ci
I fixed this and am opening a follow-up issue
Comment #13
tedbowComment #14
tedbowComment #15
tedbowI assigned @traviscarden to review because we needed openapi.yml changes but now those have been fixed in #3499649: openapi.yml #/components/schemas/LayoutPreview should require properties
So @jessebaker and myself already approved this
Comment #16
tedbowcomponent-operations.cy.jsfailed but since we just added a new test I can't see how this is relatedretesting
Comment #18
tedbowI merged this because it was random fail in another e2e test. Since this MR adds 1 new e2e test, not failing, I think it is fine to go in.
Will make an issue listing known random e2e tests