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
PHPUnit Browser test tutorial

CommentFileSizeAuthor
#125 extlinktest-2587531-128.patch5.62 KBelachlan
#124 extlinktest-2587531-126.patch5.31 KBelachlan
#122 extlinktest-2587531-124.patch5.33 KBelachlan
#120 extlinktest-2587531-122.patch5.38 KBelachlan
#118 extlinktest-2587531-120.patch5.38 KBelachlan
#116 extlinktest-2587531-118.patch5.03 KBelachlan
#114 extlinktest-2587531-116.patch4.95 KBelachlan
#113 extlinktest-2587531-114.patch4.94 KBelachlan
#112 extlinktest-2587531-112.patch3.26 KBelachlan
#110 extlinktest-2587531-110.patch3.34 KBelachlan
#108 extlinktest-2587531-108.patch3.4 KBelachlan
#106 extlinktest-2587531-106.patch3.59 KBelachlan
#104 extlinktest-2587531-104.patch3.52 KBelachlan
#102 extlinktest-2587531-102.patch4.3 KBelachlan
#100 extlinktest-2587531-100.patch4.25 KBelachlan
#98 extlinktest-2587531-98.patch4.16 KBelachlan
#96 extlinktest-2587531-96.patch4.15 KBelachlan
#94 extlinktest-2587531-94.patch4.27 KBelachlan
#92 extlinktest-2587531-92.patch4.22 KBelachlan
#90 extlinktest-2587531-90.patch4.12 KBelachlan
#88 extlinktest-2587531-88.patch4.01 KBelachlan
#86 extlinktest-2587531-86.patch4 KBelachlan
#83 extlinktest-2587531-83.patch3.97 KBelachlan
#81 extlinktest-2587531-82.patch3.97 KBelachlan
#79 extlinktest-2587531-80.patch3.97 KBelachlan
#76 extlinktest-2587531-76.patch3.5 KBangelamnr
#74 extlink-2587531-76.diff3.97 KBelachlan
#72 extlink-2587531-74.diff3.96 KBelachlan
#70 extlink-2587531-72.diff3.9 KBelachlan
#68 extlink-2587531-70.diff3.96 KBelachlan
#66 extlink-2587531-68.diff3.95 KBelachlan
#64 extlink-2587531-64.diff3.93 KBelachlan
#62 extlink-2587531-62.diff3.94 KBelachlan
#60 extlink-2587531-60.diff3.94 KBelachlan
#58 extlink-2587531-58.diff3.94 KBelachlan
#56 extlink-2587531-56.diff3.94 KBelachlan
#54 extlink-2587531-54.diff4.17 KBelachlan
#52 extlink-2587531-52.diff4.17 KBelachlan
#50 extlink-2587531-50.diff4.23 KBelachlan
#48 extlink-2587531-48.diff4.17 KBelachlan
#46 extlink-2587531-46.diff4.18 KBelachlan
#44 extlink-2587531-44.diff4.16 KBelachlan
#41 extlink-2587531-41.patch7.9 KBelachlan
#39 extlink-2587531-39.patch5.04 KBelachlan
#34 extlink-2587531-34.patch7.84 KBelachlan
#32 extlink-2587531-32.patch1.4 KBelachlan
#29 extlink-2587531-29.patch1.4 KBelachlan
#27 extlink-2587531-27.patch1.41 KBelachlan
#20 extlink-2587531-19.patch3.92 KBelachlan
#18 extlink-2587531-18.patch3.97 KBelachlan
#17 extlink-2587531-17.patch2.16 KBDane Powell
#15 extlink-2587531-06.patch4.17 KBelachlan
#13 extlink-2587531-05.patch4.13 KBelachlan
#11 extlink-2587531-04.patch4.13 KBelachlan
#9 extlink-2587531-03.patch4.14 KBelachlan
#5 extlink-2587531-02.patch3.94 KBelachlan
#2 extlink-2587531-01.patch3.95 KBelachlan
Support from Acquia helps fund testing for Drupal Acquia logo

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.

mradcliffe’s picture

