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

Using Performable does not work #13

Open
daccto opened this issue Jul 10, 2024 · 0 comments
Open

Using Performable does not work #13

daccto opened this issue Jul 10, 2024 · 0 comments

Comments

@daccto
Copy link

daccto commented Jul 10, 2024

I have the following Performable:

public static Performable asAdministrator(String url, String username, String password) { return Task.where( "{0} logs in as " + username, Open.url(url), Click.on(HomePage.homePageLoginButtonXPath()).afterWaitingUntilEnabled(), Enter.theValue(username).into(LoginPage.loginPageUserNameXPath()), Enter.theValue(password).into(LoginPage.loginPagePasswordXPath()), Click.on(LoginPage.xPathForHomePageLoginButton()) ); }

And using it in this test:

@Test @DisplayName("The user can successfully login with the correct credentials") void userCanLoginSuccessfully() { administrator.attemptsTo( // Open.url("https://osh-preprod.oneapihub.com/"), // Click.on(HomePage.homePageLoginButtonXPath()), // Enter.theValue(username).into(LoginPage.loginPageUserNameXPath()), // Enter.theValue(password).into(LoginPage.loginPagePasswordXPath()), // Click.on(LoginPage.loginPageLoginButtonXPath()) Login.asAdministrator(rootUrl, username, password) ); String contentHeaderTitle = administrator.asksFor(Text.of("//h4[@id='content-header-title']")); Assertions.assertNotNull(contentHeaderTitle); Serenity.reportThat("The User is greeted with a welcome message", () -> Assertions.assertTrue(contentHeaderTitle.contains("Welcome")) ); }

It tells me it can't find the login button element.

However if I uncomment the code and remove the call to the performable, this works.

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

No branches or pull requests

1 participant