localgovdrupal / localgov_news

Provides news articles and news listing pages for LocalGov Drupal
GNU General Public License v2.0
0 stars 2 forks source link

Use fixed date for news item; add tests for LocalGov Search integration. #74

Closed ekes closed 2 years ago

ekes commented 2 years ago

Suggestion for #73

If the LocalGov Search Integration tests make sense we could quickly add them to all the MRs and prevent regressions on them too.

andybroomfield commented 2 years ago

I'm running the tests on this now.

andybroomfield commented 2 years ago

I'm seeing the following failure

Summary of non-successful tests:

News Search (Drupal\Tests\localgov_news\Functional\NewsSearch)
 ✘ Localgov search
   ┐
   ├ Behat\Mink\Exception\ExpectationException: The string "<strong>bias</strong>" was not found anywhere in the HTML response of the current page.
   │
   ╵ /app/vendor/behat/mink/src/WebAssert.php:794
   ╵ /app/vendor/behat/mink/src/WebAssert.php:324
   ╵ /app/web/core/tests/Drupal/Tests/WebAssert.php:524
   ╵ /app/web/modules/contrib/localgov_news/tests/src/Functional/NewsSearchTest.php:112
   ╵ /app/vendor/phpunit/phpunit/src/Framework/TestResult.php:726
   ┴
ekes commented 2 years ago

Yer I've not been getting that, but on the other test I did the same the github ci did.

Can you run the test with the debugging output on? What is on that page when it fails?

andybroomfield commented 2 years ago
Testing /app/web/modules/contrib/localgov_news
News Page (Drupal\Tests\localgov_news\Functional\NewsPage)
News Page (Drupal\Tests\localgov_news\Functional\NewsPage)
 ✔ News fields
 ✔ News edit form
 ✔ News edit promote checkbox
 ✔ News pages
 [x] News fields
 [x] News edit form
 [x] News edit promote checkbox
 [x] News pages

News Search (Drupal\Tests\localgov_news\Functional\NewsSearch)

News Search (Drupal\Tests\localgov_news\Functional\NewsSearch)
 ✔ News search
 ✘ Localgov search
   ┐
   ├ Behat\Mink\Exception\ExpectationException: The string "<strong>bias</strong>" was not found anywhere in the HTML response of the current page.
   │
   ╵ /app/vendor/behat/mink/src/WebAssert.php:794
   ╵ /app/vendor/behat/mink/src/WebAssert.php:324
   ╵ /app/web/core/tests/Drupal/Tests/WebAssert.php:524
   ╵ /app/web/modules/contrib/localgov_news/tests/src/Functional/NewsSearchTest.php:112
   ╵ /app/vendor/phpunit/phpunit/src/Framework/TestResult.php:726
   ┴
 [x] News search
 [ ] Localgov search

Promoted News Widget (Drupal\Tests\localgov_news\FunctionalJavascript\PromotedNewsWidget)

Promoted News Widget (Drupal\Tests\localgov_news\FunctionalJavascript\PromotedNewsWidget)
 ✔ Promote autocomplete widget
 [x] Promote autocomplete widget

Time: 33:51.822, Memory: 12.00 MB

Summary of non-successful tests:

News Search (Drupal\Tests\localgov_news\Functional\NewsSearch)
 ✘ Localgov search
   ┐
   ├ Behat\Mink\Exception\ExpectationException: The string "<strong>bias</strong>" was not found anywhere in the HTML response of the current page.
   │
   ╵ /app/vendor/behat/mink/src/WebAssert.php:794
   ╵ /app/vendor/behat/mink/src/WebAssert.php:324
   ╵ /app/web/core/tests/Drupal/Tests/WebAssert.php:524
   ╵ /app/web/modules/contrib/localgov_news/tests/src/Functional/NewsSearchTest.php:112
   ╵ /app/vendor/phpunit/phpunit/src/Framework/TestResult.php:726
   ┴

ERRORS!
Tests: 7, Assertions: 107, Errors: 1.

