Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Aug 1, 2023
1 parent 21045ec commit c5ef11f
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/behat/features/paragraph.civictheme_snippet.fields.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@p0 @civictheme @civictheme_snippet
Feature: Snippet fields

@api
Scenario: Fields appear as expected
Given I am logged in as a user with the "Site Administrator" role
When I visit "node/add/civictheme_page"
And I fill in "Title" with "[TEST] Page fields"
When I press "Add Manual list"
And I press "Add Snippet"

Then I should see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_title][0][value]']" element
And I should see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_title][0][value]'].required" element
And I should not see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_title][0][value]'][disabled]" element

And I should see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_summary][0][value]']" element
And I should not see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_summary][0][value]'].required" element
And I should not see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_summary][0][value]'][disabled]" element

And I should see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_link][0][uri]']" element
And I should not see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_link][0][uri]'].required" element
And I should not see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_link][0][uri]'][disabled]" element

And I should see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_topics][0][target_id]']" element
And I should not see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_topics][0][target_id]'].required" element
And I should not see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_topics][0][target_id]'][disabled]" element

And I should see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_theme]']" element
57 changes: 57 additions & 0 deletions tests/behat/features/paragraph.civictheme_snippet.render.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
@p1 @civictheme @civictheme_snippet
Feature: Snippet render

Background:
Given "civictheme_page" content:
| title | status |
| [TEST] Page Snippets test | 1 |

And "civictheme_topics" terms:
| name |
| [TEST] Topic 1 |
| [TEST] Topic 2 |
| [TEST] Topic 3 |

@api
Scenario: CivicTheme page content type page can be viewed by anonymous with Snippets
Given I am an anonymous user
And "field_c_n_components" in "civictheme_page" "node" with "title" of "[TEST] Page Snippets test" has "civictheme_manual_list" paragraph:
| field_c_p_title | [TEST] Snippet list |
| field_c_p_list_column_count | 4 |
| field_c_p_list_link_above | 0: View all snippets - 1: https://example.com |
| field_c_p_list_fill_width | 0 |
And "field_c_p_list_items" in "civictheme_manual_list" "paragraph" with "field_c_p_title" of "[TEST] Snippet list" has "civictheme_snippet" paragraph:
| field_c_p_title | Snippet title 1 |
| field_c_p_summary | Summary text 1 |
| field_c_p_link | 0: Test link - 1: https://example.com |
| field_c_p_topics | [TEST] Topic 1 |
| field_c_p_theme | light |
And "field_c_p_list_items" in "civictheme_manual_list" "paragraph" with "field_c_p_title" of "[TEST] Snippet list" has "civictheme_snippet" paragraph:
| field_c_p_title | Snippet title 2 |
| field_c_p_summary | Summary text 2 |
| field_c_p_link | 0: Test link - 1: https://example.com |
| field_c_p_topics | [TEST] Topic 2, [TEST] Topic 3 |
| field_c_p_theme | dark |
And "field_c_p_list_items" in "civictheme_manual_list" "paragraph" with "field_c_p_title" of "[TEST] Snippet list" has "civictheme_snippet" paragraph:
| field_c_p_title | Snippet title 3 |
| field_c_p_summary | Summary text 3 |
| field_c_p_link | 0: Test link - 1: https://example.com |
| field_c_p_theme | dark |
And "field_c_p_list_items" in "civictheme_manual_list" "paragraph" with "field_c_p_title" of "[TEST] Snippet list" has "civictheme_snippet" paragraph:
| field_c_p_title | Snippet title 4 |
| field_c_p_link | 0: Test link - 1: https://example.com |
| field_c_p_theme | dark |

When I visit "civictheme_page" "[TEST] Page Snippets test"
And I should see the text "[TEST] Snippet list"
Then I should see the link "View all snippets" with "https://example.com" in '.ct-list'
And I should see 4 ".ct-snippet" elements
And I should see 4 ".ct-snippet__title" elements
And I should see 3 ".ct-snippet__summary" elements
And I should see the text "Snippet title 1"
And I should see the text "Snippet title 2"
And I should see the text "Snippet title 3"
And I should see the text "Snippet title 4"
And I should see the text "[TEST] Topic 1"
And I should see the text "[TEST] Topic 2"
And I should see the text "[TEST] Topic 3"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@p0 @civictheme @civictheme_snippet_ref
Feature: Snippet reference fields

@api
Scenario: Fields appear as expected
Given I am logged in as a user with the "Site Administrator" role
When I visit "node/add/civictheme_page"
And I fill in "Title" with "[TEST] Page fields"
When I press "Add Manual list"
And I press "Add Snippet reference"

Then I should see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_reference][0][target_id]']" element
And I should see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_reference][0][target_id]'].required" element
And I should not see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_reference][0][target_id]'][disabled]" element

And I should see an "[name='field_c_n_components[0][subform][field_c_p_list_items][0][subform][field_c_p_theme]']" element
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@p0 @civictheme @civictheme_snippet_ref
Feature: Navigation reference card render

Background:
Given "civictheme_topics" terms:
| name |
| [TEST] Topic 1 |
| [TEST] Topic 2 |
| [TEST] Topic 3 |

And "civictheme_page" content:
| title | status | field_c_n_summary | field_c_n_topics |
| [TEST] Page with container | 1 | | |
| [TEST] Referenced Page 1 | 1 | Summary 1 | [TEST] Topic 1 |
| [TEST] Referenced Page 2 | 1 | Summary 2 | [TEST] Topic 2, [TEST] Topic 3 |

@api
Scenario: Anonymous user can view Navigation reference card
Given I am an anonymous user
And "field_c_n_components" in "civictheme_page" "node" with "title" of "[TEST] Page with container" has "civictheme_manual_list" paragraph:
| field_c_p_title | [TEST] Reference list title |
| field_c_p_list_column_count | 3 |
| field_c_p_list_fill_width | 0 |
And "field_c_p_list_items" in "civictheme_manual_list" "paragraph" with "field_c_p_title" of "[TEST] Reference list title" has "civictheme_snippet_ref" paragraph:
| field_c_p_reference | [TEST] Referenced Page 1 |
| field_c_p_theme | light |
And "field_c_p_list_items" in "civictheme_manual_list" "paragraph" with "field_c_p_title" of "[TEST] Reference list title" has "civictheme_snippet_ref" paragraph:
| field_c_p_reference | [TEST] Referenced Page 2 |
| field_c_p_theme | dark |

When I visit "civictheme_page" "[TEST] Page with container"
And I should see the text "[TEST] Reference list title"
And I should see 1 ".ct-list" elements
And I should see 2 ".ct-snippet" elements
And I should see 1 ".ct-snippet.ct-theme-light" elements
And I should see 1 ".ct-snippet.ct-theme-dark" elements
And I should see 2 ".ct-snippet__title" elements
And I should see 2 ".ct-snippet__summary" elements
And I should see 2 ".ct-snippet__title__link" elements
And I should see 2 ".ct-snippet__tags" elements
And I should see the text "[TEST] Referenced Page 1"
And I should see the text "Summary 1"
And I should see the text "[TEST] Topic 1"
And I should see the text "[TEST] Referenced Page 2"
And I should see the text "Summary 2"
And I should see the text "[TEST] Topic 2"
And I should see the text "[TEST] Topic 3"

0 comments on commit c5ef11f

Please sign in to comment.