Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 44 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ jobs:
- name: PHPStan
run: php ./bin/phpstan

functional:
name: "Functional tests"
functional-no-js:
name: "Functional tests (no JS)"
runs-on: ubuntu-22.04

steps:
Expand All @@ -85,17 +85,55 @@ jobs:
- name: Delete symfony cache
run: rm -rf var/cache/test

- name: Tests - Functional
run: make test-functional
- name: Tests - Functional (no JS)
run: make test-functional-no-js

- uses: actions/upload-artifact@v4
with:
name: Functional tests - deprecated log - full
name: Functional tests (no JS) - deprecated log - full
path: var/logs/test.deprecations.log

- uses: actions/upload-artifact@v4
with:
name: Functional tests - deprecated log - report
name: Functional tests (no JS) - deprecated log - report
path: var/logs/test.deprecations_grouped.log

functional-js:
name: "Functional tests (JS)"
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v6

- name: Cache Docker images.
uses: AndreKurait/docker-cache@0.6.0
with:
key: |
docker-${{ runner.os }}-${{ hashFiles(
'compose.yml',
'docker/dockerfiles/apachephp/Dockerfile',
'docker/dockerfiles/mysql/Dockerfile',
'docker/dockerfiles/mysqltest/Dockerfile'
) }}

- name: Delete symfony cache
run: rm -rf var/cache/test

- name: Tests - Functional (JS)
uses: nick-fields/retry@v4
with:
timeout_minutes: 10
max_attempts: 3
command: make test-functional-js

- uses: actions/upload-artifact@v4
with:
name: Functional tests (JS) - deprecated log - full
path: var/logs/test.deprecations.log

- uses: actions/upload-artifact@v4
with:
name: Functional tests (JS) - deprecated log - report
path: var/logs/test.deprecations_grouped.log

integration:
Expand Down
22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ help:
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)

.PHONY: install docker-up docker-stop docker-down test hooks vendors db-seed db-migrations reset-db init console phpstan assets
.PHONY: install docker-up docker-stop docker-down test test-functional test-functional-no-js test-functional-js hooks vendors db-seed db-migrations reset-db init console phpstan assets

##@ Setup

Expand Down Expand Up @@ -111,6 +111,26 @@ test-functional: data config htdocs/uploads tmp
make var/logs/test.deprecations_grouped.log
$(DOCKER_COMP) stop dbtest apachephptest mailcatcher

### Tests fonctionnels (scénarios sans JS)
test-functional-no-js: data config htdocs/uploads tmp
$(DOCKER_COMP) stop dbtest apachephptest mailcatcher
$(DOCKER_COMP) up -d dbtest apachephptest mailcatcher
make clean-test-deprecated-log
$(DOCKER_COMP) run --no-deps --rm -u localUser apachephptest ./bin/bdi detect drivers
$(DOCKER_COMP) run --no-deps --rm -u localUser apachephptest ./bin/behat --suite=web_features_no_js
make var/logs/test.deprecations_grouped.log
$(DOCKER_COMP) stop dbtest apachephptest mailcatcher

### Tests fonctionnels (scénarios JS via Panther)
test-functional-js: data config htdocs/uploads tmp
$(DOCKER_COMP) stop dbtest apachephptest mailcatcher
$(DOCKER_COMP) up -d dbtest apachephptest mailcatcher
make clean-test-deprecated-log
$(DOCKER_COMP) run --no-deps --rm -u localUser apachephptest ./bin/bdi detect drivers
$(DOCKER_COMP) run --no-deps --rm -u localUser apachephptest ./bin/behat --suite=web_features_js
make var/logs/test.deprecations_grouped.log
$(DOCKER_COMP) stop dbtest apachephptest mailcatcher

### Tests d'intégration avec start/stop des images docker
test-integration-ci:
$(DOCKER_COMP) stop dbtest apachephptest
Expand Down
13 changes: 12 additions & 1 deletion behat.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Afup\Tests\Behat\Bootstrap\FeatureContext;
use Behat\Config\Config;
use Behat\Config\Extension;
use Behat\Config\Filter\TagFilter;
use Behat\Config\Profile;
use Behat\Config\Suite;
use Behat\MinkExtension\Context\MinkContext;
Expand Down Expand Up @@ -59,11 +60,21 @@
],
]))
->withSuite(
(new Suite('web_features'))
(new Suite('web_features_no_js'))
->withContexts(
FeatureContext::class,
MinkContext::class
)
->withPaths('%paths.base%/tests/behat')
->withFilter(new TagFilter('~@javascript'))
)
->withSuite(
(new Suite('web_features_js'))
->withContexts(
FeatureContext::class,
MinkContext::class
)
->withPaths('%paths.base%/tests/behat')
->withFilter(new TagFilter('@javascript'))
)
);
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ Feature: Administration - Trésorerie - Devis/Facture
Then I should see "Télécharger la facture en PDF"

# On n'utilise pas @reloadDbWithTestData pour conserver les données
@javascript
Scenario: Téléchargement d'un devis et d'une facture
Given I am logged in as admin and on the Administration
When I follow "Devis"
Expand Down
Loading