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-3871: Update tests for call for proposals. #1381

Merged
merged 2 commits into from
Jan 30, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#}
{% extends '@oe_theme/patterns/field_list/pattern-field-list.html.twig' %}
{% block content %}
<div class="ecl-u-border-top ecl-u-border-bottom ecl-u-border-color-grey-15 ecl-u-mt-l ecl-u-mb-l ecl-u-pt-l ecl-u-pb-l">
<div class="ecl-u-border-top ecl-u-border-bottom {{ ecl_class_border_color() }} ecl-u-mt-l ecl-u-mb-l ecl-u-pt-l ecl-u-pb-l">
{{ parent() }}
</div>
{% endblock %}
5 changes: 2 additions & 3 deletions tests/src/Functional/ContentCallForProposalsRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ protected function setUp(): void {
* Tests full page of Call for proposals.
*/
public function testProposalRendering(): void {
$this->markTestSkipped('Must be re-enabled before considering migration to ECL 4 as complete.');
// Freeze the time at a specific point.
$static_time = new DrupalDateTime('2020-02-17 14:00:00', DateTimeItemInterface::STORAGE_TIMEZONE);
$this->freezeTime($static_time);
Expand All @@ -76,7 +75,7 @@ public function testProposalRendering(): void {
$this->drupalGet($node->toUrl());

// Assert page header - metadata.
$page_header = $this->assertSession()->elementExists('css', '.ecl-page-header.ecl-page-header--negative');
$page_header = $this->assertSession()->elementExists('css', '.ecl-page-header');
$assert = new PatternPageHeaderAssert();
$header_expected_values = [
'title' => 'Test Call for proposals node',
Expand Down Expand Up @@ -276,7 +275,7 @@ public function testProposalRendering(): void {
$node->save();
$this->drupalGet($node->toUrl());

$results_field_group = $content_items[0]->find('css', 'div.ecl-u-border-top.ecl-u-border-bottom.ecl-u-border-color-grey-15.ecl-u-mt-l.ecl-u-mb-l.ecl-u-pt-l.ecl-u-pb-l');
$results_field_group = $content_items[0]->find('css', 'div.ecl-u-border-top.ecl-u-border-bottom.ecl-u-border-color-neutral-40.ecl-u-mt-l.ecl-u-mb-l.ecl-u-pt-l.ecl-u-pb-l');
$results_expected_values = [
'items' => [
[
Expand Down
7 changes: 4 additions & 3 deletions tests/src/Functional/ContentRenderTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,14 @@ protected function assertMediaDocumentDefaultRender(NodeElement $element, string
// Assert documents file.
$file_wrapper = $element->find('css', 'div.ecl-file');
$file_row = $file_wrapper->find('css', '.ecl-file .ecl-file__container');
$file_footer = $file_wrapper->find('css', '.ecl-file .ecl-file__footer');
$file_title = $file_row->find('css', '.ecl-file__title');
$this->assertStringContainsString($name, $file_title->getText());
$file_info_language = $file_row->find('css', '.ecl-file__info div.ecl-file__language');
$file_info_language = $file_footer->find('css', ' div.ecl-file__language');
$this->assertStringContainsString($language, $file_info_language->getText());
$file_info_properties = $file_row->find('css', '.ecl-file__info div.ecl-file__meta');
$file_info_properties = $file_footer->find('css', 'div.ecl-file__meta');
$this->assertStringContainsString("($meta)", $file_info_properties->getText());
$file_download_link = $file_row->find('css', '.ecl-file__download');
$file_download_link = $file_footer->find('css', '.ecl-file__download');
$this->assertStringContainsString($link, $file_download_link->getAttribute('href'));
$this->assertStringContainsString($button_label, $file_download_link->getText());
}
Expand Down
1 change: 0 additions & 1 deletion tests/src/Kernel/CallForProposalsRenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ protected function setUp(): void {
* Test a call for proposals being rendered as a teaser.
*/
public function testTeaser(): void {
$this->markTestSkipped('Must be re-enabled before considering migration to ECL 4 as complete.');
// Freeze the time at a specific point.
$static_time = new DrupalDateTime('2020-02-17 14:00:00', DateTimeItemInterface::STORAGE_TIMEZONE);

Expand Down
14 changes: 8 additions & 6 deletions tests/src/PatternAssertions/FileAssert.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected function getAssertions($variant): array {
return [
'button_label' => [
[$this, 'assertElementText'],
'div.ecl-file div.ecl-file__container a.ecl-file__download span.ecl-link__label',
'div.ecl-file div.ecl-file__footer a.ecl-file__download span.ecl-link__label',
],
'file' => [
[$this, 'assertFile'],
Expand All @@ -42,13 +42,15 @@ protected function assertBaseElements(string $html, string $variant): void {
*/
protected function assertFile(array $expected_file, Crawler $crawler): void {
// Assert information.
$file_info_element = $crawler->filter('div.ecl-file div.ecl-file__container div.ecl-file__info');
$this->assertElementText($expected_file['title'], 'div.ecl-file__title', $file_info_element);
$this->assertElementText($expected_file['language'], 'div.ecl-file__language', $file_info_element);
$this->assertElementText($expected_file['meta'], 'div.ecl-file__meta', $file_info_element);
$file_container = $crawler->filter('div.ecl-file div.ecl-file__container');
$this->assertElementText($expected_file['title'], 'div.ecl-file__title', $file_container);
$file_footer = $crawler->filter('div.ecl-file div.ecl-file__footer');

$this->assertElementText($expected_file['language'], 'div.ecl-file__language', $file_footer);
$this->assertElementText($expected_file['meta'], 'div.ecl-file__meta', $file_footer);

// Assert download link.
$this->assertElementAttribute($expected_file['url'], 'div.ecl-file div.ecl-file__container a.ecl-file__download', 'href', $crawler);
$this->assertElementAttribute($expected_file['url'], 'div.ecl-file div.ecl-file__footer a.ecl-file__download', 'href', $crawler);

// Assert icon.
$icon = $crawler->filter('div.ecl-file div.ecl-file__container svg.ecl-file__icon use');
Expand Down