<commit_before>@mink:selenium2 @alice(Page) @alice(Template) @reset-schema
Feature: Test widgetMap
# Ececuted tests:
#  On a simple page with a template
#    - add
#    - delete
#    - move
#    - overwrite
#    - overwrite + add on child
#    - overwrite + delete on child
#    - overwrite + move on child
#    - overwrite + add on template
#    - overwrite + delete on template
#    - overwrite + move on template

  Background:
    Given I maximize the window
    And I am on homepage

@reset-schema
Scenario: I move first a widget from template
  Given the following WidgetMaps:
    | id | action | position | parent |  slot        |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I move the widgetMap "3" "before" the widgetMap "1"
  And I wait 2 seconds
  And I reload the page
  And "Widget 3" should precede "Widget 1"
  And "Widget 1" should precede "Widget 2"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

@reset-schema
Scenario: I move up a widget from template
  Given the following WidgetMaps:
    | id | action | position | parent |  slot        |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I move the widgetMap "2" "before" the widgetMap "3"
  And I wait 2 seconds
  And I reload the page
  And "Widget 1" should precede "Widget 2"
  And "Widget 2" should precede "Widget 3"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

@reset-schema
Scenario: I move down a widget from template
  Given the following WidgetMaps:
    | id | action | position | parent | slot         |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I move the widgetMap "1" "after" the widgetMap "2"
  And I wait 2 seconds
  And I reload the page
  Then "Widget 3" should precede "Widget 2"
  Then "Widget 2" should precede "Widget 1"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

@reset-schema
@debug
Scenario: I add widget in a position from template
  Given the following WidgetMaps:
    | id | action | position | parent | slot         |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I switch to "layout" mode
  Then I should see "Nouveau contenu"
  When I select "Texte brut" from the "3" select of "main_content" slot
  Then I should see "Créer"
  When I fill in "Texte *" with "Widget 4"
  And I submit the widget
  And I reload the page
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 4"
  And "Widget 4" should precede "Widget 2"
  Then I move the widgetMap "1" "after" the widgetMap "4"
  And I wait 2 seconds
  And I reload the page
  Then "Widget 3" should precede "Widget 4"
  Then "Widget 4" should precede "Widget 1"
  Then "Widget 1" should precede "Widget 2"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

@reset-schema
@debug
Scenario: I delete widget from template
  Given the following WidgetMaps:
    | id | action | position | parent | slot         |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I switch to "edit" mode
  And I edit the "Text" widget
  Then I should see "Supprimer"
  Given I follow "Supprimer"
  Then I should see "Cette action va définitivement supprimer ce contenu. Cette action est irréversible."
  And I should see "Êtes-vous sûr ?"
  Given I press "J'ai bien compris, je confirme la suppression"
  And I reload the page
  And "Widget 3" should precede "Widget 2"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

@reset-schema
  Scenario: I overwrite a widget from template
  Given the following WidgetMaps:
    | id | action | position | parent | slot         |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I switch to "edit" mode
  And I edit the "Text" widget
  Then I should see "Mettre à jour"
  When I fill in "Texte *" with "Widget 1 overwrite"
  And I submit the widget
  And I should see "Widget 1 overwrite"
  And "Widget 1 overwrite" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"
<commit_msg>mark as debug test not working without UI issue<commit_after>@mink:selenium2 @alice(Page) @alice(Template) @reset-schema
Feature: Test widgetMap
# Ececuted tests:
#  On a simple page with a template
#    - add
#    - delete
#    - move
#    - overwrite
#    - overwrite + add on child
#    - overwrite + delete on child
#    - overwrite + move on child
#    - overwrite + add on template
#    - overwrite + delete on template
#    - overwrite + move on template

  Background:
    Given I maximize the window
    And I am on homepage

@reset-schema
Scenario: I move first a widget from template
  Given the following WidgetMaps:
    | id | action | position | parent |  slot        |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I move the widgetMap "3" "before" the widgetMap "1"
  And I wait 2 seconds
  And I reload the page
  And "Widget 3" should precede "Widget 1"
  And "Widget 1" should precede "Widget 2"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

@reset-schema
Scenario: I move up a widget from template
  Given the following WidgetMaps:
    | id | action | position | parent |  slot        |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I move the widgetMap "2" "before" the widgetMap "3"
  And I wait 2 seconds
  And I reload the page
  And "Widget 1" should precede "Widget 2"
  And "Widget 2" should precede "Widget 3"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

@reset-schema
Scenario: I move down a widget from template
  Given the following WidgetMaps:
    | id | action | position | parent | slot         |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I move the widgetMap "1" "after" the widgetMap "2"
  And I wait 2 seconds
  And I reload the page
  Then "Widget 3" should precede "Widget 2"
  Then "Widget 2" should precede "Widget 1"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

@reset-schema
@debug
Scenario: I add widget in a position from template
  Given the following WidgetMaps:
    | id | action | position | parent | slot         |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I switch to "layout" mode
  Then I should see "Nouveau contenu"
  When I select "Texte brut" from the "3" select of "main_content" slot
  Then I should see "Créer"
  When I fill in "Texte *" with "Widget 4"
  And I submit the widget
  And I reload the page
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 4"
  And "Widget 4" should precede "Widget 2"
  Then I move the widgetMap "1" "after" the widgetMap "4"
  And I wait 2 seconds
  And I reload the page
  Then "Widget 3" should precede "Widget 4"
  Then "Widget 4" should precede "Widget 1"
  Then "Widget 1" should precede "Widget 2"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

@reset-schema
@debug
Scenario: I delete widget from template
  Given the following WidgetMaps:
    | id | action | position | parent | slot         |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I switch to "edit" mode
  And I edit the "Text" widget
  Then I should see "Supprimer"
  Given I follow "Supprimer"
  Then I should see "Cette action va définitivement supprimer ce contenu. Cette action est irréversible."
  And I should see "Êtes-vous sûr ?"
  Given I press "J'ai bien compris, je confirme la suppression"
  And I reload the page
  And "Widget 3" should precede "Widget 2"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

@reset-schema
@debug
  Scenario: I overwrite a widget from template
  Given the following WidgetMaps:
    | id | action | position | parent | slot         |   view  |
    | 1  | create |          |        | main_content |   base  |
    | 2  | create |  after   |   1    | main_content |   base  |
    | 3  | create |  before  |   2    | main_content |   base  |
  Given the following WidgetTexts:
    | content  | mode   | widgetMap |
    | Widget 1 | static |    1       |
    | Widget 2 | static |    2       |
    | Widget 3 | static |    3       |
  And I am on the homepage
  Then I should see "Widget 1"
  When I switch to "edit" mode
  And I edit the "Text" widget
  Then I should see "Mettre à jour"
  When I fill in "Texte *" with "Widget 1 overwrite"
  And I submit the widget
  And I should see "Widget 1 overwrite"
  And "Widget 1 overwrite" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"
  Then I am on "/fr/victoire-dcms/template/show/1"
  And "Widget 1" should precede "Widget 3"
  And "Widget 3" should precede "Widget 2"

{'fraction_non_alphanumeric': 0.08457350272232304, 'fraction_numerical': 0.02163339382940109, 'mean_word_length': 2.1639871382636655, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3395041', 'n_tokens_mistral': 4656, 'n_tokens_neox': 4441, 'n_words': 1799}