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

[WIP] Ptitloup/add selenium test #955

Draft
wants to merge 58 commits into
base: develop
Choose a base branch
from

Conversation

ptitloup
Copy link
Contributor

@ptitloup ptitloup commented Sep 21, 2023

  • Add some sides.
  • Add USE_DEBUG_TOOLBAR
  • Auto compilation of lang files

@ptitloup ptitloup marked this pull request as draft September 21, 2023 15:20
@ptitloup ptitloup changed the title Ptitloup/add selenium test [WIP] Ptitloup/add selenium test Sep 21, 2023
@Badatos
Copy link
Collaborator

Badatos commented Oct 5, 2023

Attention, il semble que seuls les tests en v3.9 se font

Pour les tests fonctionnels, je pense qu'une seule branche python suffit, du moment que les autres branches passent les tests unitaires. Nos tests sont déjà assez longs ^^

@ptitloup
Copy link
Contributor Author

ptitloup commented Oct 5, 2023

Attention, il semble que seuls les tests en v3.9 se font

Pour les tests fonctionnels, je pense qu'une seule branche python suffit, du moment que les autres branches passent les tests unitaires. Nos tests sont déjà assez longs ^^

Oui tout à fait.

@AymericJak
Copy link
Collaborator

C'est encore en cours de dev haha

@Badatos
Copy link
Collaborator

Badatos commented Oct 5, 2023

C'est encore en cours de dev haha

Ah c'est donc ca ce petit "draft" gris et ce "[WIP]" ? 🤣 Mais quand j'ai vu passer la modif dans mes notifs j'ai trop eu envie de jeter un oeil quand même ^^

Copy link
Collaborator

Choose a reason for hiding this comment

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

Je suppose qu'il ne faut pas intégrer ce .back au Git, si ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cette PR est laissé en attente pour le moment, les .back sont des tests qui seront forcement retiré avant fusion.

Comment on lines +29 to +39
RUN apt-get install -y firefox-esr xvfb

# Download, unzip, and install geckodriver
RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-linux64.tar.gz
RUN tar -zxf geckodriver-v0.33.0-linux64.tar.gz -C /usr/local/bin
RUN chmod +x /usr/local/bin/geckodriver

# Set display port and dbus env to avoid hanging
ENV DISPLAY=:99
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null

Copy link
Contributor

Choose a reason for hiding this comment

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

Je suggère cette approche pour gérer Selenium avec une image docker.
https://github.com/SeleniumHQ/docker-selenium

# https://github.com/SeleniumHQ/docker-selenium/blob/trunk/docker-compose-v3.yml
selenium-chrome:
  image: selenium/standalone-chrome:116.0-chromedriver-116.0
  container_name: selenium-chrome
  volumes:
    - /dev/shm:/dev/shm
  network_mode: host

Quelques avantages (permet de):

  • Alleger un peu l'image de l'app.
  • Assez facilement gérer la compatibilité entre les versions geckodriver et navigateur (Chrome,Firefox etc...) puisqu'il utilise le package webdriver-manager pour gérer tout ca (voir https://pypi.org/project/webdriver-manager/)
  • et enfin pouvoir (si on le souhaite) rajouter, facilement, differents navigateurs pour nos tests fronts

Désavantage:

  • Les tests depuis un container docker aucun soucis mais depuis la machine locale(django) + containers docker(bdd, redis, etc...), on est naturellement amené à utilisé l'options network_mode: host mais cette option n'est pas bien supportée sur Windows et Mac (voir: https://docs.docker.com/network/drivers/host/)

image

Issue: docker/roadmap#238
Roadmap State(Considering): https://github.com/docker/roadmap/projects/1#card-85911349

Il y a, cependant, des solutions de contournement, que je n'ai pas explorées, exemple pour Mac: https://github.com/chipmk/docker-mac-net-connect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants