Skip to content

Commit

Permalink
setup initial codeception test framework for acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
broskees committed Jul 19, 2023
1 parent 35e47e3 commit 1702247
Show file tree
Hide file tree
Showing 31 changed files with 31,051 additions and 5,451 deletions.
22 changes: 11 additions & 11 deletions .dev/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

## Minimum Configuration, these are required for installation

LEAN_APP_URL = 'http://localhost:8080' # Base URL, only needed for subfolder installation
LEAN_APP_URL_ROOT = 'http://localhost:8080' # Base of application withotu trailing slash (used for cookies), e.g, /leantime
LEAN_APP_URL = 'http://localhost:8090' # Base URL, only needed for subfolder installation
LEAN_APP_URL_ROOT = 'http://localhost:8090' # Base of application withotu trailing slash (used for cookies), e.g, /leantime

LEAN_DEBUG = 1 # Debug flag

Expand Down Expand Up @@ -93,24 +93,24 @@ LEAN_LDAP_GROUP_ASSIGNMENT = "{\"5\": {\"ltRole\":\"readonly\",\"ldapRole\":\"re
## OpenID Connect
# required
LEAN_OIDC_ENABLE = true
LEAN_OIDC_CLIEND_ID =
LEAN_OIDC_CLIEND_SECRET =
LEAN_OIDC_CLIEND_ID =
LEAN_OIDC_CLIEND_SECRET =

# required - the url for your provider (examples down below)
#LEAN_OIDC_PROVIDER_URL =
#LEAN_OIDC_PROVIDER_URL =

# optional - these will be read from the well-known configuration if possible
#LEAN_OIDC_AUTH_URL_OVERRIDE =
#LEAN_OIDC_TOKEN_URL_OVERRIDE =
#LEAN_OIDC_JWKS_URL_OVERRIDE =
#LEAN_OIDC_USERINFO_URL_OVERRIDE =
#LEAN_OIDC_AUTH_URL_OVERRIDE =
#LEAN_OIDC_TOKEN_URL_OVERRIDE =
#LEAN_OIDC_JWKS_URL_OVERRIDE =
#LEAN_OIDC_USERINFO_URL_OVERRIDE =

# optional - override the public key for RSA validation
#LEAN_OIDC_CERTIFICATE_STRING =
#LEAN_OIDC_CERTIFICATE_FILE =

# optional - override the requested scopes
#LEAN_OIDC_SCOPES =
#LEAN_OIDC_SCOPES =

# optional - override the keys used for these fields
#LEAN_OIDC_FIELD_EMAIL =
Expand All @@ -123,4 +123,4 @@ LEAN_OIDC_CLIEND_SECRET =
#LEAN_OIDC_TOKEN_URL_OVERRIDE = https://github.com/login/oauth/access_token
#LEAN_OIDC_USERINFO_URL_OVERRIDE = https://api.github.com/user,https://api.github.com/user/emails
#LEAN_OIDC_SCOPES = user:email
#LEAN_OIDC_FIELD_EMAIL = 0.email
#LEAN_OIDC_FIELD_EMAIL = 0.email
12 changes: 12 additions & 0 deletions .dev/docker-compose.tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3.9"

