Skip to content

Instantly share code, notes, and snippets.

@jwaldrip
Last active July 6, 2018 04:08
Show Gist options
  • Save jwaldrip/26684819847fc9c1ee8511ec59ec6da4 to your computer and use it in GitHub Desktop.
Save jwaldrip/26684819847fc9c1ee8511ec59ec6da4 to your computer and use it in GitHub Desktop.
POC for PageOx
import LoginScreen from "./login-screen-object";
import BasicInfoScreen from "./basic-info-screen-object";
const loginScreen = new LoginScreen();
const basicInfoScreen = new BasicInfoScreen();
describe("login screen", () => {
it("should be be deeplinkable", async () => {
await loginScreen.open();
await expect(loginScreen.element).toBeVisible();
})
it("should allow a user to login", async () => {
await loginScreen.open();
await loginScreen.fillInEmail("test@example.com");
await loginScreen.fillInPassword("password");
await loginScreen.tapSubmit();
await expect(loginScreen).toBeVisible();
})
});
import faker from "faker";
import { PageObject } from "page-ox";
export default class LoginScreen extends PageObject {
static deepLinkURI = "/auth/login";
static element = element(by.id("login-screen"));
fillInEmail(email = faker.internet.exampleEmail()) {
return element(by.id("email-address-input")).typeText(email);
}
fillInPassword(password = faker.internet.password(15)) {
return element(by.id("password-input")).typeText(password);
}
tapSubmit() {
return element(by.id("email-address-input")).typeText(email);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment