Apply prettier, add two data files
This commit is contained in:
parent
a3bf7d1079
commit
8ad67701fc
6 changed files with 45 additions and 42 deletions
1
.testcafe/Data/systemData.js
Normal file
1
.testcafe/Data/systemData.js
Normal file
|
@ -0,0 +1 @@
|
|||
export const MAIN_PAGE_URL = "http://localhost:9000/";
|
2
.testcafe/Data/userData.js
Normal file
2
.testcafe/Data/userData.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
export const DEFAULT_USER_EMAIL = "admin@example.com";
|
||||
export const DEFAULT_USER_PASSWORD = "admin";
|
|
@ -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"]');
|
||||
}
|
||||
}
|
||||
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"]'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
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"]');
|
||||
}
|
||||
export default class LoginPage {
|
||||
constructor() {
|
||||
this.email = Selector('[data-tc="email"]');
|
||||
this.password = Selector('[data-tc="password"]');
|
||||
this.submitButton = Selector('[data-tc="submit"]');
|
||||
}
|
||||
|
||||
async performLogin(putEmail, putPassword){
|
||||
await t
|
||||
.typeText(this.email, putEmail)
|
||||
.typeText(this.password, putPassword)
|
||||
.click(this.submitButton);
|
||||
}
|
||||
}
|
||||
async performLogin(putEmail, putPassword) {
|
||||
await t
|
||||
.typeText(this.email, putEmail)
|
||||
.typeText(this.password, putPassword)
|
||||
.click(this.submitButton);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
verifier.verifyEmailAndPasswordDisplayed();
|
||||
verifier.verifyIfUserCanLogin();
|
||||
|
|
|
@ -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 =>{
|
||||
await t.expect(loginPage.email.exists).ok();
|
||||
await t.expect(loginPage.password.exists).ok();
|
||||
})
|
||||
export function verifyEmailAndPasswordDisplayed() {
|
||||
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);
|
||||
await t.expect(homePage.header.exists).ok();
|
||||
} )
|
||||
export function verifyIfUserCanLogin() {
|
||||
test("PerformLogin", async t => {
|
||||
await loginPage.performLogin(DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD);
|
||||
await t.expect(homePage.header.exists).ok();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue