Adding the skeleton for the test cases based on the skeleton from 7.x

Converting D7 SimpleTests to Drupal 8
Drupal SimpleTest coding standards

Now we have javascript testing in core we can write the tests using:
Javascript end-to-end testing added

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

elachlan created an issue. See original summary.

elachlan’s picture

Issue summary: View changes
FileSize
3.95 KB

First Attempt.

elachlan’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: extlink-2587531-01.patch, failed testing.

elachlan’s picture

Trying again.

elachlan’s picture

Status: Needs work » Needs review

The last submitted patch, 2: extlink-2587531-01.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 5: extlink-2587531-02.patch, failed testing.

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.14 KB

Roll 3, should have paid more attention when copying/pasting.

Status: Needs review » Needs work

The last submitted patch, 9: extlink-2587531-03.patch, failed testing.

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.13 KB

Status: Needs review » Needs work

The last submitted patch, 11: extlink-2587531-04.patch, failed testing.

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.13 KB

Status: Needs review » Needs work

The last submitted patch, 13: extlink-2587531-05.patch, failed testing.

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.17 KB

Status: Needs review » Needs work

The last submitted patch, 15: extlink-2587531-06.patch, failed testing.

Dane Powell’s picture

Ack, I didn't see that you had already started this, and I did my own upgrade of the simple tests from D7.

All this does is test that the admin path is accessible- the same as in D7, and your patch above. If you want to add actual checking of external link functionality, we can add that later once we have a stable testing base.

elachlan’s picture

I would really like to have the base class so that we can write tests a lot easier.

Re-rolled based on changes you made in your patch.

Status: Needs review » Needs work

The last submitted patch, 18: extlink-2587531-18.patch, failed testing.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.92 KB

  • elachlan authored eb5be13 on 8.x-1.x
    Issue #2587531 by elachlan, Dane Powell: Add automated tests
    
elachlan’s picture

I don't think its possible to write a test for detecting if an external link is present because it relies on javascript.

Which means we would have to wait for simpletest to finish:
#2469713: Step 2: Create a JavaScriptTestBase using PhantomJs Driver/Binary.

elachlan’s picture

We might also want to convert the tests to BrowserTestBase.

https://www.drupal.org/node/2469723

elachlan’s picture

Title: Add automated tests » Convert Automated Tests to BrowserTestBase
Status: Needs review » Needs work
elachlan’s picture

Issue summary: View changes
elachlan’s picture

Issue summary: View changes

We can start work on javascript tests now apparently.

elachlan’s picture

Status: Needs work » Needs review
FileSize
1.41 KB

Here is my attempt at doing a test for checking if an external link is present.

Status: Needs review » Needs work

The last submitted patch, 27: extlink-2587531-27.patch, failed testing.

elachlan’s picture

elachlan’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 29: extlink-2587531-29.patch, failed testing.

elachlan’s picture

Status: Needs work » Needs review
FileSize
1.4 KB

Status: Needs review » Needs work

The last submitted patch, 32: extlink-2587531-32.patch, failed testing.

elachlan’s picture

Status: Needs work » Needs review
FileSize
7.84 KB

Status: Needs review » Needs work

The last submitted patch, 34: extlink-2587531-34.patch, failed testing.

The last submitted patch, 34: extlink-2587531-34.patch, failed testing.

borisson_’s picture

  1. +++ /dev/null
    --- /dev/null
    +++ b/tests/src/FunctionalJavascript/ExtlinkAdminTest.php
    
    +++ b/tests/src/FunctionalJavascript/ExtlinkAdminTest.php
    +++ b/tests/src/FunctionalJavascript/ExtlinkAdminTest.php
    @@ -0,0 +1,25 @@
    
    @@ -0,0 +1,25 @@
    +<?php
    +
    +namespace Drupal\Tests\extlink\Functional;
    

    Namespace and directory are not matching, so the testbot can't find any tests.

    Either change the namespace to FunctionalJavascript or change the directory for the test to Functional.

  2. +++ b/tests/src/FunctionalJavascript/ExtlinkAdminTest.php
    @@ -0,0 +1,25 @@
    +  public function testAdminAccess() {
    

    None of the assertions here need js, so you should probably move that into a normal BTB test, as those are faster than the JS-tests.

Also, try to use git diff -M to create patches as that tracks moved files much better.

elachlan’s picture

Thanks for your help!

elachlan’s picture

Status: Needs work » Needs review
FileSize
5.04 KB

Status: Needs review » Needs work

The last submitted patch, 39: extlink-2587531-39.patch, failed testing.

elachlan’s picture

Status: Needs work » Needs review
FileSize
7.9 KB

Status: Needs review » Needs work

The last submitted patch, 41: extlink-2587531-41.patch, failed testing.