Commit Graph

641 Commits

Author SHA1 Message Date
Pablo Zmdl
28034645ca Tests for external window 2025-07-08 08:05:02 +02:00
Pablo Zmdl
734225c04d WIP: PrintToPDF 2025-06-17 14:38:52 +02:00
Pablo Zmdl
ff58dd4c44 Wait until iframes have been loaded 2025-04-24 15:12:49 +02:00
Pablo Zmdl
3a9ad6b3e3 Remove rcmail_html_page
The calling code replaced the $rcmail->output on the fly, which makes is
hardly testable.
Also that class was used only in the class `rcmail_action_mail_get`, and
it's a pretty thin layer on top of `rcmail_output_html`, which is not
necessary.
2025-04-24 15:12:49 +02:00
Pablo Zmdl
08dc83b918 Replace REMOTE_OBJECTS with an attribute on the body element
We need the information in the browser, because the
remote-objects-message is now rendered independently from the message
contents, and we need it for each message part.
2025-04-24 15:12:49 +02:00
Pablo Zmdl
1019b462d3 Render each mime part in an individual, sandboxed iframe
This includes a new "message loading" notice without meta refresh (which
requires unsafe-inline in a CSP, which we want to avoid)
2025-04-24 15:12:49 +02:00
Aleksander Machniak
ab08ade64a Use object-oriented style of Fileinfo functionality
finfo_close() is rudundant since PHP 8.1 and might get deprecated in PHP 8.5
2025-04-23 15:45:05 +02:00
Aleksander Machniak
640ab6d0ea Fix phpstan issue 2025-04-21 14:32:55 +02:00
Aleksander Machniak
8208b9f87d Fix bug in handling rcmail::format_date()'s $convert argument (#9666) 2025-04-21 12:28:14 +02:00
Aleksander Machniak
093231905d Tests: Cleanup/refactor around HTTP client mocking 2025-04-06 14:54:20 +02:00
Aleksander Machniak
f9fc356dff More tests for static.php 2025-04-05 15:56:18 +02:00
Aleksander Machniak
22884d5da1 Tests: Rise PHP server process startup time 2025-04-05 13:41:40 +02:00
Aleksander Machniak
5fab389625 Add (incomplete) tests for static.php and installer.php 2025-04-05 13:31:04 +02:00
Aleksander Machniak
09a1c86079 Fix phpunit.xml 2025-03-16 16:52:13 +01:00
Aleksander Machniak
dc9f6943a4 Bump minimum phpunit version to v10 2025-03-16 16:20:47 +01:00
Aleksander Machniak
344260db89 Bump laravel/dusk version 2025-03-16 13:46:29 +01:00
Aleksander Machniak
94fd5a0f80 CS fixes (for the new fixer version rules) 2025-02-23 11:51:27 +01:00
Aleksander Machniak
781f006ed2 Fix PHP warning 2025-02-16 14:16:35 +01:00
Aleksander Machniak
44f0ac5b00 Fix folder list sorting when using personal namespace prefix of INBOX/ (#9452) 2025-02-16 12:40:37 +01:00
Aleksander Machniak
64df318a73 Add static files server (#9294)
Make use of public_html mandatory
2025-02-09 14:10:50 +01:00
Pablo Zmdl
752b152a23 Check if attachment is actually(!) referred to (#9585)
* Check if "inline" msg part is actually referred to

If there's no reference to it in a sibling HTML part then we handle it
as a classic attachment (which is shown as downloadable).

* Fetch all msg headers also for images to always get Content-Location

Previously all headers were only fetched for message/rfc822, or
if the Content-Type's "name" parameter was set, or if a Content-ID was
set.
The RFC doesn't require neither the "name" parameter nor a Content-ID
for using Content-Location, though, so we shouldn't depend on those.

Instead now all headers are also fetched if the main part of the
Content-Type is "image", to catch more cases.

* Parse HTML for references only on demand

* Typos and comment formatting

* Don't skip test anymore

We want it tested!

* More MR tests with images

* Remove early special handling for "inline" images

We decide later, which attachment is considered "inline" and which
isn't.

* Remove early resolving of references in TNEF parts

* Testing message rendering of TNEF emails

* Don't use image disposition, it's unreliable

* Split adding raw parts and attachments

* Fix renaming variable

* Rename file to make its test be run

* Remove outdated script

* Annotate test cases with GitHub issue numbers

* Fix test case class name

* remove comment

* Test inline image message rendering

* Rename test file to reflect cases better

* Reduce image used in test email

It doesn't change much, but there's also no sense in decoding big images
that we don't use.

* Remove unused variable initialisation
2025-02-09 09:56:43 +01:00
Aleksander Machniak
41eaff2839 Fix decoding of attachment names encoded using both RFC2231 and RFC2047 standards (#9725) 2025-02-02 13:58:39 +01:00
Pablo Zmdl
d877302e50 Fix displaying message/rfc822 parts (#9753)
* Fix displaying message/rfc822 parts

The previous code contained a simple error that assigned the body part
to the $headers variable (which then couldn't be parsed and got
discarded).

* Test rendering of attached message/rfc822 parts
2025-01-15 18:27:05 +01:00
Pablo Zmdl
c8e4a029aa Merge branch 'master' into list-loading 2025-01-03 16:39:01 +01:00
PhilW
e4d952f814 wait for list to load in Browser\Contacts\ExportTest::testExportSelected test 2025-01-03 14:55:33 +00:00
Aleksander Machniak
4bde475ea1 Fix handling of binary mail parts (e.g. PDF) encoded with quoted-printable (#9728) 2025-01-01 13:27:30 +01:00
Pablo Zmdl
46d25161dc Test message rendering (#9460) 2024-12-19 19:01:25 +01:00
Michael Voříšek
efcdce84ba Keep phpstan strict rules testing (#9424)
* Revert "Get rid of phpstan/phpstan-strict-rules"

This reverts commit ff59ade31a.

* drop phpstan baseline

* fix foreach phpstan issue

* adjust for rebase

* fix method call case

* ignore one phpstan error even after isset
2024-11-20 08:13:16 +01:00
Pablo Zmdl
06c5e019b7 Test config option rule: null -> hardcoded default, false -> disabled (#9684) 2024-11-05 19:20:14 +01:00
Aleksander Machniak
d6a6d04e40 Fix test
On some systems (Fedora 40) `which unknown` outputs error string
2024-10-28 18:35:44 +01:00
Aleksander Machniak
b1e47a8fa5 Fix tests (#9682) 2024-10-28 18:30:51 +01:00
Pablo Zmdl
d31c536f24 Fix test by make sorting independent of locale and case (#9640)
* Install requited locale in container image

One of the IMAP tests curiuosly ran successfully on Github-runners, but
failed locally. This is the pre-condition for a fix.

* Explicitly require mandatory locale for test

This test works only if executed with LC_COLLATE=en_US

* Schedule to rebuild testrunner image each week
2024-09-19 06:53:20 +02:00
respiranto
6159ebeb02 vcard: Fix whitespace handling in line cont's (#9637)
* vcard: Fix whitespace handling in line cont's

Previously, multiple whitespace characters at the start of a
continuation line would all be dropped, instead of only the first one.

Also,
 - restrict line continuation characters to SPACE and TAB.

Note that, like before, this identifies the CR (`\r`) character with the
empty string, and thereby notably does not require a CRLF (`\r\n`)
sequence (which is mandated by RFCs 2426, 2425) for line termination
(i.e., `\n` suffices).

Fixes: Bug 1 of issue #9593.

* vcard: Add test for #9593/1

* Fix coding style
2024-09-18 13:26:43 +02:00
Pablo Zmdl
818df3b13f Fix downloading files in tests with new Chromiums (#9627)
* Fix downloading files in tests with new Chromiums

Newer versions of chromium apparently need these flags to download files
without prompting the user.

* Expose port to watch remote browser

This allows to watch the remote controlled browser in your browser at
<http://localhost:7900/?autoconnect=1&resize=scale&password=secret>
(you have to comment out the `--headless` argument in TestCase::driver()
before).
2024-09-05 14:32:09 +02:00
Aleksander Machniak
7c8968f4fe Use new HTML5 parser available on PHP >= 8.4 2024-09-01 15:27:35 +02:00
Aleksander Machniak
58721e3037 Fix regression where HTML messages were displayed unstyled (#9586) 2024-08-16 19:56:51 +02:00
Aleksander Machniak
53218006e1 Fix test 2024-08-08 15:09:38 +02:00
Aleksander Machniak
ec4b837783 Fix tests regression 2024-08-04 10:59:56 +02:00
Aleksander Machniak
825fb4fb58 Fix tests regression 2024-08-04 10:53:03 +02:00
Aleksander Machniak
c686939dd8 CS fix 2024-08-04 10:33:50 +02:00
Aleksander Machniak
e12e273c0c More tests 2024-08-04 10:28:16 +02:00
Aleksander Machniak
c99dcacddb - Fix information leak (access to remote content) via insufficient CSS filtering [CVE-2024-42010]
Credits to Oskar Zeino-Mahmalat (https://www.sonarsource.com)
2024-08-04 10:27:18 +02:00
Aleksander Machniak
40a4a71b67 Fix XSS vulnerability in post-processing of sanitized HTML content [CVE-2024-42009]
Credits to Oskar Zeino-Mahmalat (https://www.sonarsource.com)
2024-08-04 10:25:49 +02:00
Pablo Zmdl
85094706f9 Docker compose for testing (#9525)
* More ignore-patterns in eslint config

So we don't have to specify them on the command line when we check
codestyle locally.

* Test setup for local and CI using containers

It uses standalone containers for the greenmail IMAP server and the
standalone browser.
A testrunner image is built in the CI (for `linux/amd64` only, because
Github doesn't support multi-platform building on their default
runners and we don't have our own.)

This setup helps to run the tests (reproduceably) also locally.
Previously, on my machine, they produced varying results.
It also reduces the dependencies for running the browser test.
Local execution only depends on `docker compose`, no other tools
(previously it required `sudo`, `java`, and some more.)

The previous solution should still work, if you want it.

The scripts are stored in a directory called `.ci` to hide them a little
and avoid confusion with the container images from the
`roundcubemail-docker` repo.

* Fix UI tests by waiting for element before using it

This only was a flaky problem only occurring sometimes.

* Force a new IMAP connection in plugin tests, too

In other code the initial connection is forced. Doing this here, too,
fixes occasional problems with lost imap connections.

* Make waiting for zipfile's content more robust

* CI: Run tests from script on Windows, too

* CI: Do start local chrome if no connect URL is given

* Move compose.yml to tests/

This way it's less easy mistaken as usable for running Roundcubemail in
production.

* Move compose.yml to .ci/
2024-07-22 11:44:09 +02:00
Aleksander Machniak
a8218b1eeb Fix bug where some messages could get malformed in an import from a MBOX file (#9510) 2024-07-17 20:34:55 +02:00
Aleksander Machniak
613629f83a Fix decoding mail parts with multiple base64-encoded text blocks (#9290) 2024-06-16 12:47:56 +02:00
Michael Voříšek
6377477eb2 Add PHPUnit 10.x and 11.x support (#9480)
* Add PHPUnit 10.x and 11.x support

* fix undefined TestCase::getName() for PHPUnit 10+

* Add PHPUnit attributes but keep annotations
2024-06-13 18:40:29 +02:00
Michael Voříšek
f4272804d6 Rename test files for PHPUnit 10+ (#9477) 2024-06-05 07:46:51 +02:00
Aleksander Machniak
ed0f9b5f67 Fix typo 2024-06-02 18:45:44 +02:00
Aleksander Machniak
62ba39123c Add missing #[\Override] attribute 2024-06-02 18:42:40 +02:00