[PP-1] Failing kernel tests for all ways a component source can fail to render on the server side

Created on 8 April 2025, 12 days ago

Overview

This is blocked by ๐Ÿ“Œ Introduce unit test coverage for both ComponentSource plugins (Block + SDC) Active .
This blocks ๐Ÿ“Œ Improve server-side error handling Active .

Implement explicit kernel tests for 5 of the 6 acceptance criteria at ๐ŸŒฑ [META] Robust component instance error handling Active .

  1. A (whose ) used as a component instance in an XB component tree does NOT make the rest of the component tree unusable.
  2. An (whose ) used as a component instance in an XB component tree does NOT make the rest of the component tree unusable .
  3. out of scope in this issue
  4. A (whose ) used as a component instance whose explicit inputs are invalid does NOT make the rest of the component tree unusable (except that if this code component has slots, those slots MAY not appear in the preview, but they would appear in the โ€œLayersโ€ view).
  5. A used as a component instance whose does NOT make the rest of the component tree unusable.
  6. An used as a component instance whose does NOT make the rest of the component tree unusable.
  7. A used as a component instance whose does NOT make the rest of the component tree unusable.

Proposed resolution

Add the following:

  /**
   * @dataProvider providerRenderComponent
   */
  public function testRenderComponent(array $inputs, string $componentUuid, bool $isPreview = FALSE, ?\Exception $expected_exception, string $expected_output): {
    
  }

to \Drupal\Tests\experience_builder\Kernel\Plugin\ExperienceBuilder\ComponentSource\(Block|Js|SingleDirectory)ComponentTest

User interface changes

None.

๐Ÿ“Œ Task
Status

Active

Version

0.0

Component

Component sources

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @wim leers
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom f.mazeikis Brighton
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia nagwani
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    ๐Ÿ“Œ Introduce unit test coverage for both ComponentSource plugins (Block + SDC) Active is in!

    That added ComponentSourceTestBase::testRenderComponentLive().

    This issue's summary proposed

      /**
       * @dataProvider providerRenderComponent
       */
      public function testRenderComponent(array $inputs, string $componentUuid, bool $isPreview = FALSE, ?\Exception $expected_exception, string $expected_output): {
        
      }
    

    That signature was not viable in #3501290, because that issue aimed to test all discovered components of the tested ComponentSource.

    Do you have a proposal, @f.mazeikis? Perhaps what we want is a testRenderComponentFailure() instead with that signature? ๐Ÿค”

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom f.mazeikis Brighton

    Well, I've used the signature you've suggested as a suggestion and made some changes. I also renamed the method to testRenderComponentFailure().

    I have added SDC and Block Plugin that fails by default by intentionally throwing exceptions when passed TRUE as value for "crash" prop/input. By default, the value is TRUE. These new component sources are currently part of xb_test_block and xb_test_sdc test modules.

    At the moment this causes failures of Functional tests for a bunch of endpoints and the recently introduced testRenderComponentLive() in SDC and Block tests. By the way, what does "Live" part of testRenderComponentLive() refers to? Don't think I've seen this term used before in XB Components context.

    I am not sure if that was what @wim-leers expected? I could move them into some sort of "xb_test_failures" submodules and somewhat "limit the damage". Or is the intent is to go the other way around and make even more breakage, so we can spot all the potential issues?

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    By the way, what does "Live" part of testRenderComponentLive() refers to? Don't think I've seen this term used before in XB Components context.

    It refers to it using isPreview: FALSE. I didn't like the name, but needed to unblock this ๐Ÿ˜… Suggestions VERY welcome! ๐Ÿ™

    At the moment this causes failures of Functional tests for a bunch of endpoints a

    That's because xb_test_sdc is installed by a bunch of tests; we shouldn't default to crashing โ€” that immediately fixes those widespread failures!

    I am not sure if that was what @wim-leers expected?

    This is definitely looking like the direction I asked for!

    But this was not yet proving used as a component instance in an XB component tree does NOT make the rest of the component tree unusable. See review feedback, and partial implementation.

Production build 0.71.5 2024