Files
enviPy-bayer/tests/frontend/test_homepage.py
jebus d6440f416c [Fix] Frontend Testing Fixtures (#249)
Co-authored-by: Tim Lorsbach <tim@lorsba.ch>
Co-authored-by: Liam Brydon <lbry121@aucklanduni.ac.nz>
Reviewed-on: enviPath/enviPy#249
2025-12-03 10:49:23 +13:00

39 lines
1.7 KiB
Python

from django.test import tag
from playwright.sync_api import expect
from .frontend_base import EnviPyStaticLiveServerTestCase
class TestHomepage(EnviPyStaticLiveServerTestCase):
@tag("frontend")
def test_predict(self):
page = self.login()
page.get_by_role("textbox", name="canonical SMILES string").click()
page.get_by_role("textbox", name="canonical SMILES string").fill("CCCN")
page.get_by_role("button", name="Predict!").click()
# Check that the pathway box is visible
expect(page.locator("rect")).to_be_visible(timeout=10000)
@tag("frontend")
def test_advanced_predict(self):
page = self.login()
page.get_by_role("link", name="Advanced").click()
# Check predict page opens correctly
expect(page.get_by_role("heading", name="Predict a Pathway in")).to_be_visible()
page.get_by_role("textbox", name="Name").click()
page.get_by_role("textbox", name="Name").fill("Test Pathway")
page.get_by_role("textbox", name="Description").click()
page.get_by_role("textbox", name="Description").fill("Test Description")
page.get_by_role("textbox", name="SMILES").click()
page.get_by_role("textbox", name="SMILES").fill("OCCCN")
page.locator("#predict-submit-button").click()
# Check that the pathway box is visible
expect(page.locator("rect")).to_be_visible(timeout=10000)
@tag("frontend")
def test_go_home(self) -> None:
page = self.login()
page.get_by_role("link").first.click()
# Check the homepage predict box is visible
expect(page.get_by_text("SMILES Draw Predict! Caffeine")).to_be_visible()