sclass GazelleSiteTester implements AutoCloseable { PlaywrightAndBrowser playwright; S site = "https://empty.gazelle.rocks"; new Scorer scorer; void init { playwright if null = playwrightWithChromium(); } abstract class Tester { Page page; void assertPageContainsText(S text) { assertNotNull(scorer, text, page.querySelector("text=" + text)); } void openSite { init(); page = playwrightOpenPage(playwright.browser, page, site); } void fill(O... _) { for (O key, O val : paramsToObjectMap(_)) page.fill("[name=" + key + "]", str(val)); } } class TestRegistration extends Tester { S user = "testuser" + random(1000000); S pw = "pw" + random(1000000); S contact = "dummy contact"; run { openSite(); page.click("text=Register as new user"); fill(+user, f_pw := pw, pw2 := pw, +contact); page.click([[[type=submit]:has-text("Register")]]); assertPageContainsText(dollarFormat("User $user created", +user)); } } class LogIn extends Tester { S user; S pw; double delay = 3.0; run { openSite(); page.fill("[name=user]", user); page.fill("[name=pw]", pw); page.click([[[type=submit]:has-text("Log in")]]); sleepSeconds(delay); //page.waitForLoadState(); /*page.waitForNavigation(() -> { page.click([[[type=submit]:has-text("Log in")]]); });*/ assertPageContainsText("[user " + user + "]"); assertPageContainsText("BEA Objects"); } } LogIn registerAndLogIn() { new TestRegistration reg; reg.run(); new LogIn logIn; copyFields(reg, logIn, "user", "pw", "page"); logIn.run(); ret logIn; } public void close { dispose playwright; } toString { ret "Tested " + site + ": " + scorer; } }