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 ClientDataToEntityConverterTest but 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
    1. The current user is not allowed to update the field 'changed'.
    2. 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

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

tedbow created an issue. See original summary.

wim leers’s picture

Title: Missing e2e for Publish button hides bugs » Missing E2E test for Publish button hides bugs
Issue tags: +Needs tests, +DX (Developer Experience)

callumharrod made their first commit to this issue’s fork.

callumharrod’s picture

Assigned: Unassigned » callumharrod

callumharrod’s picture

Assigned: callumharrod » Unassigned
Status: Active » Needs review
callumharrod’s picture

Hey @tedbow this could do with a review please 😊

tedbow’s picture

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

I updated the issue summary to change the scope of the test to be more inline with my new comments on the MR

tedbow’s picture

Assigned: Unassigned » tedbow

I chatted to @callumharrod about this I am going to push up some debug cod to see what is failing on the server side

tedbow’s picture

Assigned: tedbow » Unassigned

@callumharrod I pushed an idea I think could work but I don't have much experience with Cypress. will comment on the MR

tedbow’s picture

It 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

tedbow’s picture

tedbow’s picture

Assigned: Unassigned » traviscarden
Status: Needs work » Needs review
tedbow’s picture

Assigned: traviscarden » Unassigned
Status: Needs review » Reviewed & tested by the community

I 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

tedbow’s picture

component-operations.cy.js failed but since we just added a new test I can't see how this is related

retesting

tedbow’s picture

Status: Reviewed & tested by the community » Fixed

I 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

Status: Fixed » Closed (fixed)

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