services:
leantime-dev:
volumes:
- "${PWD}/test.env:/var/www/html/config/.env"
db:
environment:
- MYSQL_ROOT_PASSWORD=leantime
- MYSQL_USER=leantime
- MYSQL_PASSWORD=leantime
- MYSQL_DATABASE=leantime_test
26 changes: 22 additions & 4 deletions .dev/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,23 @@ services:
leantime-dev:
build: .
ports:
- "8080:8080"
- "8090:8080"
volumes:
- "../:/var/www/html"
- "./xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"
- "./error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini"
- ".env:/var/www/html/config/.env"
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
db:
condition: service_healthy
networks:
- leantime
db:
image: mysql:8.0
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=leantime
- MYSQL_USER=leantime
Expand All @@ -31,15 +36,28 @@ services:
- leantime
volumes:
- mysql:/var/lib/mysql:rw
healthcheck:
test: [
"CMD",
'mysqladmin',
'ping',
'-h',
'localhost',
'-u$$MYSQL_USER',
'-p$$MYSQL_PASSWORD'
]
interval: 5s
timeout: 5s
retries: 20
maildev:
image: maildev/maildev
environment:
- MAILDEV_SMTP_PORT=465
- MAILDEV_WEB_PORT=8081
ports:
- 8081:8081
networks:
- leantime
networks:
- leantime
phpmyadmin:
image: phpmyadmin
ports:
Expand All @@ -52,7 +70,7 @@ services:
s3ninja:
image: scireum/s3-ninja
ports:
- 8083:9000
- 8083:9000
networks:
- leantime
volumes:
Expand Down
4 changes: 2 additions & 2 deletions .dev/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ RUN a2enmod rewrite
RUN apt update && apt install -f -y libonig-dev libcurl4-openssl-dev libxml2-dev \
libxslt1-dev libzip-dev libjson-c-dev libldap-dev libargon2-dev \
libfreetype6-dev libjpeg62-turbo-dev libpng-dev apt-utils vim curl sqlite3
RUN pecl install xdebug
RUN pecl install xdebug
RUN docker-php-ext-install mysqli pdo_mysql mbstring exif pcntl pdo bcmath opcache ldap

RUN docker-php-ext-configure gd --enable-gd --with-jpeg=/usr/include/ --with-freetype --with-jpeg
RUN docker-php-ext-install gd
RUN docker-php-ext-enable xdebug
COPY ./dev-apache-site.conf /etc/apache2/sites-enabled/000-default.conf
VOLUME /var/www/uploads
RUN mkdir -p /var/www/uploads && chown -R www-data:www-data /var/www/uploads
RUN mkdir -p /var/www/uploads && chown -R www-data:www-data /var/www/uploads
126 changes: 126 additions & 0 deletions .dev/test.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# This is a sample configuration file with all possible configuration options.
# If you don't want to maintain a file like this you can pass in all variables via Server Variabels

## Minimum Configuration, these are required for installation

LEAN_APP_URL = 'http://localhost:8090' # Base URL, only needed for subfolder installation
LEAN_APP_URL_ROOT = 'http://localhost:8090' # Base of application withotu trailing slash (used for cookies), e.g, /leantime

LEAN_DEBUG = 0 # Debug flag

# Database
LEAN_DB_HOST = 'db' # Database host
LEAN_DB_USER = 'leantime' # Database username
LEAN_DB_PASSWORD = 'leantime' # Database password
LEAN_DB_DATABASE = 'leantime_test' # Database name
LEAN_DB_PORT = '3306' # Database port


## Optional Configuraiton, you may ommit these from your .env file

## Default Settings
LEAN_SITENAME = 'Leantime' # Name of your site, can be changed later
LEAN_LANGUAGE = 'en-US' # Default language
LEAN_DEFAULT_TIMEZONE = 'America/Los_Angeles' # Set default timezone
LEAN_ENABLE_MENU_TYPE = false # Enable to specifiy menu on aproject by project basis
LEAN_SESSION_PASSWORD = '3evBlq9zdUEuzKvVJHWWx3QzsQhturBApxwcws2m' #Salting sessions. Replace with a strong password
LEAN_SESSION_EXPIRATION = 28800 # How many seconds after inactivity should we logout? 28800seconds = 8hours
LEAN_LOG_PATH = null # Default Log Path (including filename), if not set /logs/error.log will be used

## Look & Feel, these settings are available in the UI and can be overwritten there.
LEAN_LOGO_PATH = '/images/logo.svg' # Default logo path, can be changed later
LEAN_PRINT_LOGO_URL = '/images/logo.jpg' # Default logo URL use for printing (must be jpg or png format)
LEAN_DEFAULT_THEME = 'default' # Default theme
LEAN_PRIMARY_COLOR = '#1b75bb' # Primary Theme color
LEAN_SECONDARY_COLOR = '#81B1A8' # Secondary Theme Color
LEAN_KEEP_THEME = true # Keep theme and language from previous user for login screen

