Problem/Motivation

#2004690: taxonomy page broken inspired us to write tests for all the forms where we add a translate link into the operations.
#1971384: [META] Convert page callbacks to controllers Drupal Code Sprint Kyiv 2013

Proposed resolution

Add tests.

Remaining tasks

  • Do one test first.
  • Get a review.
  • Do the rest.

User interface changes

No.

API changes

No.

Related

Files: 
CommentFileSizeAuthor
#36 test_all_lists-2004710-36.patch6.56 KBYesCT
PASSED: [[SimpleTest]]: [MySQL] 378 pass(es).
[ View ]
#36 interdiff-34-36.txt4 KBYesCT
#34 test_all_lists-2004710-35.patch6.66 KBkfritsche
PASSED: [[SimpleTest]]: [MySQL] 378 pass(es).
[ View ]
#34 interdiff-31-34.txt8.4 KBkfritsche
#31 test_all_lists-2004710-31.patch6.26 KBkfritsche
FAILED: [[SimpleTest]]: [MySQL] 377 pass(es), 1 fail(s), and 0 exception(s).
[ View ]
#31 interdiff-25-31.txt7.25 KBkfritsche
#25 test_all_lists-2004710-25.patch5.49 KBYesCT
FAILED: [[SimpleTest]]: [MySQL] 366 pass(es), 5 fail(s), and 0 exception(s).
[ View ]
#25 interdiff-20-25.txt5.51 KBYesCT
#21 Screenshot - 04.06.2013 - 11:14:05.png58.59 KBlikin
#20 test_all_lists-2004710-20.patch4.89 KBYesCT
FAILED: [[SimpleTest]]: [MySQL] 367 pass(es), 5 fail(s), and 0 exception(s).
[ View ]
#20 interdiff-15-20.txt1.53 KBYesCT
#15 test_all_lists-2004710-15.patch5.13 KBYesCT
FAILED: [[SimpleTest]]: [MySQL] 302 pass(es), 11 fail(s), and 2 exception(s).
[ View ]
#15 interdiff-13-15.txt1.73 KBYesCT
#13 test_all_lists-2004710-13.patch4.65 KBYesCT
FAILED: [[SimpleTest]]: [MySQL] 297 pass(es), 12 fail(s), and 1 exception(s).
[ View ]
#13 interdiff-11-13.txt1.2 KBYesCT
#11 standard_profile_translate_operation.png142.01 KBYesCT
#11 test_all_lists-2004710-11.patch4.53 KBYesCT
FAILED: [[SimpleTest]]: [MySQL] 296 pass(es), 8 fail(s), and 1 exception(s).
[ View ]
#11 interdiff-9-11.txt980 bytesYesCT
#9 test_all_lists-2004710-9.patch4.44 KBYesCT
FAILED: [[SimpleTest]]: [MySQL] 303 pass(es), 11 fail(s), and 1 exception(s).
[ View ]
#9 interdiff-7-9.txt0 bytesYesCT
#7 test_all_lists-2004710-7.patch3.45 KBYesCT
FAILED: [[SimpleTest]]: [MySQL] 289 pass(es), 10 fail(s), and 1 exception(s).
[ View ]
#7 interdiff-5-7.txt2 KBYesCT
#5 test_all_lists-2004710-5.patch3.01 KBYesCT
FAILED: [[SimpleTest]]: [MySQL] 287 pass(es), 10 fail(s), and 1 exception(s).
[ View ]
#5 interdiff-3-5.txt3.51 KBYesCT
#3 test_all_lists-2004710-3.patch1.56 KBYesCT
FAILED: [[SimpleTest]]: [MySQL] 275 pass(es), 7 fail(s), and 0 exception(s).
[ View ]

Comments

#1998600: Block config translation fails also needs test coverage yeah. We can write those tests here at once I think. I believe we only test views translatability and not all of the UI steps there either in the navigation chain.

current idea:

look for:

<li class="translate odd last dropbutton-action secondary-action">
<a href="/drupal/admin/structure/menu/manage/admin/translate">Translate</a>

Assigned:Unassigned» YesCT
Status:Active» Needs review
StatusFileSize
new1.56 KB
FAILED: [[SimpleTest]]: [MySQL] 275 pass(es), 7 fail(s), and 0 exception(s).
[ View ]

tests were taking a long time to run, so I just took my one little one out and put it in a different class.
it runs much faster. can be moved back in later after it's nicer.

fails locally on taxonomy.

next: try it on a listing that works like menu and make sure it passes.

because it is a copy, it has extra permissions and such... for now.

Status:Needs review» Needs work

The last submitted patch, test_all_lists-2004710-3.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new3.51 KB
new3.01 KB
FAILED: [[SimpleTest]]: [MySQL] 287 pass(es), 10 fail(s), and 1 exception(s).
[ View ]

I'm having trouble getting a test that would pass for menus. Here is what I have so far.
The verbose from running test locally, shows *no* translate operation in the drop-buttons... uh, and I don't know why it's different in the test than locally on a site install. Permission for config_translation looks to be being added ok.

