fix: check that login input is visible before logging in
@@ -149,14 +149,20 @@ export default class StepImplementation {
@Step('Sign in as <username> with <password>')
public async signInWithPassword(username: string, password: string) {
await goto(`${BASE_URL}/login`);
- const loginSelector = t.$('#login_username');
- await t.focus(loginSelector);
+
+ const usernameInput = t.textBox({ id: 'login_username' });
+ await usernameInput.isVisible();
+ await t.focus(usernameInput);
await t.clear();
await t.write(username);
+
if (password !== '') {
- await t.focus(t.$('#login_password'));
+ const passwordInput = t.textBox({ id: 'login_password' });
+ await passwordInput.isVisible();
+ await t.focus(passwordInput);
await t.write(password);
}
+
await clickAndWaitForPage(t.button('Sign In'));
await t.text(username, t.near(t.$('#avatar'))).exists();
}
