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 {
constructor() {
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,8 +1,7 @@
import {Selector,t} from 'testcafe';
import { Selector, t } from "testcafe";
export default class LoginPage {
constructor() {
this.mainPageURL='http://localhost:9000/';
this.email = Selector('[data-tc="email"]');
this.password = Selector('[data-tc="password"]');
this.submitButton = Selector('[data-tc="submit"]');

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`
.page(verifier.mainPageURL);
fixture`Login Tests`.page(MAIN_PAGE_URL);
verifier.verifyEmailAndPasswordDisplayed();
verifier.verifyIfUserCanLogin();

View file

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