Remaining self deprecation notices (338)

  215x: Calling the Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch() method with a string event name as the first argument is deprecated in drupal:9.1.0, an Event object will be required instead in drupal:10.0.0. See https://www.drupal.org/node/3154407
    41x in NewsPageTest::testNewsPages from Drupal\Tests\localgov_news\Functional
    33x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    30x in NewsSearchTest::testNewsSearch from Drupal\Tests\localgov_news\Functional
    30x in NewsSearchTest::testLocalgovSearch from Drupal\Tests\localgov_news\Functional
    29x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional
    27x in NewsPageTest::testNewsFields from Drupal\Tests\localgov_news\Functional
    25x in PromotedNewsWidgetTest::testPromoteAutocompleteWidget from Drupal\Tests\localgov_news\FunctionalJavascript

  24x: The core/jquery.once asset library is deprecated in Drupal 9.3.0 and will be removed in Drupal 10.0.0. Use the core/once library instead. See https://www.drupal.org/node/3158256
    11x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    6x in NewsPageTest::testNewsPages from Drupal\Tests\localgov_news\Functional
    4x in NewsSearchTest::testNewsSearch from Drupal\Tests\localgov_news\Functional
    3x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional

  17x: The deprecated alter hook hook_field_widget_multivalue_form_alter() is implemented in these functions: localgov_news_field_widget_multivalue_form_alter. Deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use hook_field_widget_complete_form_alter or hook_field_widget_complete_WIDGET_TYPE_form_alter instead. See https://www.drupal.org/node/3180429.
    12x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    5x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional

  17x: The deprecated alter hook hook_field_widget_form_alter() is implemented in these functions: localgov_services_navigation_field_widget_entity_reference_autocomplete_form_alter. Deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use hook_field_widget_single_element_form_alter or hook_field_widget_single_element_WIDGET_TYPE_form_alter instead. See https://www.drupal.org/node/3180429.
    12x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    5x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional

  17x: ModuleHandlerInterface::getImplementations() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Instead you should use ModuleHandlerInterface::invokeAllWith() for hook invocations, or you should use ModuleHandlerInterface::hasImplementations() to determine if hooks implementations exist. See https://www.drupal.org/node/3000490
    12x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    5x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional

  6x: Adding non-existent permissions to a role is deprecated in drupal:9.3.0 and triggers a runtime exception before drupal:10.0.0. The incorrect permissions are "use text format wysiwyg". Permissions should be defined in a permissions.yml file or a permission callback. See https://www.drupal.org/node/3193348
    1x in NewsPageTest::testNewsFields from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsPages from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testNewsSearch from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testLocalgovSearch from Drupal\Tests\localgov_news\Functional

  6x: Adding non-existent permissions to a role is deprecated in drupal:9.3.0 and triggers a runtime exception before drupal:10.0.0. The incorrect permissions are "access page_components entity browser pages", "access paragraphs_library_items entity browser pages", "create document media", "create image media", "create localgov_services_landing content", "create localgov_services_page content", "create localgov_services_sublanding content", "create paragraph library item", "create remote_video media", "delete own document media", "delete own image media", "delete own localgov_services_landing content", "delete own localgov_services_page content", "delete own localgov_services_sublanding content", "delete own remote_video media", "edit any document media", "edit any image media", "edit any remote_video media", "edit own document media", "edit own image media", "edit own localgov_services_landing content", "edit own localgov_services_page content", "edit own localgov_services_sublanding content", "edit own remote_video media", "edit paragraph library item", "revert localgov_services_landing revisions", "revert localgov_services_page revisions", "revert localgov_services_sublanding revisions", "view localgov_services_landing revisions", "view localgov_services_page revisions", "view localgov_services_sublanding revisions". Permissions should be defined in a permissions.yml file or a permission callback. See https://www.drupal.org/node/3193348
    1x in NewsPageTest::testNewsFields from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsPages from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testNewsSearch from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testLocalgovSearch from Drupal\Tests\localgov_news\Functional

  6x: Adding non-existent permissions to a role is deprecated in drupal:9.3.0 and triggers a runtime exception before drupal:10.0.0. The incorrect permissions are "access page_components entity browser pages", "access paragraphs_library_items entity browser pages", "create document media", "create image media", "create localgov_services_landing content", "create localgov_services_page content", "create localgov_services_sublanding content", "create paragraph library item", "create remote_video media", "delete own document media", "delete own image media", "delete own localgov_services_landing content", "delete own localgov_services_page content", "delete own localgov_services_sublanding content", "delete own remote_video media", "edit any document media", "edit any image media", "edit any remote_video media", "edit own document media", "edit own image media", "edit own localgov_services_landing content", "edit own localgov_services_page content", "edit own localgov_services_sublanding content", "edit own remote_video media", "edit paragraph library item", "view localgov_services_landing revisions", "view localgov_services_page revisions", "view localgov_services_sublanding revisions". Permissions should be defined in a permissions.yml file or a permission callback. See https://www.drupal.org/node/3193348
    1x in NewsPageTest::testNewsFields from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsPages from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testNewsSearch from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testLocalgovSearch from Drupal\Tests\localgov_news\Functional

  6x: Adding non-existent permissions to a role is deprecated in drupal:9.3.0 and triggers a runtime exception before drupal:10.0.0. The incorrect permissions are "access page_components entity browser pages", "access paragraphs_library_items entity browser pages", "create document media", "create image media", "create localgov_services_landing content", "create localgov_services_page content", "create localgov_services_sublanding content", "create paragraph library item", "create remote_video media", "delete any document media", "delete any image media", "delete any localgov_services_landing content", "delete any localgov_services_page content", "delete any localgov_services_sublanding content", "delete any remote_video media", "delete localgov_services_landing revisions", "delete localgov_services_page revisions", "delete localgov_services_sublanding revisions", "delete own document media", "delete own image media", "delete own localgov_services_landing content", "delete own localgov_services_page content", "delete own localgov_services_sublanding content", "delete own remote_video media", "edit any document media", "edit any image media", "edit any localgov_services_landing content", "edit any localgov_services_page content", "edit any localgov_services_sublanding content", "edit any remote_video media", "edit own document media", "edit own image media", "edit own localgov_services_landing content", "edit own localgov_services_page content", "edit own localgov_services_sublanding content", "edit own remote_video media", "edit paragraph library item", "revert localgov_services_landing revisions", "revert localgov_services_page revisions", "revert localgov_services_sublanding revisions", "view localgov_services_landing revisions", "view localgov_services_page revisions", "view localgov_services_sublanding revisions". Permissions should be defined in a permissions.yml file or a permission callback. See https://www.drupal.org/node/3193348
    1x in NewsPageTest::testNewsFields from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsPages from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testNewsSearch from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testLocalgovSearch from Drupal\Tests\localgov_news\Functional

  6x: Adding non-existent permissions to a role is deprecated in drupal:9.3.0 and triggers a runtime exception before drupal:10.0.0. The incorrect permissions are "delete own media", "update any image media", "use localgov_editorial transition approve", "use localgov_editorial transition archive", "use localgov_editorial transition archived_draft", "use localgov_editorial transition archived_published", "use localgov_editorial transition create_new_draft", "use localgov_editorial transition publish", "use localgov_editorial transition reject", "use localgov_editorial transition submit_for_review", "view all localgov_news_article revisions", "view any unpublished localgov_news_article content", "view own unpublished localgov_news_article content", "view own media". Permissions should be defined in a permissions.yml file or a permission callback. See https://www.drupal.org/node/3193348
    1x in NewsPageTest::testNewsFields from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    1x in NewsPageTest::testNewsPages from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testNewsSearch from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testLocalgovSearch from Drupal\Tests\localgov_news\Functional

  4x: Declaring ::setUp without a void return typehint in Drupal\Tests\localgov_news\Functional\NewsPageTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    4x in DrupalListener::startTest from Drupal\Tests\Listeners

  4x: The Drupal\Tests\localgov_news\Functional\NewsPageTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    4x in DrupalListener::startTest from Drupal\Tests\Listeners

  3x: module_load_include() is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. Instead, you should use \Drupal::moduleHandler()-&gt;loadInclude(). Note that including code from uninstalled extensions is no longer supported. See https://www.drupal.org/project/drupal/issues/697946
    1x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testNewsSearch from Drupal\Tests\localgov_news\Functional
    1x in NewsSearchTest::testLocalgovSearch from Drupal\Tests\localgov_news\Functional

  2x: Declaring ::setUp without a void return typehint in Drupal\Tests\localgov_news\Functional\NewsSearchTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: The Drupal\Tests\localgov_news\Functional\NewsSearchTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\localgov_news\FunctionalJavascript\PromotedNewsWidgetTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: The Drupal\Tests\localgov_news\FunctionalJavascript\PromotedNewsWidgetTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Adding non-existent permissions to a role is deprecated in drupal:9.3.0 and triggers a runtime exception before drupal:10.0.0. The incorrect permissions are "access toolbar", "delete own media", "update any image media", "use localgov_editorial transition approve", "use localgov_editorial transition archive", "use localgov_editorial transition archived_draft", "use localgov_editorial transition archived_published", "use localgov_editorial transition create_new_draft", "use localgov_editorial transition publish", "use localgov_editorial transition reject", "use localgov_editorial transition submit_for_review", "view all localgov_news_article revisions", "view any unpublished localgov_news_article content", "view own unpublished localgov_news_article content", "view own media". Permissions should be defined in a permissions.yml file or a permission callback. See https://www.drupal.org/node/3193348
    1x in PromotedNewsWidgetTest::testPromoteAutocompleteWidget from Drupal\Tests\localgov_news\FunctionalJavascript

