-
Notifications
You must be signed in to change notification settings - Fork 3
/
VideoEmbedCest.php
70 lines (60 loc) · 2.01 KB
/
VideoEmbedCest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
use Faker\Factory;
/**
* Class VideoEmbedCest.
*
* @group install
*/
class VideoEmbedCest {
/**
* Faker service.
*
* @var \Faker\Generator
*/
protected $faker;
/**
* Test constructor.
*/
public function __construct() {
$this->faker = Factory::create();
}
/**
* I can create a page with a video embed and verify caption.
*/
public function testVideoEmbed(FunctionalTester $I) {
// Login and add flexible page.
$I->logInWithRole('contributor');
$I->amOnPage('node/add/hs_basic_page');
$I->fillField('Title', $this->faker->words(3, TRUE));
// Add text field.
$I->scrollTo('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('Add Component');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Text Area');
$I->click('Text Area', '.paragraphs-ee-add-dialog');
$I->wait(2);
// Add media.
$I->click('.ck-button[data-cke-tooltip-text="Insert Media"]');
$I->waitForText('Add or select media');
$I->click('.media-library-menu__link[data-title="Video"]');
$I->waitForText('Add Video via URL');
$I->fillField('Add Video via URL', 'https://www.youtube.com/watch?v=95N_spFNEkY');
$I->click('Add', '.media-library-add-form__input-wrapper');
$I->waitForText('Save and select');
$I->click('Save and select', '.ui-dialog-buttonpane');
$I->waitForText('Insert selected');
$I->click('Insert selected', '.ui-dialog-buttonpane');
$I->waitForElement('figure.drupal-media iframe');
// Enable caption.
$I->clickWithLeftButton('figure.drupal-media');
$I->clickWithLeftButton('[data-cke-tooltip-text="Toggle caption on"]');
$I->fillField('figcaption.ck-editor__nested-editable', 'sore was I ere I saw eros');
// Save node.
$I->click('Save');
// Verify figure and figcaption.
$I->seeElement('figure');
$I->seeElement('figcaption');
$I->scrollTo('figcaption');
$I->see("sore was I ere I saw eros");
}
}