Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ steps:
- name: prepare_system_tests
depends_on:
- npm
image: joomlaprojects/docker-images:cypress8.1
image: joomlaprojects/docker-images:cypress8.4
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
Expand All @@ -149,19 +149,19 @@ steps:
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cmysql mysqli mysql
- bash tests/System/entrypoint.sh "$(pwd)" cmysql mysqli mysql

- name: phpmax-system-mysql
depends_on:
- phpmin-system-mysql
image: joomlaprojects/docker-images:cypress8.2
image: joomlaprojects/docker-images:cypress8.3
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cmysqlmax mysqli mysql
- bash tests/System/entrypoint.sh "$(pwd)" cmysqlmax mysqli mysql
when:
event:
exclude:
Expand All @@ -170,7 +170,7 @@ steps:
- name: phpnext-system-mysql
depends_on:
- phpmax-system-mysql
image: joomlaprojects/docker-images:cypress8.3
image: joomlaprojects/docker-images:cypress8.4
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
Expand All @@ -180,7 +180,7 @@ steps:
commands:
- echo "This test is disabled because php next is not stable yet"
- exit 1
- bash tests/System/drone-system-run.sh "$(pwd)" cmysqlnext mysqli mysql
- bash tests/System/entrypoint.sh "$(pwd)" cmysqlnext mysqli mysql
when:
event:
exclude:
Expand All @@ -196,7 +196,7 @@ steps:
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgres pgsql postgres
- bash tests/System/entrypoint.sh "$(pwd)" cpostgres pgsql postgres
when:
event:
exclude:
Expand All @@ -205,19 +205,19 @@ steps:
- name: phpmax-system-postgres
depends_on:
- phpmin-system-postgres
image: joomlaprojects/docker-images:cypress8.2
image: joomlaprojects/docker-images:cypress8.3
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
environment:
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
commands:
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgresmax pgsql postgres
- bash tests/System/entrypoint.sh "$(pwd)" cpostgresmax pgsql postgres

- name: phpnext-system-postgres
depends_on:
- phpmax-system-postgres
image: joomlaprojects/docker-images:cypress8.3
image: joomlaprojects/docker-images:cypress8.4
volumes:
- name: cypress-cache
path: /root/.cache/Cypress
Expand All @@ -227,7 +227,7 @@ steps:
commands:
- echo "This test is disabled because php next is not stable yet"
- exit 1
- bash tests/System/drone-system-run.sh "$(pwd)" cpostgresnext pgsql postgres
- bash tests/System/entrypoint.sh "$(pwd)" cpostgresnext pgsql postgres
when:
event:
exclude:
Expand Down Expand Up @@ -433,6 +433,6 @@ trigger:

---
kind: signature
hmac: 1d94d558654c2898eea3360184eede03be6b48154c110579fe0254ea0780d91a
hmac: caca91b7aa40832a891260e03c42f8b7fc31b6971d201bf69291a87b158d5ce7

