Skip to content

Commit 717910d

Browse files
committed
Issue #369 - Upgrade drupal/transliterate_filenames to 2.x
1 parent 2c3efa6 commit 717910d

File tree

8 files changed

+155
-10
lines changed

8 files changed

+155
-10
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"drupal/shield": "^1.4",
8282
"drupal/string_field_formatter": "^2.0",
8383
"drupal/svg_image": "^1.15",
84-
"drupal/transliterate_filenames": "^1.5",
84+
"drupal/transliterate_filenames": "^2.0",
8585
"drupal/webp": "^1.0@beta",
8686
"drush/drush": "^11.0",
8787
"oomphinc/composer-installers-extender": "^2.0"

composer.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/behat/config/suite.default.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ default:
2222
- '\Sweetchuck\DrupalTestTraits\Core\Behat\Context\User'
2323
- '\Sweetchuck\DrupalTestTraits\EntityLegal\Behat\Context\EntityLegal'
2424
- '\DrupalHu\DrupalHu\Tests\Behat\Context\ExternalTranslations'
25+
- '\DrupalHu\DrupalHu\Tests\Behat\Context\Browser'
2526
# - '\Cheppers\DrupalExtension\Context\Drupal\Core'
2627
# - '\Cheppers\DrupalExtension\Context\Drupal\CoreAjax'
2728
# - '\Cheppers\DrupalExtension\Context\Drupal\CoreCache'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@api
2+
@javascript
3+
Feature: Page node access create
4+
5+
Scenario Outline: node:page access:create with different roles
6+
Given I am acting as a user with the "<role>" roles
7+
When I go to "/node/add/page"
8+
Then the response status code should be <status_code>
9+
Examples:
10+
| role | status_code |
11+
| anonymous | 403 |
12+
| authenticated | 403 |
13+
| administrator | 200 |
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
@api
2+
@javascript
3+
#noinspection NonAsciiCharacters
4+
Feature: node:page create
5+
6+
Background:
7+
Given users:
8+
| name | mail | roles |
9+
| dummy-1 | dummy-1@behat.localhost | administrator |
10+
And I am logged in as "dummy-1"
11+
And I am at "/node/add/page"
12+
13+
Scenario: Page node create – required field messages
14+
Given required attributes are removed from all input elements in form "node-page-form"
15+
And I press "Mentés"
16+
Then I should see 1 message
17+
Then I should see only the following error messages:
18+
| Cím mező szükséges. |
19+
20+
Scenario: Page node create – only required fields
21+
When I fill in "Cím" with "My page 01"
22+
And I press "Mentés"
23+
Then I should see 1 message
24+
And I should see only the following status message:
25+
| My page 01 Oldal létrejött. |
26+
27+
@transliterate
28+
Scenario: Page node create – all fields
29+
When I fill in "Cím" with "My page 01"
30+
31+
And I open the media library browser of the "Kép" media field
32+
And I attach the file "behat-01-1440x1080.jpg" to "files[upload]"
33+
And I wait for AJAX to finish
34+
And I fill in "media[0][fields][field_media_image][0][alt]" with "My alt text"
35+
And I press the "Mentés" action button in the "Média hozzáadása vagy kiválasztása" dialog
36+
And I press the "Kijelölt beillesztése" action button in the "Média hozzáadása vagy kiválasztása" dialog
37+
38+
And I fill in wysiwyg on field "app_body[0][value]" with "My body text"
39+
40+
# @todo File attach does not work at normal speed. It works with XDebug step debugger.
41+
# I have spent a lot of time to debugging, but still no clue what the problem is.
42+
# I narrowed down the problem to \DMore\ChromeDriver\ChromeDriver::attachFile()
43+
# $this->page->send().
44+
# But maybe there is a problem with the "I fill in wysiwyg on field ..." step.
45+
# The "I wait for AJAX to finish" step doesn't solve the problem.
46+
And I wait 2 seconds
47+
And I attach the file "árvíztűrő tükörfúrógép-lower.pdf" to "files[app_attachments_0][]"
48+
And I wait for AJAX to finish
49+
And I attach the file "ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP-upper.pdf" to "files[app_attachments_1][]"
50+
And I wait for AJAX to finish
51+
52+
And I press "Mentés"
53+
54+
Then I should see 1 message
55+
And I should see only the following status message:
56+
| My page 01 Oldal létrejött. |
57+
And I should see the text "arvizturo-tukorfurogep-lower"
58+
And I should see the text "arvizturo-tukorfurogep-upper"
29.7 KB
Binary file not shown.
28.4 KB
Binary file not shown.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
declare(strict_types = 1);
4+
5+
namespace DrupalHu\DrupalHu\Tests\Behat\Context;
6+
7+
use Sweetchuck\DrupalTestTraits\Core\Behat\Context\Base;
8+
9+
class Browser extends Base {
10+
11+
/**
12+
* @Given the :selector element is in the view
13+
* @When I scroll to :selector element into view
14+
*
15+
* @param string $selector
16+
* CSS or XPath selector.
17+
* Examples:
18+
* - .my-class
19+
* - div
20+
* - #my-id
21+
* - css:.my-class
22+
* - css:div
23+
* - css:#my-id
24+
* - xpath://p/strong
25+
* CSS is the default locator type.
26+
*/
27+
public function scrollToElementBySelector(string $selector): void {
28+
// @todo Check that the element is exists.
29+
$locator = 'css';
30+
$matches = [];
31+
if (preg_match('/^(?P<locator>jquery|css|xpath):/', $selector) === 1) {
32+
$locator = $matches['locator'];
33+
$selector = preg_replace('/^(jquery|css|xpath):/', '', $selector);
34+
}
35+
36+
$selectorSafe = var_export($selector, TRUE);
37+
38+
switch ($locator) {
39+
case 'jquery':
40+
$script = <<<JS
41+
(function() {
42+
jQuery($selectorSafe)[0]
43+
.scrollIntoView(true);
44+
})()
45+
JS;
46+
break;
47+
48+
case 'xpath':
49+
$script = <<<JS
50+
(function() {
51+
document
52+
.evaluate($selectorSafe, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null)
53+
.singleNodeValue
54+
.scrollIntoView(true);
55+
})()
56+
JS;
57+
break;
58+
59+
default:
60+
$script = <<<JS
61+
(function() {
62+
document
63+
.querySelector($selectorSafe)
64+
.scrollIntoView(true);
65+
})()
66+
JS;
67+
break;
68+
}
69+
70+
$this->getSession()->executeScript($script);
71+
}
72+
73+
}

0 commit comments

Comments
 (0)