-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into 294-crear-llistat-de-ofertes-per-administrador
- Loading branch information
Showing
34 changed files
with
1,140 additions
and
416 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [ main, master, dev ] | ||
pull_request: | ||
branches: [ main, master, dev ] | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Ensure browsers are installed | ||
run: python manage.py runserver & python -m playwright install --with-deps | ||
- name: Run your tests | ||
run: pytest --tracing=retain-on-failure | ||
- uses: actions/upload-artifact@v4 | ||
if: ${{ !cancelled() }} | ||
with: | ||
name: playwright-traces | ||
path: test-results/ | ||
#name: Playwright Tests | ||
#on: | ||
# push: | ||
# branches: [ main, master, dev ] | ||
# pull_request: | ||
# branches: [ main, master, dev ] | ||
#jobs: | ||
# test: | ||
# timeout-minutes: 60 | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v4 | ||
# - name: Set up Python | ||
# uses: actions/setup-python@v4 | ||
# with: | ||
# python-version: '3.11' | ||
# - name: Install dependencies | ||
# run: | | ||
# python -m pip install --upgrade pip | ||
# pip install -r requirements.txt | ||
# - name: Ensure browsers are installed | ||
# run: python manage.py runserver & python -m playwright install --with-deps | ||
# - name: Run your tests | ||
# run: pytest --tracing=retain-on-failure | ||
# - uses: actions/upload-artifact@v4 | ||
# if: ${{ !cancelled() }} | ||
# with: | ||
# name: playwright-traces | ||
# path: test-results/ |
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 |
---|---|---|
@@ -1,24 +1,14 @@ | ||
import re | ||
from playwright.sync_api import Page, expect | ||
|
||
import time | ||
|
||
def test_book_no_logged(page: Page) -> None: | ||
page.goto("http://localhost:8000/") | ||
page.get_by_role("link", name="Reservar").click() | ||
page.get_by_placeholder("DNI").click() | ||
page.get_by_placeholder("DNI").fill("12312312a") | ||
page.get_by_placeholder("DNI").press("Tab") | ||
page.get_by_placeholder("Nombre").fill("test") | ||
page.get_by_placeholder("Nombre").press("Tab") | ||
page.get_by_placeholder("Apellidos").fill("test") | ||
page.get_by_placeholder("Apellidos").press("Tab") | ||
page.get_by_placeholder("Correo Electrónico").fill("[email protected]") | ||
page.get_by_placeholder("Correo Electrónico").press("Tab") | ||
page.get_by_placeholder("Teléfono").fill("123123123") | ||
page.get_by_placeholder("Fecha de Entrada ").fill("2024-10-22") | ||
page.get_by_placeholder("Fecha de Salida").fill("2024-10-24") | ||
time.sleep(1) | ||
page.get_by_placeholder("Fecha de Entrada ").fill("2024-12-12") | ||
page.get_by_placeholder("Fecha de Salida").fill("2024-12-25") | ||
page.get_by_placeholder("Número de Huéspedes").click() | ||
page.get_by_placeholder("Número de Huéspedes").fill("3") | ||
page.get_by_text("Volver Reservar DNI Nombre").click() | ||
page.get_by_placeholder("Número de Huéspedes").fill("2") | ||
page.get_by_role("button", name="Reservar").click() | ||
#expect(page.get_by_role("button", name="Descargar Comprobante")).to_be_visible() | ||
# expect(page.get_by_role("button", name="Descargar Comprobante")).to_be_visible() |
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 |
---|---|---|
@@ -1,9 +1,17 @@ | ||
import re | ||
from playwright.sync_api import Page, expect | ||
import time | ||
|
||
|
||
|
||
def test_go_booking_from_rooms(page: Page) -> None: | ||
page.goto("http://localhost:8000/") | ||
page.get_by_role("link", name="Habitaciones", exact=True).click() | ||
page.get_by_role("link", name="Reservar").nth(1).click() | ||
page.get_by_placeholder("DNI").click() | ||
time.sleep(1) | ||
page.get_by_placeholder("Fecha de Entrada ").fill("2024-12-12") | ||
page.get_by_placeholder("Fecha de Entrada ").press("Enter") | ||
page.get_by_placeholder("Fecha de Salida").fill("2024-12-25") | ||
page.get_by_placeholder("Número de Huéspedes").click() | ||
page.get_by_placeholder("Número de Huéspedes").fill("2") | ||
page.get_by_role("button", name="Reservar").click() |
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,14 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.utils import timezone | ||
|
||
from Reception.models import RoomReservation | ||
|
||
|
||
class Command(BaseCommand): | ||
help = 'Deletes room reservations older than 2 years' | ||
|
||
def handle(self, *args, **kwargs): | ||
two_years_ago = timezone.now() - timezone.timedelta(days=365 * 2) | ||
old_reservations = RoomReservation.objects.filter(guest_checkout__lt=two_years_ago) | ||
old_reservations.delete() | ||
self.stdout.write(self.style.SUCCESS('Deleted room reservations where checkout date is older than 2 years.')) |
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
Oops, something went wrong.