Looks like the automated tests are not turned on https://www.drupal.org/node/2582081/qa

Not sure why its like this, but I would like to see the tests running against the patches.

I tried to run the tests locally and there are some issues. The Field UI is not enabled and the user cannot access "admin/structure/types/manage/article/display"

This should work

Comments

marcelovani created an issue. See original summary.

marcelovani’s picture

Status: Active » Needs review
StatusFileSize
new1.33 KB

Fixes:
1 - Enable field_ui
2 - Created a protected variable for admin_user and did the login on setUp()
3 - Set necessary permissions for Admin user:

  • access content
  • access administration pages
  • administer site configuration
  • administer content types
  • administer nodes
  • administer fields
  • create article content

ps: The test won't run automatically because it's turned off on the module's project page. Hope we can turn that back on now.

marcelovani’s picture

StatusFileSize
new1.84 KB

One more change needed

$edit is being overriden on the next line in

$edit = ["fields[field_image][type]" => 'amp_image'];
$edit = ["fields[body][type]" => 'amp_text'];

Fix:

    $edit = [
      "fields[field_image][type]" => 'amp_image',
      "fields[body][type]" => 'amp_text',
    ];
marcelovani’s picture

Assigned: marcelovani » Unassigned
marcelovani’s picture

marcelovani’s picture

StatusFileSize
new1.84 KB

Re-rolled patch

Status: Needs review » Needs work

The last submitted patch, 6: automated_tests-2862134-6.patch, failed testing.

marcelovani’s picture

StatusFileSize
new2.81 KB

Found a possible solution for the autoloader, without using composer_manager
https://www.drupal.org/node/2597778#comment-11838528

I also created a helper module just to add the include

marcelovani’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 8: automated_tests-2862134-7.patch, failed testing.

marcelovani’s picture

Status: Needs work » Needs review
StatusFileSize
new3.24 KB

Debugging Drupal CI

Status: Needs review » Needs work

The last submitted patch, 11: debug_ci.patch, failed testing.

marcelovani’s picture

Status: Needs work » Needs review
StatusFileSize
new3.16 KB

Status: Needs review » Needs work

The last submitted patch, 13: debug_ci.patch, failed testing.

marcelovani’s picture

Status: Needs work » Needs review
StatusFileSize
new2.61 KB

Trying to figure out what's being outputted on the page

marcelovani’s picture

StatusFileSize
new3.57 KB

Status: Needs review » Needs work

The last submitted patch, 16: debug_ci.patch, failed testing.

marcelovani’s picture

Found it: Clean urls to blame

https://www.drupal.org/pift-ci-job/654426

fail: [Other] Line 67 of sites/all/modules/amp/tests/amp.test:
Debug: http://localhost/checkout/node/1?amp VS http://localhost/checkout/?q=node/1&amp
marcelovani’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new3.65 KB

Status: Needs review » Needs work

The last submitted patch, 19: edit_automated_tests-2862134-19.patch, failed testing.

marcelovani’s picture

Status: Needs work » Needs review
StatusFileSize
new3.66 KB

Of course, when Clean urls are disabled, the first argument will have ? and the amp argument will have &

Status: Needs review » Needs work

The last submitted patch, 21: edit_automated_tests-2862134-20.patch, failed testing.

marcelovani’s picture

Status: Needs work » Needs review
StatusFileSize
new3.66 KB

Again

marcelovani’s picture

Finally I got this working, its really hard to reproduce locally that happens on Drupal CI.
The fact that Clean urls are disabled is something to keep in mind when writing tests that should work with this setting on/off. I even thought about changing the setting with variable_set and test both cases, but maybe its not really necessary.

The other problem was the dependency on composer_manager, since its not a required module, it doesn't get checked out during the build. I found an acceptable workaround by doing an include to the autoloader generated by composer during the build.
Also, I put this on a dedicated helper module that gets enabled during testing run time only.

One last thing to address, but in another ticket perhaps, is that the themes are not being downloaded for the same reasons.

mtift’s picture

Status: Needs review » Fixed

Looks good to me. Thanks for getting this working, marcelovani!

Committed to 7.x-1.x

Status: Fixed » Closed (fixed)

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