palantirnet / palantir-behat-extension

Additional step definitions for testing Drupal sites using Behat.
1 stars 4 forks source link

Add support for loading nodes, fields, and paragraphs. #34

Closed damontgomery closed 6 years ago

damontgomery commented 6 years ago

Nodes can be loaded by type / title / language. Fields can be loaded. Entity references are loaded. Special handling is used for fields with "nothing" values, they are checked to see if they are empty.

Special handling for:

Example:

Scenario: Blog post exists
  When I examine the "blog_post" node with title "My post"
  Then entity field "field_simple_example" should contain "test"
  And entity field "field_is_a_thing" should contain "nothing"
  # Example entity reference
  And entity field "field_authors" should contain "John Smith"
  And paragraph field "field_paragraphs" should be of type "my_paragraph_type"

Scenario: Paragraph fields
  When I examine the "page" node with title "My page"
  And I examine paragraph "5" on the "field_paragraphs" field
  Then entity field "field_content" should contain "Example"

Scenario: Paragraph fields in English
  When I examine the "page" node with title "My page" in "en"
  And I examine paragraph "5" on the "field_paragraphs" field
  Then entity field "field_content" should contain "Example"
damontgomery commented 6 years ago

Going to work on this a little more.

damontgomery commented 6 years ago

I missed out on the shared node extension. :(

damontgomery commented 6 years ago

Added support for loading paragraphs.

damontgomery commented 6 years ago

I've included the link work in #35 and also added support for translations.

damontgomery commented 6 years ago

@becw,

Thanks for the feedback. I've made the updates you requested. This has been working for us on our project. Please let me know if you want to see some of it in detail on our project.

I'm good with the code as a first version.

If it looks good, do you want to merge it?