Skip to content

Commit 7c96693

Browse files
author
Leny Bernard
committed
Fix shouldPreceed assert
1 parent e951852 commit 7c96693

File tree

3 files changed

+21
-29
lines changed

3 files changed

+21
-29
lines changed

Tests/Features/Context/VictoireContext.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,13 @@ public function iEditTheWidget($widgetType)
130130
*/
131131
public function shouldPrecedeForTheQuery($textBefore, $textAfter)
132132
{
133-
$items = array_map(
134-
function ($element) {
135-
return $element->getText();
136-
},
137-
$this->getSession()->getPage()->findAll('css', 'div.vic-widget > p')
133+
$element = $this->getSession()->getPage()->find(
134+
'xpath',
135+
sprintf('//descendant-or-self::*[normalize-space(text()) = "%s"]/ancestor::div[@class="vic-widget-container"]/following-sibling::div[@class="vic-widget-container"]/descendant-or-self::*[normalize-space(text()) = "%s"]', $textBefore, $textAfter)
138136
);
139137

140-
if (array_search($textBefore, $items) > array_search($textAfter, $items)) {
141-
$message = "$textBefore does not proceed $textAfter";
138+
if (null === $element) {
139+
$message = sprintf('"%s" does not preceed "%s"', $textBefore, $textAfter);
142140
throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
143141
}
144142
}

Tests/Features/WidgetMap/widgetMap.feature

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,35 @@ Feature: Test widgetMap
44
Background:
55
Given I am logged in as "[email protected]"
66

7-
Scenario: Create a widget at first position
7+
Scenario: I create widget in a position
88
Then I switch to "layout" mode
99
When I select "Force" from the "1" select of "content" slot
1010
Then I should see "Créer"
1111
When I fill in "Côté de la force" with "Obscure"
1212
And I submit the widget
1313
Then I should see "Victoire !"
14-
And I reload the page
15-
Then I should see "Le côté Obscure de la force"
14+
And I should see "Le côté Obscure de la force"
1615

1716
When I select "Force" from the "2" select of "content" slot
1817
Then I should see "Créer"
1918
When I fill in "Côté de la force" with "Lumineux"
2019
And I submit the widget
2120
Then I should see "Victoire !"
22-
And I reload the page
2321
Then I should see "Le côté Lumineux de la force"
24-
And "Obscure" should precede "Lumineux"
22+
And "Le côté Obscure de la force" should precede "Le côté Lumineux de la force"
2523

26-
When I select "Force" from the "1" select of "content" slot
27-
Then I should see "Créer"
28-
When I fill in "Côté de la force" with "Marron"
29-
And I submit the widget
30-
Then I should see "Victoire !"
31-
And I reload the page
32-
Then I should see "Le côté Marron de la force"
33-
And "Marron" should precede "Lumineux"
34-
And "Marron" should precede "Obscure"
35-
When I select "Force" from the "3" select of "content" slot
24+
Given I reload the page
25+
Then "Le côté Obscure de la force" should precede "Le côté Lumineux de la force"
26+
27+
Given I select "Force" from the "2" select of "content" slot
3628
Then I should see "Créer"
37-
When I fill in "Côté de la force" with "Jaune"
29+
When I fill in "Côté de la force" with "Double"
3830
And I submit the widget
3931
Then I should see "Victoire !"
40-
And I reload the page
41-
Then I should see "Jaune"
42-
And "Jaune" should precede "Lumineux"
43-
And "Obscure" should precede "Jaune"
44-
And "Marron" should precede "Jaune"
32+
Then I should see "Le côté Double de la force"
33+
And "Le côté Lumineux de la force" should precede "Le côté Double de la force"
34+
And "Le côté Double de la force" should precede "Le côté Obscure de la force"
35+
36+
Given I reload the page
37+
And "Le côté Lumineux de la force" should precede "Le côté Double de la force"
38+
And "Le côté Double de la force" should precede "Le côté Obscure de la force"

Tests/Functionnal/src/Victoire/Widget/ForceBundle/Resources/translations/messages.fr.xliff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</trans-unit>
1313
<trans-unit id="4" resname="widget_force.show.forceSide">
1414
<source>widget_force.show.forceSide</source>
15-
<target>Le Côté %side% de la force</target>
15+
<target>Le côté %side% de la force</target>
1616
</trans-unit>
1717
<trans-unit id="5" resname="dark">
1818
<source>dark</source>

0 commit comments

Comments
 (0)