Unit/System Tests No Code Attached Yet bug
avatar brianteeman
brianteeman
14 Dec 2023

Steps to reproduce the issue

run the cypress e2e tests for frontend->com_privacy->request

Expected result

all 6 tests for Test in frontend that the privacy request view pass

Actual result

all 6 tests fail - examples below

can submit an information request of type export without a menu item

TypeError
Cannot read properties of undefined (reading 'sender')
[tests/System/integration/site/components/com_privacy/Request.cy.js:33:28](https://j5.test/__/#)
  31 |           cy.get('.alert-message').should('contain.text', 'Your information request has been created. Before it can be processed, you must verify this request. An email has been sent to your address with additional instructions to complete this verification.');
  32 |           cy.wrap(mails).should('have.lengthOf', 2);
> 33 |           cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
     |                            ^
  34 |           cy.wrap(mails[0].body).should('have.string', `A new information request has been submitted by ${Cypress.env('email')}.`);
  35 |           cy.wrap(mails[1].body).should('have.string', 'Someone has created a request to export all personal information related to this email address at ');
  36 |         });

can submit an information request of type remove without a menu item

TypeError
Cannot read properties of undefined (reading 'sender')
[tests/System/integration/site/components/com_privacy/Request.cy.js:65:28](https://j5.test/__/#)
  63 |           cy.get('.alert-message').should('contain.text', 'Your information request has been created. Before it can be processed, you must verify this request. An email has been sent to your address with additional instructions to complete this verification.');
  64 |           cy.wrap(mails).should('have.lengthOf', 2);
> 65 |           cy.wrap(mails[0].sender).should('equal', Cypress.env('email'));
     |                            ^
  66 |           cy.wrap(mails[0].body).should('have.string', `A new information request has been submitted by ${Cypress.env('email')}.`);
  67 |           cy.wrap(mails[1].body).should('have.string', 'Someone has created a request to remove all personal information related to this email address at ');
  68 |         });

can verify link sent to user is valid

TypeError
Cannot read properties of undefined (reading 'body')
[tests/System/integration/site/components/com_privacy/Request.cy.js:96:28](https://j5.test/__/#)
  94 | 
  95 |     cy.task('getMails').then((mails) => {
> 96 |       const str = mails[1].body;
     |                            ^
  97 | 
  98 |       const firstSplitURL = str.split('paste your token into the form.\n')[1];
  99 |       const secondSplitURL = firstSplitURL.split('URL: ')[1];

System information (as much as possible)

Additional comments

avatar brianteeman brianteeman - open - 14 Dec 2023
avatar joomla-cms-bot joomla-cms-bot - change - 14 Dec 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Dec 2023
avatar alikon alikon - change - 3 Mar 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-03-03 07:10:49
Closed_By alikon
avatar alikon alikon - close - 3 Mar 2024
avatar alikon
alikon - comment - 3 Mar 2024

Closing this issue now, has been resolved elsewhere
but feel free to reopen if needed.

avatar brianteeman
brianteeman - comment - 3 Mar 2024

No not resolved

avatar alikon alikon - change - 3 Mar 2024
Status Closed New
Closed_Date 2024-03-03 07:10:49
Closed_By alikon
avatar alikon alikon - reopen - 3 Mar 2024
avatar alikon
alikon - comment - 3 Mar 2024

i'm unable to reproduce nor drone

avatar Hackwar Hackwar - change - 26 Mar 2024
Labels Added: bug
avatar Hackwar Hackwar - labeled - 26 Mar 2024
avatar brianteeman
brianteeman - comment - 4 May 2024

@muhme any thoughts on fixing this.

avatar muhme
muhme - comment - 5 May 2024

yes, @alikon and me are working on it; it is probably the same cause as in #42515; it is most likely related to smtp-tester which is used in Cypress JavaScript to stub SMTP; we therefore check all five specs with mail usage:

  • tests/System/integration/administrator/components/com_config/Application.cy.js,tests/System/integration/site/components/com_users/Remind.cy.js,tests/System/integration/site/components/com_privacy/Request.cy.js,tests/System/integration/site/components/com_users/Reset.cy.js,tests/System/integration/api/com_contact/Contacts.cy.js

I cannot reproduce the failures on macOS local or macOS docker and continue to work on Ubuntu docker first and Windows next. On the way implementing and testing my docker installation I saw exactly such kind of errors always if the SMTP stub is not reachable.

Which environment are you using for testing?

avatar brianteeman
brianteeman - comment - 5 May 2024

Which environment are you using for testing?

Windows 11 using laragon as my amp stack

  • APACHE/2.4.57 (WIN64)
  • OPENSSL/1.1.1
  • PHP/8.3.3
avatar muhme
muhme - comment - 6 May 2024

yeah, these six tests also fail on Ubuntu-docker with TypeError: Cannot read properties of undefined (reading 'sender/body') ?

avatar brianteeman
brianteeman - comment - 6 May 2024

thanks for confirming.

I wonder why they dont fail on drone when run there. OR maybe they are not running

avatar alikon
alikon - comment - 6 May 2024

not sure what is the root cause honestly, on laragon which i've discovered recently, fail ,whatever, settings you set or at least in my tests, if it fail on ubuntu too....
some times ago i've had an image in wich all works like in drone ... but forgot settings

avatar brianteeman
brianteeman - comment - 6 May 2024

the entire point of tests is that they should produce the same results on all supported environments

avatar muhme
muhme - comment - 8 May 2024

yeah, these six tests also fail on Ubuntu-docker with TypeError: Cannot read properties of undefined (reading 'sender/body') ?

Unfortunately, I can't confirm myself ? After also scripting the Ubuntu configuration and setting up a new VPS, the five 'smtp-tester'-related tests are now running without problems on ubuntu-docker. I verified this with one more VPS (more powerful, 8-cores, CPU-optimised) – in ubunto-docker there are no problems with the 5 specs. I suspect my fault was due to the Ubuntu firewall as the port for SMTP needs to be open and I was somehow too focussed to see the error. However, I have ordered a Windows 11 miniPC and will repeat the test with laragon ... ?

avatar muhme
muhme - comment - 12 May 2024

with my new miniPC tested on Windows 11 / Laragon / PHP 8.1 / joomla-cms branch 5.1-dev

  • noticeable was that on the Cypress installation step there was an error in writing configuration.php -> configured mailer 'smtp' and smtpport 1025 etc. manually -> could you please double check your configuration.php settings?
  • tested three times on the command line with Electron - all 6 test cases passed
     npm run cypress:run -- --spec tests\System\integration\site\components\com_privacy\Request.cy.js
    
  • tested three times from Cypress GUI com_privacy - Request
    • with Electron - all 6 test cases passed
    • with Chrome - all 6 test cases passed
    • with Edge - all 6 test cases passed

As I cannot reproduce the problem, I will discuss in next ATT call how to proceed.

avatar alikon alikon - change - 17 May 2024
Labels Added: Unit/System Tests
avatar alikon alikon - labeled - 17 May 2024
avatar brianteeman brianteeman - change - 20 May 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-05-20 11:24:59
Closed_By brianteeman
avatar brianteeman brianteeman - close - 20 May 2024
avatar brianteeman
brianteeman - comment - 20 May 2024

The problem was that the tests require
public $mailer = 'smtp';
public $smtphost = 'localhost';
public $smtpport = 1025;

Add a Comment

Login with GitHub to post a comment