Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup end to end tests #376

Open
wants to merge 70 commits into
base: main
Choose a base branch
from
Open

Setup end to end tests #376

wants to merge 70 commits into from

Conversation

pyDez
Copy link
Collaborator

@pyDez pyDez commented Aug 7, 2024

Bon j'ai eu pas mal de galère comme l'historique de commit peut en témoigner.
J'ai écris 3 tests assez minimalistes (affichage de la home, demande d'AR, simulation), mais ca fait une base que l'on pourra completer à partir de maintenant.

Ce qu'il faudrait améliorer :

  • Je n'ai pas réussi à afficher l'interface en français dans les tests. Aprés de nombreux essais, j'ai jeter l'éponge et j'ai décidé d'écrire les tests en anglais (pour les quelques labels qui sont multilingues)
  • J'ai ajouter des éléments dans le dockerfile de Django, notamment l'installation de nodeJs dont j'ai eu besoin pour builder les assets (notamment les fichiers css)
  • Je n'ai pas essayer de travailler sur Haie, ce qui necessiterait de pouvoir accéder au service via deux URL distinctes.

Je te laisse regarder ça @thibault et me dire ce que tu en penses.

GitGuardian : selon ce document les ops devrait lever l'alerte en la flagant comme faux positif.

Copy link

gitguardian bot commented Aug 7, 2024

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@pyDez pyDez marked this pull request as draft August 7, 2024 09:38
@thibault
Copy link
Collaborator

thibault commented Aug 8, 2024

Ok pour moi sur le principe, c'est vrai qu'il y a de plus en plus de js dans les pages, ça devient une nécessité.

@pyDez pyDez marked this pull request as ready for review September 10, 2024 12:06
@pyDez pyDez marked this pull request as draft September 10, 2024 12:11
@pyDez pyDez requested a review from thibault September 18, 2024 04:17
README.md Outdated

```bash
$ . envs/postgres
$ docker-compose exec postgres bash -c 'dropdb envergo-test -U "$POSTGRES_USER" -f'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ docker-compose exec postgres bash -c 'dropdb envergo-test -U "$POSTGRES_USER" -f'
$ docker-compose exec postgres bash -c 'dropdb --if-exists envergo-test -U "$POSTGRES_USER" -f'

$ docker-compose exec postgres bash -c 'dropdb envergo-test -U "$POSTGRES_USER" -f'
$ docker-compose exec postgres bash -c 'createdb envergo-test -U "$POSTGRES_USER" -O "$POSTGRES_USER"'
$ docker-compose run -e POSTGRES_DB=envergo-test --rm django python manage.py migrate
$ docker compose run -e POSTGRES_DB=envergo-test --rm django python manage.py loaddata e2e/fixtures/db_seed.json
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ docker compose run -e POSTGRES_DB=envergo-test --rm django python manage.py loaddata e2e/fixtures/db_seed.json
$ docker-compose run -e POSTGRES_DB=envergo-test --rm django python manage.py loaddata e2e/fixtures/db_seed.json

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

La V2 de Docker compose utilise la syntaxe docker compose et non plus docker-compose.
Je crois comprendre que dans le future c'est cette syntaxe qui devrait s'imposer . Je préconise donc que l'on utilise docker compose partout dans les Readme. Qu'en penses tu ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok j'ignorais. Je rencontre des erreurs lorsque j'utilise cette commande telle quelle. Peut-être ajouter une mini note là dessus dans la doc ?

README.md Outdated
Vous devez ensuite lancer l'application en pointant vers la base de test:

```bash
$ POSTGRES_DB=envergo-test docker compose up -d
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ POSTGRES_DB=envergo-test docker compose up -d
$ POSTGRES_DB=envergo-test docker-compose up -d

Enfin vous pouvez lancer les tests avec l'une des commandes suivantes :

```bash
$ npx playwright test --ui # pour lancer les tests dans un navigateur
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quand j'installe playwright, il me pose les questions d'initialisation du projet (js / ts, initi de la github action, etc.). Pourtant le projet est déjà configuré ici. Ça te parle ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Du coup chez moi aucun test ne passe. Est-ce normal ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai améliorer le Readme. Certaine commande n'était pas complète.
Dis moi si c'est mieux.

Evidemment le comportement "normal", c'est quand les tests passent en local et sur la CI :)

README.md Outdated
$ docker compose run -e POSTGRES_DB=envergo-test --rm django python manage.py loaddata e2e/fixtures/db_seed.json
```

Vous devez ensuite installer Playwright en suivant les instructions de la [documentation](https://playwright.dev/docs/intro#installing-playwright).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai installé via :

npm install @playwright/test
npm install @playwright/test

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effectivement, la page d'installation de la documentation présente le processus d'initialisation.

Lorsque le projet est déjà configuré, comme c'est le cas ici, il faut utiliser les commandes suivantes:

$ npm install @playwright/test 
$ npx playwright install

Je mets à jour le Readme

@pyDez pyDez requested a review from thibault September 26, 2024 09:26
@pyDez pyDez marked this pull request as ready for review September 30, 2024 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants