Support Translation Test

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

killua99 created an issue. See original summary.

naveenvalecha’s picture

Title: Test Support Translation » Add tests coverage for configuration translation
Issue tags: +Novice, +Needs tests
naveenvalecha’s picture

Parent issue: #2695913: [META] Add tests »
ivan berezhnov’s picture

Issue tags: +CSKyiv18
useernamee’s picture

Hi.
I have put together some phpunit tests. There is a functional test that is testing the form.
Than I have also created a functional javascript test that actually compares the popup with what should be inserted. As a byproduct I have also created a functional javascript test that checks if popup is working when you click on different pages (if accept on click is set to false).

This module doesn't work the best in phantomjs and that took me a lot of time. So it's still work in progress. I hope I get some advice before I continue.
Problems:
- I don't know why it doesn't print out 'popup_info' (FunctionalJavascript tests)
- I don't know why it doesn't use translated 'popup_find_more_button_message' (EuCookieComplianceTranslationJavascriptTest)
Todo:
- Write some more comments
- Code cleanup

svenryen’s picture

Status: Active » Needs work

Hi! Looks mostly good. Just have a few remarks.

  1. +++ b/tests/src/FunctionalJavascript/EuCookieComplianceJavascriptTest.php
    @@ -0,0 +1,91 @@
    +    // $this->assertSession()->elementContains('css', '#popup-text', 'Mast je mastna');.
    

    Why is this line commented out?

  2. +++ b/tests/src/FunctionalJavascript/EuCookieComplianceJavascriptTest.php
    @@ -0,0 +1,91 @@
    +    // $this->assertSession()->elementNotContains('css', '#popup-text', 'Mast je mastna');.
    

    Same with this one :)

idebr’s picture

Status: Needs work » Needs review
Issue tags: -Novice, -Needs tests
StatusFileSize
new14.29 KB
new12.59 KB
  1. The 'popup_info' was not printed because the filter configuration was not available. I have enabled the filter and filter_test modules so you have a few filter configurations available.
  2. popup_find_more_button_message was not printed, because this is actually popup_disagree_button_message
  3. Switched to WebDriverTestBase, see the change record: JavascriptTestBase is deprecated in favor of WebDriverTestBase.
svenryen’s picture

@idebr Do you have any steps for how to validate this patch? I'm not the most familiar with WebDriver tests.

idebr’s picture

The tests programmatically installs and configures the module and then checks events on the page. There is documentation available on running them locally, so you can see the test run in a browser. See https://www.drupal.org/docs/8/phpunit/phpunit-javascript-test-writing-tu...

svenryen’s picture

Thanks. Seems like the instructions for actually running the tests were at https://www.drupal.org/docs/8/phpunit/running-phpunit-javascript-tests

I'll have a look at this next week.

idebr’s picture

Updated #7 with the latest changes in HEAD

Status: Needs review » Needs work
idebr’s picture

Status: Needs work » Needs review
StatusFileSize
new11.74 KB
new817 bytes

One more change.

svenryen’s picture

If anybody is free to review this, that would be really fantastic.
Thanks for the updates, @idebr!

anybody’s picture

Status: Needs review » Needs work

Whao, TESTS are really really needed for this module. This is a fantastic little first step!

We need a lot more of that to test all functionalities and their combinations! But that's a different issue ;)

Sadly #13 fails with PHP 7.3 & MySQL 5.7, Drupal 8.9.x so this needs work.

svenryen’s picture

Title: Add tests coverage for configuration translation » [2.x] Add tests coverage for configuration translation

Marking this to see if we can make use of it for 2.x

svenryen’s picture

New tests needs to be written once we develop 2.x

svenryen’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
atowl’s picture

Title: [2.x] Add tests coverage for configuration translation » Add tests coverage for configuration translation
Version: 2.0.x-dev » 8.x-1.x-dev

Hi,
Might move this to the version 1, i've put some tests in but these were pretty basic and this might be better.

kieran.cott made their first commit to this issue’s fork.

  • atowl committed ec47e66e on 8.x-1.x authored by kieran.cott
    Issue #2751465: Add tests coverage for configuration translation
    
kieran.cott’s picture

Status: Needs work » Needs review

Hi folks - I've used the patch in #13 to add some configuration translation tests in MR 186, and added a few more fields for additional coverage.

kieran.cott’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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