Code Duplication    Length = 9-15 lines in 9 locations

Tests/Features/Context/VictoireContext.php 9 locations

@@ 256-269 (lines=14) @@
253
    /**
254
     * @Then /^I open the settings menu$/
255
     */
256
    public function iOpenTheSettingsMenu()
257
    {
258
        $element = $this->findOrRetry(
259
            $this->getSession()->getPage(),
260
            'xpath',
261
            'descendant-or-self::*[@id="v-settings-link"]'
262
        );
263
264
        if (null === $element) {
265
            $message = sprintf('Element not found in the page after 10 seconds"');
266
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
267
        }
268
        $element->click();
269
    }
270
271
    /**
272
     * @Then /^I open the additionals menu drop$/
@@ 274-287 (lines=14) @@
271
    /**
272
     * @Then /^I open the additionals menu drop$/
273
     */
274
    public function iOpenTheAdditionalsMenuDrop()
275
    {
276
        $element = $this->findOrRetry(
277
            $this->getSession()->getPage(),
278
            'xpath',
279
            'descendant-or-self::*[@id="v-additionals-drop"]'
280
        );
281
282
        if (null === $element) {
283
            $message = sprintf('Element not found in the page after 10 seconds"');
284
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
285
        }
286
        $element->click();
287
    }
288
289
    /**
290
     * @When I follow the tab :name
@@ 311-320 (lines=10) @@
308
    /**
309
     * @When I follow the drop trigger :name
310
     */
311
    public function iFollowTheDropTrigger($name)
312
    {
313
        $element = $this->findOrRetry($this->getSession()->getPage(), 'xpath', sprintf('descendant-or-self::a[@data-flag*="v-drop" and normalize-space(text()) = "%s"]', $name));
314
315
        if (null === $element) {
316
            $message = sprintf('Element not found in the page after 10 seconds"');
317
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
318
        }
319
        $element->click();
320
    }
321
322
    /**
323
     * @When I follow the drop anchor :name
@@ 433-441 (lines=9) @@
430
    /**
431
     * @Then I should see disable drop anchor :name
432
     */
433
    public function iShouldSeeDisableDropAnchor($name)
434
    {
435
        $element = $this->findOrRetry($this->getSession()->getPage(), 'xpath', sprintf('descendant-or-self::*[contains(@class, \'v-drop__anchor--disabled\') and normalize-space(.) = "%s"]', $name));
436
437
        if (null === $element) {
438
            $message = sprintf('Element not found in the page after 10 seconds"');
439
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
440
        }
441
    }
442
443
    /**
444
     * @Then I should see disable tab :name
@@ 137-146 (lines=10) @@
134
    /**
135
     * @Then /^I switch to "([^"]*)" mode$/
136
     */
137
    public function iSwitchToMode($mode)
138
    {
139
        $element = $this->findOrRetry($this->getSession()->getPage(), 'xpath', 'descendant-or-self::*[@for="mode-switcher--'.$mode.'"]');
140
141
        if (null === $element) {
142
            $message = sprintf('Element not found in the page after 10 seconds"');
143
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
144
        }
145
        $element->click();
146
    }
147
148
    /**
149
     * @Then /^I (open|close|toggle) the hamburger menu$/
@@ 151-160 (lines=10) @@
148
    /**
149
     * @Then /^I (open|close|toggle) the hamburger menu$/
150
     */
151
    public function iOpenTheHamburgerMenu()
152
    {
153
        $element = $this->findOrRetry(
154
            $this->getSession()->getPage(),
155
            'xpath',
156
            'descendant-or-self::*[@id="vic-menu-leftnavbar-trigger"]'
157
        );
158
159
        if (null === $element) {
160
            $message = sprintf('Element not found in the page after 10 seconds"');
161
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
162
        }
163
        $element->click();
@@ 203-215 (lines=13) @@
200
    /**
201
     * @When I follow the float action button
202
     */
203
    public function iFollowTheFloatAction()
204
    {
205
        $element = $this->findOrRetry(
206
            $this->getSession()->getPage(),
207
            'css',
208
            '#v-float-container [data-flag="v-drop v-drop-fab"]'
209
        );
210
        if (null === $element) {
211
            $message = sprintf('Element not found in the page after 10 seconds"');
212
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
213
        }
214
        $element->click();
215
    }
216
217
    /**
218
     * @When I open the widget quantum collapse for entity :entity
@@ 238-252 (lines=15) @@
235
    /**
236
     * @When I open the widget quantum collapse when static
237
     */
238
    public function iOpenTheWidgetQuantumCollapseWhenStatic()
239
    {
240
        $element = $this->findOrRetry(
241
            $this->getSession()->getPage(),
242
            'css',
243
            '[data-state="visible"] [id^="picker-static"] .v-widget-form__quantum-btn'
244
        );
245
246
        if (null === $element) {
247
            $message = sprintf('Element not found in the page after 10 seconds"');
248
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
249
        }
250
        $element->click();
251
    }
252
253
    /**
254
     * @Then /^I open the settings menu$/
255
     */
@@ 446-454 (lines=9) @@
443
    /**
444
     * @Then I should see disable tab :name
445
     */
446
    public function iShouldSeeDisableTab($name)
447
    {
448
        $element = $this->findOrRetry($this->getSession()->getPage(), 'xpath', sprintf('descendant-or-self::li[@class="vic-disable" and normalize-space(.) = "%s"]', $name));
449
450
        if (null === $element) {
451
            $message = sprintf('Element not found in the page after 10 seconds"');
452
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
453
        }
454
    }
455
456
    /**
457
     * @Then /^I move the widgetMap "(.+)" "(.+)" the widgetMap "(.*)"$/