Status:Needs review» Needs work

The last submitted patch, test_all_lists-2004710-5.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new2 KB
new3.45 KB
FAILED: [[SimpleTest]]: [MySQL] 289 pass(es), 10 fail(s), and 1 exception(s).
[ View ]

code improvements and trying the menu translate link directly.

Status:Needs review» Needs work

The last submitted patch, test_all_lists-2004710-7.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new0 bytes
new4.44 KB
FAILED: [[SimpleTest]]: [MySQL] 303 pass(es), 11 fail(s), and 1 exception(s).
[ View ]

Tried looking at views... still no translate link in the drop button. So @xjm recommended seeing if profile made a difference and then trying as user 1. So about to do that now.

Here is where I am for now. ... Organized each of the tests that we will need to have, into sections... alphabetically.

Status:Needs review» Needs work

example from moduleapitest
on how to force using standard profile.

  // Requires Standard profile modules/dependencies.
  protected $profile = 'standard';

Status:Needs work» Needs review
StatusFileSize
new980 bytes
new4.53 KB
FAILED: [[SimpleTest]]: [MySQL] 296 pass(es), 8 fail(s), and 1 exception(s).
[ View ]
new142.01 KB

Note to self... turning of xdebug makes things run much faster.

turning on standard profile *does* make the translate operation show.

standard_profile_translate_operation.png

Next, identify what parts of standard profile are needed, add them to setup and then take the standard profile back off.

Status:Needs review» Needs work

The last submitted patch, test_all_lists-2004710-11.patch, failed testing.

Status:Needs work» Needs review
StatusFileSize
new1.2 KB
new4.65 KB
FAILED: [[SimpleTest]]: [MySQL] 297 pass(es), 12 fail(s), and 1 exception(s).
[ View ]

I found I could install locally with minimal and play around with what is the difference. I found that blocks seems to have translate link in operations with minimal profile. so trying that in the tests.

Status:Needs review» Needs work

The last submitted patch, test_all_lists-2004710-13.patch, failed testing.

Assigned:YesCT» Unassigned
Status:Needs work» Needs review
StatusFileSize
new1.73 KB
new5.13 KB
FAILED: [[SimpleTest]]: [MySQL] 302 pass(es), 11 fail(s), and 2 exception(s).
[ View ]

in the tests, the blocks list is empty.
here block module and permission are added.

attempted to place an existing block, just guessing/grepping for id and machine name.
strange errors in the test results, but I'm taking a break from this.

Use of undefined constant system_menu_tools - assumed 'system_menu_tools'
Drupal\config_translation\Tests\ConfigTranslationListUITest->testTranslateOperationInListUI()
Drupal\simpletest\TestBase->run()
...

Status:Needs review» Needs work

+++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.phpundefined
@@ -0,0 +1,143 @@
+ * Tests for listings altered by Configuration Translation module.
...
+ * Tests for altered listings that should have Translate operation.

I forgot to take out the word "for". "Tests" should be a verb.

....
needs work ... for other more important things.

Assigned:Unassigned» likin
Issue tags:+CodeSprintUA

Assigned:likin» YesCT

likin, I'm going to try something @larowlan showed me from #1869476: Convert global menus (primary links, secondary links) into blocks
$this->drupalPlaceBlock('menu_navigation', array('region' => 'secondary_menu'), array('menu' => 'account'));
ping me in irc if you have some work to post before I give it a try.

This patches confuse me. Because they are not applicable. Could anybody filter the content of the issue and clarify the task?

Status:Needs work» Needs review
StatusFileSize
new1.53 KB
new4.89 KB
FAILED: [[SimpleTest]]: [MySQL] 367 pass(es), 5 fail(s), and 0 exception(s).
[ View ]

It was a while since I worked on this too. :) After a few minutes I remembered to apply it to the git clone of the config_translation project which is in modules directory. :) Then it applies.

@tim.plunkett picked out an easier block to add.

here it is.
I ran the test locally and I can see the block added to the block list *and* Translate in the dropbutton. So we can then test that Translate link is there next.

StatusFileSize
new58.59 KB

yes, I'm not sure why Translate operation link does not get added to the menus in minimal profile. ... but I think the *test* is ok.

Does this work manually?

Manualy. It works.

Assigned:YesCT» Unassigned
StatusFileSize
new5.51 KB
new5.49 KB
FAILED: [[SimpleTest]]: [MySQL] 366 pass(es), 5 fail(s), and 0 exception(s).
[ View ]

cleaned up some intermediate tries at testing.
some tests still needed.

unassigning, taking a break from this for a bit.

when trying manually, try it on a minimal profile.
also, run the test locally to see the verbose message screens.

Nice work! One thing to keep in mind is that the minimal profile and the testing profile are two different profiles.

