Code Duplication    Length = 9-15 lines in 9 locations

Tests/Features/Context/VictoireContext.php 9 locations

@@ 166-175 (lines=10) @@
163
    /**
164
     * @Then /^I switch to "([^"]*)" mode$/
165
     */
166
    public function iSwitchToMode($mode)
167
    {
168
        $element = $this->findOrRetry($this->getSession()->getPage(), 'xpath', 'descendant-or-self::*[@for="mode-switcher--'.$mode.'"]');
169
170
        if (null === $element) {
171
            $message = sprintf('Element not found in the page after 10 seconds"');
172
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
173
        }
174
        $element->click();
175
    }
176
177
    /**
178
     * @Then /^I (open|close|toggle) the hamburger menu$/
@@ 180-189 (lines=10) @@
177
    /**
178
     * @Then /^I (open|close|toggle) the hamburger menu$/
179
     */
180
    public function iOpenTheHamburgerMenu()
181
    {
182
        $element = $this->findOrRetry(
183
            $this->getSession()->getPage(),
184
            'xpath',
185
            'descendant-or-self::*[@id="vic-menu-leftnavbar-trigger"]'
186
        );
187
188
        if (null === $element) {
189
            $message = sprintf('Element not found in the page after 10 seconds"');
190
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
191
        }
192
        $element->click();
@@ 232-244 (lines=13) @@
229
    /**
230
     * @When I follow the float action button
231
     */
232
    public function iFollowTheFloatAction()
233
    {
234
        $element = $this->findOrRetry(
235
            $this->getSession()->getPage(),
236
            'css',
237
            '#v-float-container [data-flag="v-drop v-drop-fab"]'
238
        );
239
        if (null === $element) {
240
            $message = sprintf('Element not found in the page after 10 seconds"');
241
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
242
        }
243
        $element->click();
244
    }
245
246
    /**
247
     * @When I open the widget quantum collapse for entity :entity
@@ 267-281 (lines=15) @@
264
    /**
265
     * @When I open the widget quantum collapse when static
266
     */
267
    public function iOpenTheWidgetQuantumCollapseWhenStatic()
268
    {
269
        $element = $this->findOrRetry(
270
            $this->getSession()->getPage(),
271
            'css',
272
            '[data-state="visible"] [id^="picker-static"] .v-widget-form__quantum-btn'
273
        );
274
275
        if (null === $element) {
276
            $message = sprintf('Element not found in the page after 10 seconds"');
277
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
278
        }
279
        $element->click();
280
    }
281
282
    /**
283
     * @Then /^I open the settings menu$/
284
     */
@@ 285-298 (lines=14) @@
282
    /**
283
     * @Then /^I open the settings menu$/
284
     */
285
    public function iOpenTheSettingsMenu()
286
    {
287
        $element = $this->findOrRetry(
288
            $this->getSession()->getPage(),
289
            'xpath',
290
            'descendant-or-self::*[@id="v-settings-link"]'
291
        );
292
293
        if (null === $element) {
294
            $message = sprintf('Element not found in the page after 10 seconds"');
295
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
296
        }
297
        $element->click();
298
    }
299
300
    /**
301
     * @Then /^I open the additional menu drop$/
@@ 303-316 (lines=14) @@
300
    /**
301
     * @Then /^I open the additional menu drop$/
302
     */
303
    public function iOpenTheAdditionalsMenuDrop()
304
    {
305
        $element = $this->findOrRetry(
306
            $this->getSession()->getPage(),
307
            'xpath',
308
            'descendant-or-self::*[@id="v-additionals-drop"]'
309
        );
310
311
        if (null === $element) {
312
            $message = sprintf('Element not found in the page after 10 seconds"');
313
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
314
        }
315
        $element->click();
316
    }
317
318
    /**
319
     * @When I follow the tab :name
@@ 340-349 (lines=10) @@
337
    /**
338
     * @When I follow the drop trigger :name
339
     */
340
    public function iFollowTheDropTrigger($name)
341
    {
342
        $element = $this->findOrRetry($this->getSession()->getPage(), 'xpath', sprintf('descendant-or-self::a[@data-flag*="v-drop" and normalize-space(text()) = "%s"]', $name));
343
344
        if (null === $element) {
345
            $message = sprintf('Element not found in the page after 10 seconds"');
346
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
347
        }
348
        $element->click();
349
    }
350
351
    /**
352
     * @When I follow the drop anchor :name
@@ 462-470 (lines=9) @@
459
    /**
460
     * @Then I should see disable drop anchor :name
461
     */
462
    public function iShouldSeeDisableDropAnchor($name)
463
    {
464
        $element = $this->findOrRetry($this->getSession()->getPage(), 'xpath', sprintf('descendant-or-self::*[contains(@class, \'v-drop__anchor--disabled\') and normalize-space(.) = "%s"]', $name));
465
466
        if (null === $element) {
467
            $message = sprintf('Element not found in the page after 10 seconds"');
468
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
469
        }
470
    }
471
472
    /**
473
     * @Then I should see disable tab :name
@@ 475-483 (lines=9) @@
472
    /**
473
     * @Then I should see disable tab :name
474
     */
475
    public function iShouldSeeDisableTab($name)
476
    {
477
        $element = $this->findOrRetry($this->getSession()->getPage(), 'xpath', sprintf('descendant-or-self::li[@class="vic-disable" and normalize-space(.) = "%s"]', $name));
478
479
        if (null === $element) {
480
            $message = sprintf('Element not found in the page after 10 seconds"');
481
            throw new \Behat\Mink\Exception\ResponseTextException($message, $this->getSession());
482
        }
483
    }
484
485
    /**
486
     * @Then /^I move the widgetMap "(.+)" "(.+)" the widgetMap "(.*)"$/