## Fileuploads

# Local File Uploads
LEAN_USER_FILE_PATH = '../uploads/' # Local relative path to store uploaded files (if not using S3)
LEAN_DB_BACKUP_PATH = 'backupdb/' # Local relative path to store backup files, need permission to write

# S3 File Uploads
LEAN_USE_S3 = false # Set to true if you want to use S3 instead of local files
LEAN_S3_KEY = 'AKIAIOSFODNN7EXAMPLE' # S3 Key, hardcoded in s3ninja
LEAN_S3_SECRET = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY' # S3 Secret, hardcoded in s3ninja
LEAN_S3_BUCKET = 'leantime' # Your S3 bucket
LEAN_S3_USE_PATH_STYLE_ENDPOINT = true # Sets the endpoint style: false => https://[bucket].[endpoint] ; true => https://[endpoint]/[bucket]
LEAN_S3_REGION = 'eu-west-1' # S3 region
LEAN_S3_FOLDER_NAME = '' # Foldername within S3 (can be emtpy)
LEAN_S3_END_POINT = "http://s3ninja:9000" # S3 EndPoint S3 Compatible (https://sfo2.digitaloceanspaces.com)

## Email
LEAN_EMAIL_RETURN = '[email protected]' # Return email address, needs to be valid email address format
LEAN_EMAIL_USE_SMTP = true # Use SMTP? If set to false, the default php mail() function will be used
LEAN_EMAIL_SMTP_HOSTS = 'maildev' # SMTP host
LEAN_EMAIL_SMTP_AUTH = false # SMTP authentication required
LEAN_EMAIL_SMTP_USERNAME = '' # SMTP username
LEAN_EMAIL_SMTP_PASSWORD = '' # SMTP password
LEAN_EMAIL_SMTP_AUTO_TLS = true # SMTP Enable TLS encryption automatically if a server supports it
LEAN_EMAIL_SMTP_SECURE = '' # SMTP Security protocol (usually one of: TLS, SSL, STARTTLS)
LEAN_EMAIL_SMTP_SSLNOVERIFY = true # SMTP Allow insecure SSL: Don't verify certificate, accept self-signed, etc.
LEAN_EMAIL_SMTP_PORT = '465' # Port (usually one of 25, 465, 587, 2526)

## Ldap
LEAN_LDAP_USE_LDAP = false # Set to true if you want to use LDAP
LEAN_LDAP_LDAP_TYPE = 'OL' # Select the correct directory type. Currently Supported: OL - OpenLdap, AD - Active Directory
LEAN_LDAP_HOST = '' # FQDN
LEAN_LDAP_PORT = 389 # Default Port
LEAN_LDAP_DN = '' # Location of users, example: CN=users,DC=example,DC=com

# Leantime->Ldap attribute mapping
LEAN_LDAP_KEYS = "{\"username\":\"uid\",\"groups\":\"memberOf\",\"email\":\"mail\",\"firstname\":\"displayname\",\"lastname\":\"\",\"phonenumber\":\"telephoneNumber\"}"

# For AD use these default attributes
# LEAN_LDAP_KEYS = "{
# \"username\":\"cn\",
# \"groups\":\"memberOf\",
# \"email\":\"mail\",
# \"firstname\":\"givenName\",
# \"lastname\":\"sn\",
# \"phonenumber\":\"telephoneNumber\"
# }"

LEAN_LDAP_DEFAULT_ROLE_KEY = 20; # Default Leantime Role on creation. (set to editor)

# Default role assignments upon first login.
# (Optional) Can be updated later in user settings for each user
LEAN_LDAP_GROUP_ASSIGNMENT = "{\"5\": {\"ltRole\":\"readonly\",\"ldapRole\":\"readonly\"},\"10\": {\"ltRole\":\"commenter\",\"ldapRole\":\"commenter\"},\"20\": {\"ltRole\":\"editor\",\"ldapRole\":\"editor\"},\"30\": {\"ltRole\":\"manager\",\"ldapRole\":\"manager\"},\"40\": {\"ltRole\":\"admin\",\"ldapRole\":\"administrators\"},\"50\": {\"ltRole\":\"owner\",\"ldapRole\":\"administrators\"}}"


