Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EWPP-2023: Add a Behat step to create av portal videos programmatically. #188

Merged
merged 4 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"openeuropa/task-runner-drupal-project-symlink": "^1.0-beta5",
"phpspec/prophecy-phpunit": "^2",
"openeuropa/oe_link_lists": "^0.14",
"openeuropa/oe_webtools": "dev-EWPP-1714",
"openeuropa/oe_webtools": "dev-master",
"openeuropa/oe_oembed": "~0.1.0",
"drupal/drupal-extension": "~4.0",
"egulias/email-validator": "^2.1.22 || ^3.0",
Expand Down
7 changes: 5 additions & 2 deletions tests/features/av-portal-video.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Feature: AV Portal video.
@javascript @av_portal @cleanup:media
Scenario: The node adding form should contain an entity browser widget with the possibility to add new and reuse existing AV Portal video.
Given I am logged in as a user with the "create oe_media_demo content,create av_portal_video media,access media_entity_browser entity browser pages" permission
And the following AV Portal video:
| url |
| https://audiovisual.ec.europa.eu/en/video/I-163162 |
When I visit "the demo content creation page"
And I fill in "Title" with "Media demo"
And I click the fieldset "Media browser field"
Expand All @@ -36,10 +39,10 @@ Feature: AV Portal video.
When I press the "Select entities" button
Then I should see entity browser modal window
When I click "View"
And I select the "Midday press briefing from 25/10/2018" media entity in the entity browser modal window
And I select the "Economic and Financial Affairs Council - Arrivals" media entity in the entity browser modal window
And I press the "Select entities" button
And I press the "Save" button
Then I should see the AV Portal video "Midday press briefing from 25/10/2018"
Then I should see the AV Portal video " Economic and Financial Affairs Council - Arrivals"

When I visit "the demo content creation page"
And I fill in "Title" with "Media demo"
Expand Down
2 changes: 1 addition & 1 deletion tests/features/webtools-generic.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: Webtools generic.
When I fill in "Name" with "Share button"
And I fill in "Webtools snippet" with "{\"service\": \"map\"}"
And I press "Save"
Then I should see the error message "Service from the snippet is in the blacklist of Generic widget."
Then I should see the error message "This service is supported by a dedicated asset type or feature, please use that instead."

When I fill in "Webtools snippet" with "{\"service\": \"share\",\"icon\": true,\"selection\": false,\"shortenurl\": true}"
And I press "Save"
Expand Down
34 changes: 34 additions & 0 deletions tests/src/Behat/MediaContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,40 @@ public function createMediaImages(TableNode $table): void {
}
}

/**
* Creates media AVPortal video with the specified URLs.
*
* Usage example:
*
* Given the following AV Portal videos:
* | url |
* | url 1 |
* | ... |
*
* @Given the following AV Portal video(s):
*/
public function createMediaAvPortalVideo(TableNode $table): void {
/** @var \Drupal\media_avportal\Plugin\media\Source\MediaAvPortalSourceInterface $media_source */
$media_source = \Drupal::entityTypeManager()
->getStorage('media_type')
->load('av_portal_video')
->getSource();

// Retrieve the url table from the test scenario.
foreach ($table->getColumnsHash() as $hash) {
$media = \Drupal::entityTypeManager()
->getStorage('media')->create([
'bundle' => 'av_portal_video',
'oe_media_avportal_video' => $media_source->transformUrlToReference($hash['url']),
'status' => 1,
]);
$media->save();

// Store for cleanup.
$this->media[] = $media;
}
}

/**
* Creates media AVPortal photos with the specified URLs.
*
Expand Down