new file mode 100644
index 0000000..2b43ecc
--- /dev/null
+++ b/tests/src/FunctionalJavascript/ExtlinkTestBase.php
@@ -0,0 +1,78 @@
+abstract class ExtlinkTestBase extends JavascriptTestBase {
+  public function setUp() {
+    // Enable any module that you will need in your tests.
+    parent::setUp();
+    // Create a normal user.
+    $permissions = array();
+    $this->normalUser = $this->drupalCreateUser($permissions);
+
+    // Create an admin user.
+    $permissions[] = 'administer site configuration';
+    $permissions[] = 'administer permissions';
+    $this->adminUser = $this->drupalCreateUser($permissions);
+  }

It looks like user creation methods for functional javascript tests are moved into the UserCreationTrait::createUser.

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.16 KB

Status: Needs review » Needs work

The last submitted patch, 44: extlink-2587531-44.diff, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.18 KB

Status: Needs review » Needs work

The last submitted patch, 46: extlink-2587531-46.diff, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.17 KB

Status: Needs review » Needs work

The last submitted patch, 48: extlink-2587531-48.diff, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.23 KB

Status: Needs review » Needs work

The last submitted patch, 50: extlink-2587531-50.diff, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.17 KB

Status: Needs review » Needs work

The last submitted patch, 52: extlink-2587531-52.diff, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.17 KB

Status: Needs review » Needs work

The last submitted patch, 54: extlink-2587531-54.diff, failed testing. View results

elachlan’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
3.94 KB

Status: Needs review » Needs work

The last submitted patch, 56: extlink-2587531-56.diff, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.94 KB

Status: Needs review » Needs work

The last submitted patch, 58: extlink-2587531-58.diff, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.94 KB

Status: Needs review » Needs work

The last submitted patch, 60: extlink-2587531-60.diff, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.94 KB

Status: Needs review » Needs work

The last submitted patch, 62: extlink-2587531-62.diff, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.93 KB

Status: Needs review » Needs work

The last submitted patch, 64: extlink-2587531-64.diff, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.95 KB

Status: Needs review » Needs work

The last submitted patch, 66: extlink-2587531-68.diff, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.96 KB

Status: Needs review » Needs work

The last submitted patch, 68: extlink-2587531-70.diff, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.9 KB

Status: Needs review » Needs work

The last submitted patch, 70: extlink-2587531-72.diff, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.96 KB

Status: Needs review » Needs work

The last submitted patch, 72: extlink-2587531-74.diff, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.97 KB

Status: Needs review » Needs work

The last submitted patch, 74: extlink-2587531-76.diff, failed testing. View results

angelamnr’s picture

Hi, I've been working on this a bit in my free time and I'm happy to help out.

elachlan’s picture

Status: Needs work » Needs review

Thanks for looking at it!

Status: Needs review » Needs work

The last submitted patch, 76: extlinktest-2587531-76.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.97 KB

Status: Needs review » Needs work

The last submitted patch, 79: extlinktest-2587531-80.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.97 KB

Status: Needs review » Needs work

The last submitted patch, 81: extlinktest-2587531-82.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.97 KB

Status: Needs review » Needs work

The last submitted patch, 83: extlinktest-2587531-83.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

I think we are closer. For some reason I think the page isn't loading properly.

I have been looking at examples like:
https://api.drupal.org/api/drupal/core%21modules%21book%21tests%21src%21...

There is a list that use createnode at:
https://api.drupal.org/api/drupal/core%21modules%21node%21tests%21src%21...

elachlan’s picture

Status: Needs work » Needs review
FileSize
4 KB

Status: Needs review » Needs work

The last submitted patch, 86: extlinktest-2587531-86.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.01 KB

Status: Needs review » Needs work

The last submitted patch, 88: extlinktest-2587531-88.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.12 KB

Status: Needs review » Needs work

The last submitted patch, 90: extlinktest-2587531-90.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.22 KB

Status: Needs review » Needs work

The last submitted patch, 92: extlinktest-2587531-92.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.27 KB

Status: Needs review » Needs work

The last submitted patch, 94: extlinktest-2587531-94.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.15 KB

Status: Needs review » Needs work

The last submitted patch, 96: extlinktest-2587531-96.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.16 KB

Status: Needs review » Needs work

The last submitted patch, 98: extlinktest-2587531-98.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.25 KB

Status: Needs review » Needs work

The last submitted patch, 100: extlinktest-2587531-100.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
4.3 KB

Status: Needs review » Needs work

The last submitted patch, 102: extlinktest-2587531-102.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.52 KB

Status: Needs review » Needs work

The last submitted patch, 104: extlinktest-2587531-104.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.59 KB

Status: Needs review » Needs work

The last submitted patch, 106: extlinktest-2587531-106.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.4 KB

Status: Needs review » Needs work

The last submitted patch, 108: extlinktest-2587531-108.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.34 KB

Status: Needs review » Needs work

The last submitted patch, 110: extlinktest-2587531-110.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
3.26 KB
elachlan’s picture

elachlan’s picture

Status: Needs review » Needs work

The last submitted patch, 114: extlinktest-2587531-116.patch, failed testing. View results

elachlan’s picture

Status: Needs work » Needs review
FileSize
5.03 KB

Status: Needs review » Needs work

The last submitted patch, 116: extlinktest-2587531-118.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
5.38 KB

Status: Needs review » Needs work

The last submitted patch, 118: extlinktest-2587531-120.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
5.38 KB

Status: Needs review » Needs work

The last submitted patch, 120: extlinktest-2587531-122.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
5.33 KB

Status: Needs review » Needs work

The last submitted patch, 122: extlinktest-2587531-124.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

elachlan’s picture

Status: Needs work » Needs review
FileSize
5.31 KB
elachlan’s picture

elachlan’s picture

Managed to get it working, here is the screenshot from the test:
https://dispatcher.drupalci.org/job/drupal8_contrib_patches/27367/artifa...

  • elachlan committed 0e10ba5 on 8.x-1.x
    Issue #2587531 by elachlan, Dane Powell, angelamnr: Convert Automated...
elachlan’s picture

Status: Needs review » Fixed

Additional tests to be added in #2961572: Expand Javascript Functional Tests.

Status: Fixed » Closed (fixed)

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