Apply prettier, add two data files

This commit is contained in:
Tatiana Ryzhova 2019-09-23 16:29:53 +02:00
parent a3bf7d1079
commit 8ad67701fc
6 changed files with 45 additions and 42 deletions

View file

@ -0,0 +1 @@
export const MAIN_PAGE_URL = "http://localhost:9000/";

View file

@ -0,0 +1,2 @@
export const DEFAULT_USER_EMAIL = "admin@example.com";
export const DEFAULT_USER_PASSWORD = "admin";

View file

@ -1,7 +1,11 @@
import {Selector,t} from 'testcafe'; import { Selector, t } from "testcafe";
export default class HomePage{ export default class HomePage {
constructor(){ constructor() {
this.header = Selector ('[data-tc="home-header"]'); this.header = Selector('[data-tc="home-header"]');
} this.catalogMenu = Selector('[data-tc="Catalog"]');
} this.productsSubMenu = Selector(
'[data-tc="catalogue"]>[aria-label="products"]'
);
}
}

View file

@ -1,17 +1,16 @@
import {Selector,t} from 'testcafe'; import { Selector, t } from "testcafe";
export default class LoginPage{ export default class LoginPage {
constructor(){ constructor() {
this.mainPageURL='http://localhost:9000/'; this.email = Selector('[data-tc="email"]');
this.email = Selector('[data-tc="email"]'); this.password = Selector('[data-tc="password"]');
this.password = Selector('[data-tc="password"]'); this.submitButton = Selector('[data-tc="submit"]');
this.submitButton = Selector('[data-tc="submit"]'); }
}
async performLogin(putEmail, putPassword){ async performLogin(putEmail, putPassword) {
await t await t
.typeText(this.email, putEmail) .typeText(this.email, putEmail)
.typeText(this.password, putPassword) .typeText(this.password, putPassword)
.click(this.submitButton); .click(this.submitButton);
} }
} }

View file

@ -1,7 +1,7 @@
import * as verifier from '../Verifications/loginPageVerifications'; import * as verifier from "../Verifications/loginPageVerifications";
import { MAIN_PAGE_URL } from "../Data/systemData";
fixture `Login Tests` fixture`Login Tests`.page(MAIN_PAGE_URL);
.page(verifier.mainPageURL);
verifier.verifyEmailAndPasswordDisplayed(); verifier.verifyEmailAndPasswordDisplayed();
verifier.verifyIfUserCanLogin(); verifier.verifyIfUserCanLogin();

View file

@ -1,23 +1,20 @@
import LoginPage from '../Models/loginPageModel'; import LoginPage from "../Models/loginPageModel";
import HomePage from '../Models/homePageModel'; import HomePage from "../Models/homePageModel";
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from "../Data/userData";
const loginPage = new LoginPage(); const loginPage = new LoginPage();
const homePage = new HomePage(); const homePage = new HomePage();
export const mainPageURL = loginPage.mainPageURL;
const USER_EMAIL = 'admin@example.com'; export function verifyEmailAndPasswordDisplayed() {
const USER_PASSWORD = 'admin'; test("Verify that Email and Password are displayed", async t => {
await t.expect(loginPage.email.exists).ok();
export function verifyEmailAndPasswordDisplayed(){ await t.expect(loginPage.password.exists).ok();
test('Verify that Email and Password are displayed', async t =>{ });
await t.expect(loginPage.email.exists).ok();
await t.expect(loginPage.password.exists).ok();
})
} }
export function verifyIfUserCanLogin(){ export function verifyIfUserCanLogin() {
test.only('PerformLogin', async t =>{ test("PerformLogin", async t => {
await loginPage.performLogin(USER_EMAIL, USER_PASSWORD); await loginPage.performLogin(DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD);
await t.expect(homePage.header.exists).ok(); await t.expect(homePage.header.exists).ok();
} ) });
} }