-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #296
base: main
Are you sure you want to change the base?
Solution #296
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,73 @@ | ||
/// <reference types='cypress' /> | ||
/// <reference types='../support' /> | ||
|
||
describe('Article', () => { | ||
before(() => { | ||
|
||
}); | ||
|
||
beforeEach(() => { | ||
cy.task('db:clear'); | ||
}); | ||
|
||
it('should be created using New Article form', () => { | ||
|
||
}); | ||
|
||
it('should be edited using Edit button', () => { | ||
|
||
}); | ||
|
||
it('should be deleted using Delete button', () => { | ||
|
||
}); | ||
}); | ||
/// <reference types='cypress' /> | ||
/// <reference types='../support' /> | ||
|
||
import { faker } from "@faker-js/faker"; | ||
|
||
import ArticlePageObject from "../support/pages/article.pageObject"; | ||
const articlePage = new ArticlePageObject(); | ||
|
||
describe("Article", () => { | ||
let user; | ||
let article; | ||
let newArticle; | ||
|
||
before(() => { | ||
cy.task("generateUser").then((generateUser) => { | ||
user = generateUser; | ||
}); | ||
cy.task("generateArticle").then((generatedArticle) => { | ||
article = generatedArticle; | ||
newArticle = { | ||
title: "Edited " + generatedArticle.title, | ||
description: "Edited " + generatedArticle.description, | ||
body: "Edited " + generatedArticle.body, | ||
tag: "edited-tag", | ||
}; | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.task("db:clear"); | ||
cy.visit("/"); | ||
cy.registerAndLogin(user.email, user.username, user.password); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
articlePage.visit(); | ||
}); | ||
|
||
it("should be created using New Article form", () => { | ||
articlePage.typeTitle(article.title); | ||
articlePage.typeDescription(article.description); | ||
articlePage.typeBodyArticle(article.body); | ||
articlePage.typeTag(article.tag); | ||
articlePage.clickPublishBtn(); | ||
articlePage.assertArticlePage(article.title); | ||
}); | ||
|
||
it("should be edited using Edit button", () => { | ||
cy.createArticle( | ||
article.title, | ||
article.description, | ||
article.body, | ||
article.tag | ||
); | ||
Comment on lines
+46
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
articlePage.assertArticlePage(article.title); | ||
articlePage.clickEditArticleBtn(); | ||
articlePage.typeNewTitle(newArticle.title); | ||
articlePage.typeNewDescription(newArticle.description); | ||
articlePage.typeNewBodyArticle(newArticle.body); | ||
articlePage.typeTag(newArticle.tag); | ||
articlePage.clickPublishBtn(); | ||
articlePage.assertTitleArticlePage(newArticle.title); | ||
}); | ||
|
||
it("should be deleted using Delete button", () => { | ||
cy.createArticle( | ||
article.title, | ||
article.description, | ||
article.body, | ||
article.tag | ||
); | ||
articlePage.assertArticlePage(article.title); | ||
articlePage.clickDeleteArticleBtn(); | ||
cy.url().should("not.include", article.title); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,49 @@ | ||
/// <reference types='cypress' /> | ||
/// <reference types='../support' /> | ||
|
||
describe('Settings page', () => { | ||
before(() => { | ||
|
||
}); | ||
|
||
beforeEach(() => { | ||
|
||
}); | ||
|
||
it('should provide an ability to update username', () => { | ||
|
||
}); | ||
|
||
it('should provide an ability to update bio', () => { | ||
|
||
}); | ||
|
||
it('should provide an ability to update an email', () => { | ||
|
||
}); | ||
|
||
it('should provide an ability to update password', () => { | ||
|
||
}); | ||
|
||
it('should provide an ability to log out', () => { | ||
|
||
}); | ||
}); | ||
/// <reference types='cypress' /> | ||
/// <reference types='../support' /> | ||
import SettingsPageObject from "../support/pages/settings.PageObject"; | ||
import HomePageObject from "../support/pages/home.pageObject"; | ||
|
||
const settingsPage = new SettingsPageObject(); | ||
const homePage = new HomePageObject(); | ||
|
||
describe("Settings page", () => { | ||
let user; | ||
before(() => { | ||
cy.task("generateUser").then((generateUser) => { | ||
user = generateUser; | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
cy.task("db:clear"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
cy.visit("/#/register"); | ||
cy.registerAndLogin(user.email, user.username, user.password); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
settingsPage.visit(); | ||
}); | ||
|
||
it("should provide an ability to update username", () => { | ||
settingsPage.typeUsername(user.username); | ||
settingsPage.clickUpdateSettingsBtn(); | ||
homePage.assertHeaderContainUsername(user.username); | ||
}); | ||
|
||
it("should provide an ability to update bio", () => { | ||
settingsPage.typeBio(user.bio); | ||
settingsPage.clickUpdateSettingsBtn(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After updating the bio, consider adding an assertion to verify that the bio has been updated correctly. This will ensure that the update operation is successful. |
||
}); | ||
|
||
it("should provide an ability to update an email", () => { | ||
settingsPage.typeEmail(user.email); | ||
settingsPage.clickUpdateSettingsBtn(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After updating the email, consider adding an assertion to verify that the email has been updated correctly. This will ensure that the update operation is successful. |
||
}); | ||
|
||
it("should provide an ability to update password", () => { | ||
settingsPage.typePassword(user.password); | ||
settingsPage.clickUpdateSettingsBtn(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After updating the password, consider adding an assertion to verify that the password has been updated correctly. This will ensure that the update operation is successful. |
||
}); | ||
|
||
it("should provide an ability to log out", () => { | ||
settingsPage.clickLogoutBtn(); | ||
settingsPage.assertLogout("/#/"); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,41 @@ | ||
/// <reference types='cypress' /> | ||
/// <reference types='../support' /> | ||
|
||
import SignInPageObject from '../support/pages/signIn.pageObject'; | ||
import HomePageObject from '../support/pages/home.pageObject'; | ||
|
||
const signInPage = new SignInPageObject(); | ||
const homePage = new HomePageObject(); | ||
|
||
describe('Sign In page', () => { | ||
let user; | ||
|
||
before(() => { | ||
cy.task('db:clear'); | ||
cy.task('generateUser').then((generateUser) => { | ||
user = generateUser; | ||
}); | ||
}); | ||
|
||
it('should provide an ability to log in with existing credentials', () => { | ||
signInPage.visit(); | ||
cy.register(user.email, user.username, user.password); | ||
|
||
signInPage.typeEmail(user.email); | ||
signInPage.typePassword(user.password); | ||
signInPage.clickSignInBtn(); | ||
|
||
homePage.assertHeaderContainUsername(user.username); | ||
}); | ||
|
||
it('should not provide an ability to log in with wrong credentials', () => { | ||
|
||
}); | ||
}); | ||
/// <reference types='cypress' /> | ||
/// <reference types='../support' /> | ||
|
||
import { faker } from "@faker-js/faker"; | ||
|
||
import SignInPageObject from "../support/pages/signIn.pageObject"; | ||
import HomePageObject from "../support/pages/home.pageObject"; | ||
|
||
const signInPage = new SignInPageObject(); | ||
const homePage = new HomePageObject(); | ||
|
||
describe("Sign In page", () => { | ||
let user; | ||
|
||
beforeEach(() => { | ||
cy.task("db:clear"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
cy.task("generateUser").then((generateUser) => { | ||
user = generateUser; | ||
}); | ||
}); | ||
|
||
it("should provide an ability to log in with existing credentials", () => { | ||
signInPage.visit(); | ||
cy.register(user.email, user.username, user.password); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
signInPage.typeEmail(user.email); | ||
signInPage.typePassword(user.password); | ||
signInPage.clickSignInBtn(); | ||
|
||
homePage.assertHeaderContainUsername(user.username); | ||
}); | ||
|
||
it("should not provide an ability to log in with wrong credentials", () => { | ||
signInPage.visit(); | ||
signInPage.typeEmail(user.email); | ||
signInPage.typePassword(user.password + "123"); | ||
signInPage.clickSignInBtn(); | ||
signInPage.assertErrorMessage(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the |
||
signInPage.assertLoginPage(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the |
||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,45 @@ | ||
/// <reference types='cypress' /> | ||
/// <reference types='../support' /> | ||
|
||
describe('Sign Up page', () => { | ||
before(() => { | ||
|
||
}); | ||
|
||
it('should ...', () => { | ||
|
||
}); | ||
}); | ||
/// <reference types='cypress' /> | ||
/// <reference types='../support' /> | ||
|
||
import SignUpPageObject from "../support/pages/signUp.PageObject"; | ||
import HomePageObject from "../support/pages/home.pageObject"; | ||
|
||
const signUpPage = new SignUpPageObject(); | ||
const homePage = new HomePageObject(); | ||
|
||
describe("Sign Up page", () => { | ||
let user; | ||
let newUser; | ||
beforeEach(() => { | ||
cy.task("db:clear"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
cy.task("generateUser").then((generatedUser) => { | ||
user = generatedUser; | ||
}); | ||
cy.task("generateUser").then((generatedUser) => { | ||
newUser = generatedUser; | ||
}); | ||
signUpPage.visit(); | ||
}); | ||
|
||
it("should provide an ability to sign up with valid credentials", () => { | ||
signUpPage.visit(); | ||
cy.getByDataCy("signup-username-field").should("be.visible"); | ||
signUpPage.typeUsername(user.username); | ||
signUpPage.typeEmail(user.email); | ||
signUpPage.typePassword(user.password); | ||
signUpPage.clickSignUpBtn(); | ||
signUpPage.assertSuccessfulMessage(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the |
||
|
||
homePage.assertHeaderContainUsername(user.username); | ||
}); | ||
|
||
it("should not provide an ability to sign up with existing email", () => { | ||
cy.register(user.email, user.username, user.password); | ||
signUpPage.typeUsername(newUser.username); | ||
signUpPage.typeEmail(user.email); | ||
signUpPage.typePassword(newUser.password); | ||
signUpPage.clickSignUpBtn(); | ||
signUpPage.assertErrorMessage(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the |
||
signUpPage.assertSignUpPage(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the |
||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,54 @@ | ||
/// <reference types='cypress' /> | ||
/// <reference types='../support' /> | ||
|
||
describe('User', () => { | ||
before(() => { | ||
|
||
}); | ||
|
||
it.skip('should be able to follow the another user', () => { | ||
|
||
}); | ||
}); | ||
/// <reference types='cypress' /> | ||
/// <reference types='../support' /> | ||
|
||
import HomePageObject from '../support/pages/home.pageObject'; | ||
import SignInPageObject from '../support/pages/signIn.pageObject'; | ||
import UserPageObject from "../support/pages/user.PageObject"; | ||
const signInPage = new SignInPageObject(); | ||
const userPage = new UserPageObject(); | ||
const homePage = new HomePageObject(); | ||
|
||
describe("User", () => { | ||
let user; | ||
let secondUser; | ||
|
||
before(() => { | ||
cy.task('db:clear'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
// Generating first user | ||
cy.task('generateUser').then((generatedUser) => { | ||
user = generatedUser; | ||
// Registering first user | ||
cy.register(user.email, user.username, user.password); | ||
}); | ||
|
||
// Generating second user | ||
cy.task('generateUser').then((generatedUser) => { | ||
secondUser = generatedUser; | ||
// Registering second user | ||
cy.register(secondUser.email, secondUser.username, secondUser.password); | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
signInPage.visit(); | ||
signInPage.typeEmail(user.email); | ||
signInPage.typePassword(user.password); | ||
signInPage.clickSignInBtn(); | ||
homePage.assertHeaderContainUsername(user.username); | ||
}); | ||
|
||
it("should allow following a user", () => { | ||
userPage.visitUserPage(secondUser.username); | ||
userPage.assertCanFollowUser(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the |
||
userPage.clickFollowBtn(); | ||
userPage.assertFollowingUser(secondUser.username); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the |
||
}); | ||
|
||
it('should allow unfollowing a user', () => { | ||
userPage.visitUserPage(secondUser.username); | ||
userPage.assertFollowingUser(secondUser.username); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the |
||
userPage.clickUnfollowBtn(); | ||
userPage.assertCanFollowUser(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure that the |
||
}); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
class PageObject { | ||
visit(url) { | ||
cy.visit(url || this.url); | ||
} | ||
} | ||
|
||
export default PageObject; | ||
class PageObject { | ||
visit(url) { | ||
cy.visit(url || this.url); | ||
} | ||
} | ||
export default PageObject; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
cy.task('db:clear')
command is used to clear the database before each test. Ensure that this task is correctly defined in your Cypress support files and that it performs the intended database clearing operation. If not all tests require a fresh database state, consider moving this to specific tests that need it.