Problem/Motivation

Head is currently failing, seems like again because of [#2847274]

Proposed resolution

If it's in fact because of the mentioned core change tweak the trait ParagraphsCoreVersionUiTestTrait adapter method.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#24 fix_head_test_fails-2902554-24.patch29.68 KBPrimsi
#24 interdiff-fix_head_test_fails-2902554-24.patch.txt29.68 KBPrimsi
#21 fix_head_test_fails-2902554-21.patch98.77 KBPrimsi
#21 interdiff-fix_head_test_fails-2902554-21.patch.txt6.02 KBPrimsi
#19 fix_head_test_fails-2902554-19.patch97.71 KBPrimsi
#19 interdiff-fix_head_test_fails-2902554-19.patch.txt1.6 KBPrimsi
#18 fix_head_test_fails-2902554-18.patch97.14 KBPrimsi
#18 interdiff-fix_head_test_fails-2902554-18.patch.txt4.91 KBPrimsi
#16 fix_head_test_fails-2902554-16.patch95.5 KBPrimsi
#16 interdiff-fix_head_test_fails-2902554-16.patch.txt14.24 KBPrimsi
#14 fix_head_test_fails-2902554-14.patch94.99 KBPrimsi
#14 interdiff-fix_head_test_fails-2902554-14.patch.txt17.29 KBPrimsi
#13 fix_head_test_fails-2902554-13.patch94.46 KBPrimsi
#13 interdiff-fix_head_test_fails-2902554-13.patch.txt87.48 KBPrimsi
#9 fix_head_test_fails-2902554-9.patch93.3 KBPrimsi
#9 interdiff-fix_head_test_fails-2902554-9.patch.txt12.64 KBPrimsi
#6 fix_head_test_fails-2902554-6.patch93.2 KBPrimsi
#6 interdiff-fix_head_test_fails-2902554-6.patch.txt93.2 KBPrimsi
#4 fix_head_test_fails-2902554-4.patch93.11 KBPrimsi
#2 fix_head_test_fails-2902554-2.patch92.45 KBPrimsi
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Primsi created an issue. See original summary.

Primsi’s picture

Status: Active » Needs review
FileSize
92.45 KB

Changed the existing method so we don't need to do the same again for future versions.

Status: Needs review » Needs work

The last submitted patch, 2: fix_head_test_fails-2902554-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Primsi’s picture

Status: Needs work » Needs review
FileSize
93.11 KB

Retry.

Status: Needs review » Needs work

The last submitted patch, 4: fix_head_test_fails-2902554-4.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Primsi’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: fix_head_test_fails-2902554-6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 9: fix_head_test_fails-2902554-9.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

miro_dietiker’s picture

+++ b/src/Tests/Classic/ParagraphsCoreVersionUiTestTrait.php
@@ -8,26 +8,51 @@ namespace Drupal\paragraphs\Tests\Classic;
+    if ($drupal_version > 8.3) {
+      switch ($submit) {
...
+          $edit['status[value]'] = FALSE;

I don't like to see this code read like outdated 8.3 API and then implicitly make it compatible with >8.3

Instead IMHO it should read like interacting with 8.4+ and implement backwards compatibility.

So there are still some fails left? :-)

Berdir’s picture

+++ b/src/Tests/Classic/ParagraphsCoreVersionUiTestTrait.php
@@ -8,26 +8,51 @@ namespace Drupal\paragraphs\Tests\Classic;
+  protected function paragraphsPostNodeForm($path, $edit, $submit, array $options = [], array $headers = [], $form_html_id = NULL, $extra_post = NULL) {
+    $drupal_version = (float) substr(\Drupal::VERSION, 0, 3);
+    if ($drupal_version > 8.3) {
+      switch ($submit) {
+        case  t('Save and unpublish'):
+          $submit = t('Save');
+          $edit['status[value]'] = FALSE;
+          break;
+
+        case t('Save and publish'):
+          $submit = t('Save');
+          $edit['status[value]'] = TRUE;
+          break;
+
+        case t('Save and keep published (this translation)'):
+          $submit = t('Save (this translation)');
+          break;
+

This is IMHO backwards because as soon as 8.4.0 is stable (if not before, in the past we never cared), there is no reason to keep tests working on 8.3 and we want to remove this stuff again. But then we'd have to change all those calls again.

If we do keep that method, I would recommend to invert it and map to old submit instead.

However, the thing is that all this is only necessary because all our tests have "administer nodes" permission, but you only need that if you want to control revision checkbox or status and a few other things.

Without that permission, it is always just Save, that's what I did in the drag drop test.

So my recommendation would be to remove that permission by default and just do some BC for the few tests that actually need to change revision/status. I would imagine that we have almost no tests doing that.

Primsi’s picture

Initial stab at the above mentioned approach. Hopefully I got that correctly.

Also was not sure if the translations related buttons remain the same or not, let's see.

Primsi’s picture

Addressing search/replace ouches spotted by @Berdir. Bonus scope creep with an additional ;; in paragraphs.module.

Status: Needs review » Needs work

The last submitted patch, 14: fix_head_test_fails-2902554-14.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Primsi’s picture

Fixing translation related stuff (hopefully).

Status: Needs review » Needs work

The last submitted patch, 16: fix_head_test_fails-2902554-16.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Primsi’s picture

Primsi’s picture

Fixing this two fails. This should do it for 8.4 (and 8.5?) What should we do then with < 8.4? we switch default testing branch to 8.4 and ignore older versions, or do we use the adapter method?

Status: Needs review » Needs work

The last submitted patch, 19: fix_head_test_fails-2902554-19.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Primsi’s picture

If we decide to care only about 8.4+ here is a patch with the removed compatibility trait.

miro_dietiker’s picture

Committing this from #19 as tests regularly pass.

For 8.3 it seems there's something wrong with the compatibility layer. The condition looks wrong to me.

Primsi’s picture

Berdir’s picture

  1. +++ b/src/Tests/Classic/ParagraphsTranslationTest.php
    @@ -112,9 +114,10 @@ class ParagraphsTranslationTest extends ParagraphsTestBase {
           'field_paragraphs_demo[0][subform][status][value]' => FALSE,
    -      'field_paragraphs_demo[1][subform][field_paragraphs_demo][0][subform][field_text_demo][0][value]' => 'Dummy text'
    +      'field_paragraphs_demo[1][subform][field_paragraphs_demo][0][subform][field_text_demo][0][value]' => 'Dummy text',
    +      'status[value]' => FALSE,
         ];
    -    $this->drupalPostForm(NULL, $edit + ['status[value]' => FALSE], t('Save'));
    +    $this->paragraphsPostLegacyNodeForm(NULL, $edit, t('Save'), t('Save and keep published'));
         $this->assertNoText(t('Example published and unpublished'));
    

    this seems wrong, status FALSE but keep published?

  2. +++ b/src/Tests/Experimental/ParagraphsExperimentalEntityTranslationWithNonTranslatableParagraphs.php
    @@ -9,6 +11,8 @@ namespace Drupal\paragraphs\Tests\Experimental;
    @@ -79,7 +83,7 @@ class ParagraphsExperimentalEntityTranslationWithNonTranslatableParagraphs exten
    
    @@ -79,7 +83,7 @@ class ParagraphsExperimentalEntityTranslationWithNonTranslatableParagraphs exten
           'title[0][value]' => 'Title English',
         ];
    -    $this->drupalPostForm(NULL, $edit, t('Save'));
    +    $this->paragraphsPostLegacyNodeForm(NULL, $edit, t('Save'), t('Save and publish'));
     
         // Add french translation.
    

    Ah, so a lot of these are needed because we are creating admin roles. Didn't even know that API exists.

    Looks like the only reason for example this class does that is to create languages through the UI, but ConfigurableLangugae::createFromLanguage()->save() is much easier than that and then we might be OK with the standard admin permissions/user?

miro_dietiker’s picture

Priority: Normal » Minor
Berdir’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.