...
2 changes: 1 addition & 1 deletion cypress.config.dist.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineConfig({
setupNodeEvents(on, config) {
setupPlugins(on, config);
},
baseUrl: 'http://localhost/',
baseUrl: 'https://localhost/',
specPattern: [
'tests/System/integration/install/**/*.cy.{js,jsx,ts,tsx}',
'tests/System/integration/administrator/**/*.cy.{js,jsx,ts,tsx}',
Expand Down
7 changes: 7 additions & 0 deletions tests/System/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,10 @@ If you encounter the following error while running the System Tests on slow mach
...
}
```

## Docker
The system tests can also be executed in headless mode with docker compose. The following command does a cleanup and then starts the system tests from the current docker-compose.yml file:

`docker compose down && docker compose up system-tests`

The database is used with a temporary filesystem, so the data always gets deleted when the tests are started, therefor the installation test must be performed as the first step. The webserver is accessible on the host from http://localhost:8080 or https://localhost:8443 and PHPMyAdmin on http://localhost:8081.
17 changes: 0 additions & 17 deletions tests/System/cypress-system-run.sh

This file was deleted.

38 changes: 38 additions & 0 deletions tests/System/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
services:
system-tests:
image: joomlaprojects/docker-images:cypress8.4
environment:
CYPRESS_VERIFY_TIMEOUT: 100000
JOOMLA_INSTALLATION_DISABLE_LOCALHOST_CHECK: 1
entrypoint: bash /app/tests/System/entrypoint.sh /app j mysqli mysql
depends_on:
- phpmyadmin
ports:
- 8080:80
- 8443:443
volumes:
- ../..:/app
- /tmp/cypress-cache:/root/.cache/Cypress
working_dir: /app

mysql:
image: mysql:8.3
environment:
MYSQL_USER: joomla_ut
MYSQL_PASSWORD: joomla_ut
MYSQL_ROOT_PASSWORD: joomla_ut
MYSQL_DATABASE: test_joomla
command: --default-authentication-plugin=mysql_native_password
tmpfs:
- /var/lib/mysql

phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
PMA_HOST: mysql
PMA_USER: joomla_ut
PMA_PASSWORD: joomla_ut
depends_on:
- mysql
ports:
- 8081:80
17 changes: 16 additions & 1 deletion tests/System/drone-system-run.sh → tests/System/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env bash

# This script is intended to be used as a docker entrypoint file within a joomlaprojects/docker-images:cypressX image
# Check out the docker-compose.yml file how to prepare docker to run it or execute `docker compose up system-tests`.

set -e
JOOMLA_BASE=$1
TEST_GROUP=$2
Expand All @@ -24,4 +28,15 @@ apache2ctl -D FOREGROUND &
echo "[RUNNER] Run cypress tests"
chmod +rwx /root

npx cypress run --browser=firefox --e2e --env cmsPath=/tests/www/$TEST_GROUP,db_type=$DB_ENGINE,db_host=$DB_HOST,db_password=joomla_ut,db_prefix="${TEST_GROUP}_" --config baseUrl=http://localhost/$TEST_GROUP,screenshotsFolder=$JOOMLA_BASE/tests/System/output/screenshots
# Copy the cypress config if it doesn't exist
if [ ! -f cypress.config.mjs ]; then
cp cypress.config.dist.mjs cypress.config.mjs
fi

# Do an install if the cache folder is empty
if [ -z "$( ls -A '/root/.cache/Cypress' )" ]; then
npx cypress install
npx cypress verify
fi

npx cypress run --browser=firefox --e2e --env cmsPath=/tests/www/$TEST_GROUP,db_type=$DB_ENGINE,db_host=$DB_HOST,db_password=joomla_ut,db_prefix="${TEST_GROUP}_" --config baseUrl=https://localhost/$TEST_GROUP,screenshotsFolder=$JOOMLA_BASE/tests/System/output/screenshots
1 change: 1 addition & 0 deletions tests/System/integration/install/Installation.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ describe('Install Joomla', () => {
cy.config_setParameter('mailer', 'smtp');
cy.config_setParameter('smtphost', Cypress.env('smtp_host'));
cy.config_setParameter('smtpport', Cypress.env('smtp_port'));
cy.config_setParameter('force_ssl', '2');
});
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('Test in frontend that the newsfeeds details view', () => {
['joomla.org'].forEach((file) => {
it(`can display a feed in a menu item from ${file}`, () => {
cy.db_createNewsFeed({ name: 'automated test feed 1', link: `${Cypress.config('baseUrl')}/tests/System/data/com_newsfeeds/${file}.xml` })
cy.db_createNewsFeed({ name: 'automated test feed 1', link: `${Cypress.config('baseUrl').replace('https://', 'http://')}/tests/System/data/com_newsfeeds/${file}.xml` })
.then((feed) => cy.db_createMenuItem({ title: 'automated test feeds', link: `index.php?option=com_newsfeeds&view=newsfeed&id=${feed.id}` }))
.then(() => {
cy.visit('/');
Expand All @@ -14,7 +14,7 @@ describe('Test in frontend that the newsfeeds details view', () => {
});

it(`can display a feed without a menu item from ${file}`, () => {
cy.db_createNewsFeed({ name: 'automated test feed 1', link: `${Cypress.config('baseUrl')}/tests/System/data/com_newsfeeds/${file}.xml` })
cy.db_createNewsFeed({ name: 'automated test feed 1', link: `${Cypress.config('baseUrl').replace('https://', 'http://')}/tests/System/data/com_newsfeeds/${file}.xml` })
.then((feed) => {
cy.visit(`/index.php?option=com_newsfeeds&view=newsfeed&id=${feed.id}`);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ describe('Test in frontend that the feed module', () => {
cy.db_createModule({
title: 'automated test feed',
module: 'mod_feed',
params: `{"rssurl": "${Cypress.config('baseUrl')}/tests/System/data/com_newsfeeds/${file}.xml" }`,
params: `{"rssurl": "${Cypress.config('baseUrl').replace('https://', 'http://')}/tests/System/data/com_newsfeeds/${file}.xml" }`,
})
.then(() => {
cy.visit('/');
Expand Down