## OpenID Connect
# required
LEAN_OIDC_ENABLE = true
LEAN_OIDC_CLIEND_ID =
LEAN_OIDC_CLIEND_SECRET =

# required - the url for your provider (examples down below)
#LEAN_OIDC_PROVIDER_URL =

# optional - these will be read from the well-known configuration if possible
#LEAN_OIDC_AUTH_URL_OVERRIDE =
#LEAN_OIDC_TOKEN_URL_OVERRIDE =
#LEAN_OIDC_JWKS_URL_OVERRIDE =
#LEAN_OIDC_USERINFO_URL_OVERRIDE =

# optional - override the public key for RSA validation
#LEAN_OIDC_CERTIFICATE_STRING =
#LEAN_OIDC_CERTIFICATE_FILE =

# optional - override the requested scopes
#LEAN_OIDC_SCOPES =

# optional - override the keys used for these fields
#LEAN_OIDC_FIELD_EMAIL =
#LEAN_OIDC_FIELD_FIRSTNAME =
#LEAN_OIDC_FIELD_LASTNAME =

## OpenID Connect setting for github
#LEAN_OIDC_PROVIDER_URL = https://token.actions.githubusercontent.com/
#LEAN_OIDC_AUTH_URL_OVERRIDE = https://github.com/login/oauth/authorize
#LEAN_OIDC_TOKEN_URL_OVERRIDE = https://github.com/login/oauth/access_token
#LEAN_OIDC_USERINFO_URL_OVERRIDE = https://api.github.com/user,https://api.github.com/user/emails
#LEAN_OIDC_SCOPES = user:email
#LEAN_OIDC_FIELD_EMAIL = 0.email
5 changes: 3 additions & 2 deletions .dev/xdebug.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ zend_extension=xdebug

[xdebug]
xdebug.mode=develop,debug
xdebug.discover_client_host=1
xdebug.client_host=host.docker.internal; do not touch
xdebug.start_with_request=yes
xdebug.start_with_request=trigger
xdebug.client_port=9003; set to your correct port
xdebug.idekey="netbeans-xdebug";set to your correct IDE key
xdebug.idekey="netbeans-xdebug";set to your correct IDE key
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ trim_trailing_whitespace = false

[*.yml]
indent_size = 2

[makefile]
indent_style = tab
1 change: 0 additions & 1 deletion app/domain/install/controllers/class.index.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function init()
*/
public function get($params)
{

$this->tpl->display("install.new", "entry");
}

Expand Down
2 changes: 1 addition & 1 deletion app/domain/install/repositories/class.install.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ private function sqlPrep()
`created` datetime DEFAULT NULL,
`projectId` INT NULL,
`type` VARCHAR(45) NULL,
`description` TEXT DEFAULT,
`description` TEXT,
PRIMARY KEY (`id`),
KEY `ProjectIdType` (`projectId` ASC, `type` ASC)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Expand Down
2 changes: 1 addition & 1 deletion app/domain/install/templates/new.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@



</div>
</div>
15 changes: 8 additions & 7 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
namespace: Tests
support_namespace: Support
bootstrap: bootstrap.php
paths:
tests: tests
output: tests/_output
data: tests/Support/Data
support: tests/Support
envs: tests/_envs
tests: tests
output: tests/_output
data: tests/Support/Data
support: tests/Support
envs: tests/_envs
actor_suffix: Tester
extensions:
enabled:
- Codeception\Extension\RunFailed
enabled:
- Codeception\Extension\RunFailed
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"codeception/codeception": "^5.0",
"codeception/module-phpbrowser": "*",
"codeception/module-asserts": "*",
"leantime/leantime-documentor": "dev-main"
"leantime/leantime-documentor": "dev-main",
"symfony/process": "^5.4",
"codeception/module-db": "^3.1",
"codeception/module-webdriver": "^3.2"
},
"extra": {
"installer-paths": {
Expand Down
Loading

0 comments on commit 1702247

Please sign in to comment.