forked from enviPath/enviPy
Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Co-authored-by: Liam Brydon <lbry121@aucklanduni.ac.nz> Reviewed-on: enviPath/enviPy#249
39 lines
1.7 KiB
Python
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()
|