A few suggestions:

  1. +++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.phpundefined
    @@ -0,0 +1,154 @@
    +    // Test if Translate appears anywhere on the page.
    +    $this->assertText($translate_operation_title);
    ...
    +    // Simple test for 'Translate' anywhere on the taxonomy list page.
    +    $this->drupalGet($list_url);
    +    $this->assertText($translate_operation_title);

    This assertion is probably redundant now that we have the check for the translate link.

  2. +++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.phpundefined
    @@ -0,0 +1,154 @@
    +    $translate_link = 'admin/structure/block/manage/stark.' . $block_machine_name . '/translate';
    +    // Test if the link to translate the block is on the page.
    +    $this->assertLinkByHref($translate_link);

    This assertion is the core of what we want to test -- looks good!

  3. +++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.phpundefined
    @@ -0,0 +1,154 @@
    +    // Create a test menu to decouple looking for Translate operations
    +    // link so this does not test more than necessary.
    +    $this->drupalGet('admin/structure/menu/add');
    +    // Lowercase the machine name. Find the issue that is supposed to be making
    +    // randomMachineName().
    +    $menu_name = drupal_strtolower($this->randomName(16));
    +    $label = $this->randomName(16);
    +    $edit = array(
    +      'id' => $menu_name,
    +      'description' => '',
    +      'label' =>  $label,
    +    );
    +    $this->drupalPost('admin/structure/menu/add', $edit, t('Save'));

    Once this is working (I think it is?), a good next step would be to create the menu link programmatically instead of with drupalPost(). (Similarly for the vocabulary.)

  4. +++ b/lib/Drupal/config_translation/Tests/ConfigTranslationListUITest.phpundefined
    @@ -0,0 +1,154 @@
    +    // Views 'admin/structure/views'.
    +    // Frontpage view is enabled in test minimal profile, so do not need to add
    +    // a test view.
    +    $list_url = 'admin/structure/views';

    So, it's bad practice to rely on default anything provided by the testing profile. We always want a decoupled test implementation.

    In this case, this couples the test to both the Node module and the Frontpage view. See #1541298: Remove Node module dependency from Testing profile.

    So, instead, I'd suggest putting this in a separate test that uses one of the Views' modules base classes and test views.

Status:Needs review» Needs work
Issue tags:-CodeSprintUA

The last submitted patch, test_all_lists-2004710-25.patch, failed testing.

Status:Needs work» Needs review

The test was stuck, so I cancelled and requeued it.

#25: test_all_lists-2004710-25.patch queued for re-testing.

Issue summary:View changes

I've got time to work with this task. I am working with Kyiv Drupal initiative.

Status:Needs review» Needs work
Issue tags:+CodeSprintUA

The last submitted patch, test_all_lists-2004710-25.patch, failed testing.

Assigned:Unassigned» kfritsche

Working on this now.

StatusFileSize
new7.25 KB
new6.26 KB
FAILED: [[SimpleTest]]: [MySQL] 377 pass(es), 1 fail(s), and 0 exception(s).
[ View ]

Moved the single test to do*ListTest() function to have a better structured test and not everything in this single function. Moved the views test to a new Test which extends the UITestBase.

The test is now working, except the new View test. I'm currently trying to figure out how it works.
But 1., 3. and 4. from #26 should be fixed.

Still lots of other Tests are marked as todo.

Status:Needs work» Needs review

Set to needs review.

Status:Needs review» Needs work

The last submitted patch, test_all_lists-2004710-31.patch, failed testing.

Assigned:kfritsche» Unassigned
StatusFileSize
new8.4 KB
new6.66 KB
PASSED: [[SimpleTest]]: [MySQL] 378 pass(es).
[ View ]

View Test works now.
Minor cleanup with comments.
More tomorrow.

Status:Needs work» Needs review

As always forgot status change...

StatusFileSize
new4 KB
new6.56 KB
PASSED: [[SimpleTest]]: [MySQL] 378 pass(es).
[ View ]

Here is a clean up on just that.

I suggest we commit this, and then add the rest of the tests later. This can let the testbot go with these good tests that we have while we add the rest.

Status:Needs review» Fixed

I agree that the test to land now would be useful. Thanks, committed! We may want to work on a followup or more followups to complete the coverage.

Title:Add tests for all the forms to see if they have translate link in operationsAdd tests for block, menu, vocabulary and views listings
Issue tags:+D8MI, +language-config

Retitled for what was achieved. I think continuing in #2019831: people and roles page broken would be good, adding tests for roles to verify the before/after break/pass of that patch. I asked @kfritsche to work on that next.

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Needs work

I have problems wih the test. I am resolving this issue. https://drupal.org/node/1978916.
I receive a lot of test errors that are not related with my task. Could anybody make some specifications? Where should I move? I understand I need correct tests. But, there are many tests. I do not know where to start.

Status:Needs work» Closed (fixed)

@likin Thanks for working on that issue.

I think it is not a related to this config_translation issue though, so re-closing this.

Issue summary:View changes

added related