-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #376 from MTES-MCT/tech/e2e-tests
Setup end to end tests
- Loading branch information
Showing
18 changed files
with
811 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -291,4 +291,9 @@ data.* | |
### Jetbrain's IDE | ||
.idea/ | ||
|
||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
|
||
altis/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
""" | ||
With these settings, tests run faster. | ||
""" | ||
|
||
from .base import * # noqa | ||
from .base import env | ||
|
||
# GENERAL | ||
# ------------------------------------------------------------------------------ | ||
# https://docs.djangoproject.com/en/dev/ref/settings/#debug | ||
DEBUG = True | ||
# https://docs.djangoproject.com/en/dev/ref/settings/#secret-key | ||
SECRET_KEY = env( | ||
"DJANGO_SECRET_KEY", | ||
default="xa7B39ApH5wH2VZS28Hk1CfLs7Hta6iPAkModtOEft8iGv3jppqDeGSCvpW1AX4p", | ||
) | ||
|
||
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts | ||
ALLOWED_HOSTS = [ | ||
"localhost", | ||
] | ||
|
||
# CACHES | ||
# ------------------------------------------------------------------------------ | ||
# https://docs.djangoproject.com/en/dev/ref/settings/#caches | ||
CACHES = { | ||
"default": { | ||
"BACKEND": "django.core.cache.backends.locmem.LocMemCache", | ||
"LOCATION": "ratelimit-test", | ||
} | ||
} | ||
|
||
# ------------------------------------------------------------------------------ | ||
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend | ||
EMAIL_BACKEND = env( | ||
"DJANGO_EMAIL_BACKEND", default="django.core.mail.backends.console.EmailBackend" | ||
) | ||
|
||
# TEMPLATES | ||
# ------------------------------------------------------------------------------ | ||
TEMPLATES[-1]["OPTIONS"]["loaders"] = [ # type: ignore[index] # noqa F405 | ||
( | ||
"django.template.loaders.cached.Loader", | ||
[ | ||
"django.template.loaders.filesystem.Loader", | ||
"django.template.loaders.app_directories.Loader", | ||
], | ||
) | ||
] | ||
|
||
# ------------------------------------------------------------------------------ | ||
# https://docs.djangoproject.com/en/dev/ref/settings/#email-backend | ||
EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend" | ||
|
||
|
||
# django-extensions | ||
# ------------------------------------------------------------------------------ | ||
# https://django-extensions.readthedocs.io/en/latest/installation_instructions.html#configuration | ||
INSTALLED_APPS += ["django_extensions"] # noqa F405 | ||
|
||
# CELERY | ||
CELERY_TASK_ALWAYS_EAGER = True | ||
CELERY_TASK_EAGER_PROPAGATES = True | ||
|
||
|
||
# Your stuff... | ||
# ------------------------------------------------------------------------------ | ||
|
||
ENV_NAME = "test" | ||
ENVERGO_AMENAGEMENT_DOMAIN = "localhost" | ||
LANGUAGE_CODE = "en-us" # TODO: I force it in english because I can't achieve to run it in french in the github CI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
services: | ||
django: | ||
environment: | ||
- DJANGO_SETTINGS_MODULE=config.settings.ci | ||
- POSTGRES_DB=${POSTGRES_DB:-envergo} | ||
env_file: | ||
- ./envs/django | ||
- ./envs/postgres | ||
|
||
postgres: | ||
env_file: | ||
- ./envs/postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('User can request an evaluation', async ({ page }) => { | ||
await page.goto('/'); | ||
await page.getByLabel('Menu principal').getByRole('link', { name: 'Demander un avis réglementaire' }).click(); | ||
await page.locator('p').filter({ hasText: 'Commencer la demande Durée : 1 min' }).getByRole('link').click(); | ||
await page.getByLabel('Address of the project Type').click(); | ||
await page.getByLabel('Address of the project Type').fill('Vue'); | ||
await page.getByRole('option', { name: 'Vue 44, Loire-Atlantique,' }).click(); | ||
await page.getByPlaceholder('15 caractères commençant par').click(); | ||
await page.getByPlaceholder('15 caractères commençant par').fill('PA1234567981011'); | ||
await page.getByLabel('Project description, comments').click(); | ||
await page.getByLabel('Project description, comments').fill('Assainissement de marécage pour faire une belle dalle béton bien propre'); | ||
await page.getByRole('button', { name: 'Poursuivre votre demande d\'' }).click(); | ||
await page.getByLabel('Adresse(s) e-mail', { exact: true }).click(); | ||
await page.getByLabel('Adresse(s) e-mail', { exact: true }).fill('[email protected]'); | ||
await page.getByLabel('Adresse(s) e-mail', { exact: true }).press('Tab'); | ||
await page.getByLabel('Urbanism department phone').fill('0601900917'); | ||
await page.getByLabel('Urbanism department phone').press('Tab'); | ||
await page.getByLabel('Urbanism department phone').click(); | ||
await page.getByLabel('Urbanism department phone').fill('0601900918'); | ||
await page.getByLabel('Adresse(s) e-mail Pé').click(); | ||
await page.getByLabel('Adresse(s) e-mail Pé').fill('[email protected]'); | ||
await page.getByRole('button', { name: 'Poursuivre votre demande d\'' }).click(); | ||
await page.getByRole('button', { name: 'Envoyer votre demande d\'avis' }).click(); | ||
await expect(page).toHaveTitle("Votre demande d'avis réglementaire a été enregistrée — EnvErgo"); | ||
await expect(page.getByText('Nous avons bien reçu votre demande d\'avis réglementaire.')).toBeVisible(); | ||
|
||
}); |
Oops, something went wrong.