Other deprecation notices (28)

  28x: module_load_include() is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. Instead, you should use \Drupal::moduleHandler()->loadInclude(). Note that including code from uninstalled extensions is no longer supported. See https://www.drupal.org/project/drupal/issues/697946
    8x in NewsSearchTest::testNewsSearch from Drupal\Tests\localgov_news\Functional
    8x in NewsSearchTest::testLocalgovSearch from Drupal\Tests\localgov_news\Functional
    3x in NewsPageTest::testNewsFields from Drupal\Tests\localgov_news\Functional
    3x in NewsPageTest::testNewsEditForm from Drupal\Tests\localgov_news\Functional
    3x in NewsPageTest::testNewsEditPromoteCheckbox from Drupal\Tests\localgov_news\Functional
    3x in NewsPageTest::testNewsPages from Drupal\Tests\localgov_news\Functional
ekes commented 2 years ago

Can you run the test with the debugging output on? What is on that page when it fails?

Sorry. By this I meant.

     <env name="BROWSERTEST_OUTPUT_DIRECTORY" value="/app/web/sites/simpletest/browser_output"/> 

Which will output the HTML of the actual page being visited. Mine has "<strong>bias</strong>" in it - so passes. But it looks like the gitlab-ci one doesn't, but you can't run output HTML in gitlab, so if you have the fail too, we can see what the page actually has in it... like what is the search result then?

ekes commented 2 years ago

Should have been fixed by https://github.com/localgovdrupal/localgov_search/releases/tag/1.1.2 (step by step example was). @andybroomfield if you can double check we can merge this into the PR and merge that PR :)