-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
742 additions
and
80 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {createLogger, transports, format} from 'winston' | ||
|
||
const logger = createLogger({ | ||
transports: [new transports.Console()], | ||
format: format.combine( | ||
format.colorize(), | ||
format.timestamp(), | ||
format.printf(({ timestamp, level, message, service }) => { | ||
return `[${timestamp}] ${service} ${level}: ${message}`; | ||
}) | ||
), | ||
}); | ||
|
||
module.exports = function (name: any) { | ||
return logger.child({ moduleName: name }) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,55 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { HomePage } from '../pages/home-page'; | ||
import { LoginPage } from '../pages/login-page'; | ||
import {expect, test} from '@playwright/test'; | ||
import {allure} from "allure-playwright"; | ||
|
||
import {HomePage} from '../pages/home-page'; | ||
import {LoginPage} from '../pages/login-page'; | ||
|
||
test.describe('Login', () => { | ||
|
||
let homePage: HomePage; | ||
let loginPage: LoginPage; | ||
let homePage: HomePage; | ||
let loginPage: LoginPage; | ||
|
||
test.beforeEach(async ({page}) => { | ||
homePage = new HomePage(page); | ||
loginPage = new LoginPage(page); | ||
}); | ||
|
||
test('should be able to login', async ({page}) => { | ||
|
||
await allure.epic("Login"); | ||
await allure.feature("Login feature"); | ||
await allure.story("Login story"); | ||
|
||
test.beforeEach(async ({page}) => { | ||
homePage = new HomePage(page); | ||
loginPage = new LoginPage(page); | ||
}); | ||
const email = process.env.USER_EMAIL_NAME; | ||
const password = process.env.USER_PASSWORD; | ||
|
||
test('should be able to login', async ({page}) => { | ||
await allure.step("Navigate to home page", async () => { | ||
await homePage.navigateToHomePage("/"); | ||
}); | ||
|
||
const email = process.env.USER_EMAIL_NAME; | ||
const password = process.env.USER_PASSWORD; | ||
await allure.step("Click on login button", async () => { | ||
await homePage.clickOnLoginButton(); | ||
}); | ||
|
||
await homePage.navigateToHomePage("/"); | ||
await homePage.clickOnLoginButton(); | ||
// @ts-ignore | ||
await loginPage.enterEmail(email); | ||
// @ts-ignore | ||
await loginPage.enterPassword(password); | ||
await loginPage.clickOnLoginButton(); | ||
await allure.step("Enter email and password", async () => { | ||
// @ts-ignore | ||
await loginPage.enterEmail(email); | ||
// @ts-ignore | ||
await loginPage.enterPassword(password); | ||
}); | ||
|
||
await allure.step("Click on login button", async () => { | ||
await loginPage.clickOnLoginButton(); | ||
}); | ||
|
||
// get the url of the current page | ||
const url = page.url(); | ||
expect(url).toContain('account/account'); | ||
console.log('Current page url is: ' + url); | ||
await allure.step("Verify that user is logged in", async () => { | ||
const url = page.url(); | ||
expect(url).toContain('account/account'); | ||
console.log('Current page url is: ' + url); | ||
}); | ||
|
||
// logout | ||
await loginPage.clickOnLogoutButton(); | ||
}); | ||
await allure.step("Logout", async () => { | ||
await loginPage.clickOnLogoutButton(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,150 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { RegisterPage } from '../pages/register-page'; | ||
import { HomePage } from '../pages/home-page'; | ||
import { LoginPage } from '../pages/login-page'; | ||
import {expect, test} from '@playwright/test'; | ||
import {allure} from "allure-playwright"; | ||
|
||
import { faker } from '@faker-js/faker'; | ||
import {RegisterPage} from '../pages/register-page'; | ||
import {HomePage} from '../pages/home-page'; | ||
import {LoginPage} from '../pages/login-page'; | ||
|
||
import {faker} from '@faker-js/faker'; | ||
|
||
test.describe('Create new user account', () => { | ||
|
||
let registerPage: RegisterPage; | ||
let homePage: HomePage; | ||
let loginPage: LoginPage; | ||
|
||
test.beforeEach(async ({page}) => { | ||
registerPage = new RegisterPage(page); | ||
homePage = new HomePage(page); | ||
loginPage = new LoginPage(page); | ||
}); | ||
|
||
test('should be able to create a account', async ({page}) => { | ||
|
||
const email = faker.internet.email(); | ||
const password = faker.internet.password(); | ||
|
||
await homePage.navigateToHomePage("/"); | ||
await homePage.clickOnLoginButton(); | ||
await loginPage.clickOnContinueButton(); | ||
await registerPage.enterFirstName(faker.person.firstName()); | ||
await registerPage.enterLastName(faker.person.lastName()); | ||
await registerPage.enterEmail(email); | ||
await registerPage.enterTelephone(faker.phone.number()); | ||
await registerPage.enterPassword(password); | ||
await registerPage.enterConfirmPassword(password); | ||
await registerPage.clickOnSubscribeRadioButton(); | ||
await registerPage.clickOnPrivacyPolicyCheckbox(); | ||
await registerPage.clickOnContinueButton(); | ||
|
||
// get the url of the current page | ||
const url = page.url(); | ||
expect(url).toContain('account/success'); | ||
console.log('Current page url is: ' + url); | ||
}); | ||
let registerPage: RegisterPage; | ||
let homePage: HomePage; | ||
let loginPage: LoginPage; | ||
|
||
test.beforeEach(async ({page}) => { | ||
|
||
await allure.epic("Register"); | ||
await allure.feature("Register feature"); | ||
await allure.story("Register story"); | ||
|
||
registerPage = new RegisterPage(page); | ||
homePage = new HomePage(page); | ||
loginPage = new LoginPage(page); | ||
}); | ||
|
||
test('should be able to create a account', async ({page}) => { | ||
|
||
const email = faker.internet.email(); | ||
const password = faker.internet.password(); | ||
|
||
await allure.step("Navigate to home page", async () => { | ||
await homePage.navigateToHomePage("/"); | ||
}); | ||
|
||
await allure.step("Click on login button", async () => { | ||
await homePage.clickOnLoginButton(); | ||
}); | ||
|
||
await allure.step("Click on continue button", async () => { | ||
await loginPage.clickOnContinueButton(); | ||
}); | ||
|
||
await allure.step("Enter first name", async () => { | ||
await registerPage.enterFirstName(faker.person.firstName()); | ||
}); | ||
|
||
await allure.step("Enter last name", async () => { | ||
await registerPage.enterLastName(faker.person.lastName()); | ||
}); | ||
|
||
await allure.step("Enter email", async () => { | ||
await registerPage.enterEmail(email); | ||
}); | ||
|
||
await allure.step("Enter telephone", async () => { | ||
await registerPage.enterTelephone(faker.phone.number()); | ||
}); | ||
|
||
await allure.step("Enter password", async () => { | ||
await registerPage.enterPassword(password); | ||
}); | ||
|
||
await allure.step("Enter confirm password", async () => { | ||
await registerPage.enterConfirmPassword(password); | ||
}); | ||
|
||
await allure.step("Click on subscribe radio button", async () => { | ||
await registerPage.clickOnSubscribeRadioButton(); | ||
}); | ||
|
||
await allure.step("Click on privacy policy checkbox", async () => { | ||
await registerPage.clickOnPrivacyPolicyCheckbox(); | ||
}); | ||
|
||
await allure.step("Click on continue button", async () => { | ||
await registerPage.clickOnContinueButton(); | ||
}); | ||
|
||
await allure.step("Verify that user is logged in", async () => { | ||
const url = page.url(); | ||
expect(url).toContain('account/success'); | ||
console.log('Current page url is: ' + url); | ||
}); | ||
}); | ||
|
||
test('shouln\'t be able to create a account with existing email', async ({page}) => { | ||
|
||
const email = process.env.USER_EMAIL_NAME; | ||
const password = faker.internet.password(); | ||
|
||
await allure.step("Navigate to home page", async () => { | ||
await homePage.navigateToHomePage("/"); | ||
|
||
}); | ||
|
||
await allure.step("Click on login button", async () => { | ||
await homePage.clickOnLoginButton(); | ||
}); | ||
|
||
await allure.step("Click on continue button", async () => { | ||
await loginPage.clickOnContinueButton(); | ||
}); | ||
|
||
await allure.step("Enter first name", async () => { | ||
await registerPage.enterFirstName(faker.person.firstName()); | ||
}); | ||
|
||
await allure.step("Enter last name", async () => { | ||
await registerPage.enterLastName(faker.person.lastName()); | ||
}); | ||
|
||
await allure.step("Enter email", async () => { | ||
// @ts-ignore | ||
await registerPage.enterEmail(email); | ||
}); | ||
|
||
await allure.step("Enter telephone", async () => { | ||
await registerPage.enterTelephone(faker.phone.number()); | ||
}); | ||
|
||
await allure.step("Enter password", async () => { | ||
await registerPage.enterPassword(password); | ||
}); | ||
|
||
await allure.step("Enter confirm password", async () => { | ||
await registerPage.enterConfirmPassword(password); | ||
}); | ||
|
||
await allure.step("Click on subscribe radio button", async () => { | ||
await registerPage.clickOnSubscribeRadioButton(); | ||
}); | ||
|
||
await allure.step("Click on privacy policy checkbox", async () => { | ||
await registerPage.clickOnPrivacyPolicyCheckbox(); | ||
}); | ||
|
||
await allure.step("Click on continue button", async () => { | ||
await registerPage.clickOnContinueButton(); | ||
}); | ||
|
||
await allure.step("Verify that Email is already registered", async () => { | ||
const warnMessage = page.getByText('Warning: E-Mail Address is') | ||
|
||
expect(warnMessage).toBeTruthy(); | ||
expect(warnMessage).toHaveText('Warning: E-Mail Address is already registered!'); | ||
console.log('Warning message is: ' + warnMessage); | ||
}); | ||
}); | ||
}); |