-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
4 changed files
with
604 additions
and
630 deletions.
There are no files selected for viewing
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,109 +1,109 @@ | ||
// import { FRIENDLY_MESSAGES } from 'oa-shared' | ||
|
||
// import { generateNewUserDetails } from '../utils/TestUtils' | ||
|
||
// describe('[User sign-up]', () => { | ||
// beforeEach(() => { | ||
// cy.visit('/sign-up') | ||
// }) | ||
|
||
// describe('[New user]', () => { | ||
// it('Validate sign-up form', () => { | ||
// cy.step('Username is too short') | ||
// cy.get('[data-cy=username]').click() | ||
// cy.get('[data-cy=username]').clear().type('a') | ||
// cy.get('[data-cy=consent]').uncheck().check() | ||
// cy.contains('Username must be at least 2 characters').should('be.visible') | ||
|
||
// cy.step('Email is invalid') | ||
// cy.get('[data-cy=email]').click() | ||
// cy.get('[data-cy=email]').clear().type('a') | ||
// cy.get('[data-cy=consent]').uncheck().check() | ||
// cy.contains(FRIENDLY_MESSAGES['auth/invalid-email']).should('be.visible') | ||
|
||
// cy.step('Password is too short') | ||
// cy.get('[data-cy=password]').click() | ||
// cy.get('[data-cy=password]').clear().type('a') | ||
// cy.get('[data-cy=consent]').uncheck().check() | ||
// cy.contains('Password must be at least 6 characters').should('be.visible') | ||
|
||
// cy.step('Password confirmation does not match') | ||
// cy.get('[data-cy=password]').click() | ||
// cy.get('[data-cy=password]').clear().type('a') | ||
// cy.get('[data-cy=confirm-password]').click() | ||
// cy.get('[data-cy=confirm-password]').clear().type('b') | ||
// cy.get('[data-cy=consent]').uncheck().check() | ||
// cy.contains('Your new password does not match').should('be.visible') | ||
// cy.step('Using valid inputs') | ||
// cy.signUpNewUser() | ||
// cy.contains('Yay! You signed up!') | ||
// cy.get('[data-cy=user-menu]') | ||
// }) | ||
// }) | ||
|
||
// describe('[Cannot duplicate existing user]', () => { | ||
// it('Prevents duplicate name', () => { | ||
// const user = generateNewUserDetails() | ||
// const { email, username, password } = user | ||
|
||
// cy.signUpNewUser(user) | ||
// cy.logout() | ||
// cy.fillSignupForm(username, email, password) | ||
// cy.contains(FRIENDLY_MESSAGES['sign-up/username-taken']).should( | ||
// 'be.visible', | ||
// ) | ||
// }) | ||
|
||
// it('Prevents duplicate email', () => { | ||
// const user = generateNewUserDetails() | ||
// const { email, username, password } = user | ||
|
||
// cy.signUpNewUser(user) | ||
// cy.logout() | ||
// cy.fillSignupForm(`${username}-new`, email, password) | ||
// cy.get('[data-cy=submit]').click() | ||
// cy.get('[data-cy=error-msg]') | ||
// .contains(FRIENDLY_MESSAGES['auth/email-already-in-use']) | ||
// .should('be.visible') | ||
// }) | ||
// }) | ||
|
||
// describe('[Update existing auth details]', () => { | ||
// it('Updates username and password', () => { | ||
// const user = generateNewUserDetails() | ||
// const { email, username, password } = user | ||
// cy.signUpNewUser(user) | ||
|
||
// const newEmail = `${username}-super_cool@test.com` | ||
// const newPassword = '<dfbss73DF' | ||
|
||
// cy.step('Go to settings page') | ||
// cy.visit('/settings') | ||
|
||
// // cy.get('[data-cy="loader"]').not('visible') | ||
// cy.get('[data-cy="tab-Account"]').click() | ||
|
||
// cy.step('Update Email') | ||
// cy.get('[data-cy="accordionContainer"]').click({ multiple: true }) | ||
// cy.get('[data-cy="changeEmailContainer"]') | ||
// .contains(`Current email address: ${email}`) | ||
// .should('be.visible') | ||
// cy.get('[data-cy="newEmail"]').clear().type(newEmail) | ||
// cy.get('[data-cy="password"]').clear().type(password) | ||
// cy.get('[data-cy="changeEmailSubmit"]').click() | ||
// cy.get('[data-cy="changeEmailContainer"') | ||
// .contains(`Email changed to ${newEmail}`) | ||
// .should('be.visible') | ||
|
||
// cy.step('Update Password') | ||
// cy.get('[data-cy="accordionContainer"]').click({ multiple: true }) | ||
// cy.get('[data-cy="oldPassword"]').clear().type(password) | ||
// cy.get('[data-cy="newPassword"]').clear().type(newPassword) | ||
// cy.get('[data-cy="repeatNewPassword"]').clear().type(newPassword) | ||
// cy.get('[data-cy="changePasswordSubmit"]').click() | ||
// cy.get('[data-cy="changePasswordContainer"') | ||
// .contains(`Password changed`) | ||
// .should('be.visible') | ||
// }) | ||
// }) | ||
// }) | ||
import { FRIENDLY_MESSAGES } from 'oa-shared' | ||
|
||
import { generateNewUserDetails } from '../utils/TestUtils' | ||
|
||
describe('[User sign-up]', () => { | ||
beforeEach(() => { | ||
cy.visit('/sign-up') | ||
}) | ||
|
||
describe('[New user]', () => { | ||
it('Validate sign-up form', () => { | ||
cy.step('Username is too short') | ||
cy.get('[data-cy=username]').click() | ||
cy.get('[data-cy=username]').clear().type('a') | ||
cy.get('[data-cy=consent]').uncheck().check() | ||
cy.contains('Username must be at least 2 characters').should('be.visible') | ||
|
||
cy.step('Email is invalid') | ||
cy.get('[data-cy=email]').click() | ||
cy.get('[data-cy=email]').clear().type('a') | ||
cy.get('[data-cy=consent]').uncheck().check() | ||
cy.contains(FRIENDLY_MESSAGES['auth/invalid-email']).should('be.visible') | ||
|
||
cy.step('Password is too short') | ||
cy.get('[data-cy=password]').click() | ||
cy.get('[data-cy=password]').clear().type('a') | ||
cy.get('[data-cy=consent]').uncheck().check() | ||
cy.contains('Password must be at least 6 characters').should('be.visible') | ||
|
||
cy.step('Password confirmation does not match') | ||
cy.get('[data-cy=password]').click() | ||
cy.get('[data-cy=password]').clear().type('a') | ||
cy.get('[data-cy=confirm-password]').click() | ||
cy.get('[data-cy=confirm-password]').clear().type('b') | ||
cy.get('[data-cy=consent]').uncheck().check() | ||
cy.contains('Your new password does not match').should('be.visible') | ||
cy.step('Using valid inputs') | ||
cy.signUpNewUser() | ||
cy.contains('Yay! You signed up!') | ||
cy.get('[data-cy=user-menu]') | ||
}) | ||
}) | ||
|
||
describe('[Cannot duplicate existing user]', () => { | ||
it('Prevents duplicate name', () => { | ||
const user = generateNewUserDetails() | ||
const { email, username, password } = user | ||
|
||
cy.signUpNewUser(user) | ||
cy.logout() | ||
cy.fillSignupForm(username, email, password) | ||
cy.contains(FRIENDLY_MESSAGES['sign-up/username-taken']).should( | ||
'be.visible', | ||
) | ||
}) | ||
|
||
it('Prevents duplicate email', () => { | ||
const user = generateNewUserDetails() | ||
const { email, username, password } = user | ||
|
||
cy.signUpNewUser(user) | ||
cy.logout() | ||
cy.fillSignupForm(`${username}-new`, email, password) | ||
cy.get('[data-cy=submit]').click() | ||
cy.get('[data-cy=error-msg]') | ||
.contains(FRIENDLY_MESSAGES['auth/email-already-in-use']) | ||
.should('be.visible') | ||
}) | ||
}) | ||
|
||
describe('[Update existing auth details]', () => { | ||
it('Updates username and password', () => { | ||
const user = generateNewUserDetails() | ||
const { email, username, password } = user | ||
cy.signUpNewUser(user) | ||
|
||
const newEmail = `${username}-super_cool@test.com` | ||
const newPassword = '<dfbss73DF' | ||
|
||
cy.step('Go to settings page') | ||
cy.visit('/settings') | ||
|
||
// cy.get('[data-cy="loader"]').not('visible') | ||
cy.get('[data-cy="tab-Account"]').click() | ||
|
||
cy.step('Update Email') | ||
cy.get('[data-cy="accordionContainer"]').click({ multiple: true }) | ||
cy.get('[data-cy="changeEmailContainer"]') | ||
.contains(`Current email address: ${email}`) | ||
.should('be.visible') | ||
cy.get('[data-cy="newEmail"]').clear().type(newEmail) | ||
cy.get('[data-cy="password"]').clear().type(password) | ||
cy.get('[data-cy="changeEmailSubmit"]').click() | ||
cy.get('[data-cy="changeEmailContainer"') | ||
.contains(`Email changed to ${newEmail}`) | ||
.should('be.visible') | ||
|
||
cy.step('Update Password') | ||
cy.get('[data-cy="accordionContainer"]').click({ multiple: true }) | ||
cy.get('[data-cy="oldPassword"]').clear().type(password) | ||
cy.get('[data-cy="newPassword"]').clear().type(newPassword) | ||
cy.get('[data-cy="repeatNewPassword"]').clear().type(newPassword) | ||
cy.get('[data-cy="changePasswordSubmit"]').click() | ||
cy.get('[data-cy="changePasswordContainer"') | ||
.contains(`Password changed`) | ||
.should('be.visible') | ||
}) | ||
}) | ||
}) |
108 changes: 54 additions & 54 deletions
108
packages/cypress/src/integration/questions/discussions.spec.ts
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,67 +1,67 @@ | ||
// // This is basically an identical set of steps to the discussion tests for | ||
// // how-tos and research. Any changes here should be replicated there. | ||
// This is basically an identical set of steps to the discussion tests for | ||
// how-tos and research. Any changes here should be replicated there. | ||
|
||
// import { MOCK_DATA } from '../../data' | ||
// import { generateNewUserDetails } from '../../utils/TestUtils' | ||
import { MOCK_DATA } from '../../data' | ||
import { generateNewUserDetails } from '../../utils/TestUtils' | ||
|
||
// describe('[Questions.Discussions]', () => { | ||
// it('can open using deep links', () => { | ||
// const question = MOCK_DATA.questions[0] | ||
// cy.visit(`/questions/${question.slug}`) | ||
// cy.get(`[data-cy=comment-text]`).contains('First comment') | ||
// cy.get('[data-cy=show-replies]').click() | ||
// cy.get(`[data-cy="ReplyItem"]`).contains('First Reply') | ||
// }) | ||
describe('[Questions.Discussions]', () => { | ||
it('can open using deep links', () => { | ||
const question = MOCK_DATA.questions[0] | ||
cy.visit(`/questions/${question.slug}`) | ||
cy.get(`[data-cy=comment-text]`).contains('First comment') | ||
cy.get('[data-cy=show-replies]').click() | ||
cy.get(`[data-cy="ReplyItem"]`).contains('First Reply') | ||
}) | ||
|
||
// it('allows authenticated users to contribute to discussions', () => { | ||
// const visitor = generateNewUserDetails() | ||
// const question = MOCK_DATA.questions[2] | ||
it('allows authenticated users to contribute to discussions', () => { | ||
const visitor = generateNewUserDetails() | ||
const question = MOCK_DATA.questions[2] | ||
|
||
// const newComment = `An interesting question. The answer must be... ${visitor.username}` | ||
// // const updatedNewComment = `An interesting question. The answer must be that when the sky is red, the apocalypse _might_ be on the way. Love, ${visitor.username}` | ||
// // const newReply = `Thanks Dave and Ben. What does everyone else think? - ${visitor.username}` | ||
// // const updatedNewReply = `Anyone else? Your truly ${visitor.username}` | ||
// const questionPath = `/questions/${question.slug}` | ||
const newComment = `An interesting question. The answer must be... ${visitor.username}` | ||
const updatedNewComment = `An interesting question. The answer must be that when the sky is red, the apocalypse _might_ be on the way. Love, ${visitor.username}` | ||
const newReply = `Thanks Dave and Ben. What does everyone else think? - ${visitor.username}` | ||
const updatedNewReply = `Anyone else? Your truly ${visitor.username}` | ||
const questionPath = `/questions/${question.slug}` | ||
|
||
// cy.signUpNewUser(visitor) | ||
cy.signUpNewUser(visitor) | ||
|
||
// cy.step('Can add comment') | ||
// cy.visit(questionPath) | ||
// cy.contains('Start the discussion') | ||
// cy.addComment(newComment) | ||
// cy.contains('1 Comment') | ||
cy.step('Can add comment') | ||
cy.visit(questionPath) | ||
cy.contains('Start the discussion') | ||
cy.addComment(newComment) | ||
cy.contains('1 Comment') | ||
|
||
// // cy.step('Can edit their comment') | ||
// // cy.editDiscussionItem('CommentItem', newComment, updatedNewComment) | ||
cy.step('Can edit their comment') | ||
cy.editDiscussionItem('CommentItem', newComment, updatedNewComment) | ||
|
||
// // cy.step('Another user can add reply') | ||
// // const secondCommentor = generateNewUserDetails() | ||
// // cy.logout() | ||
// // cy.signUpNewUser(secondCommentor) | ||
// // cy.visit(questionPath) | ||
// // cy.addReply(newReply) | ||
// // cy.wait(1000) | ||
// // cy.contains('2 Comments') | ||
cy.step('Another user can add reply') | ||
const secondCommentor = generateNewUserDetails() | ||
cy.logout() | ||
cy.signUpNewUser(secondCommentor) | ||
cy.visit(questionPath) | ||
cy.addReply(newReply) | ||
cy.wait(1000) | ||
cy.contains('2 Comments') | ||
|
||
// // cy.step('Can edit their reply') | ||
// // cy.editDiscussionItem('ReplyItem', newReply, updatedNewReply) | ||
// // cy.step('Another user can leave a reply') | ||
// // const secondReply = `Quick reply. ${visitor.username}` | ||
cy.step('Can edit their reply') | ||
cy.editDiscussionItem('ReplyItem', newReply, updatedNewReply) | ||
cy.step('Another user can leave a reply') | ||
const secondReply = `Quick reply. ${visitor.username}` | ||
|
||
// // cy.step('First commentor can respond') | ||
// // cy.logout() | ||
// // cy.signIn(visitor.email, visitor.password) | ||
// // cy.visit(questionPath) | ||
// // cy.addReply(secondReply) | ||
cy.step('First commentor can respond') | ||
cy.logout() | ||
cy.signIn(visitor.email, visitor.password) | ||
cy.visit(questionPath) | ||
cy.addReply(secondReply) | ||
|
||
// // cy.step('Can delete their comment') | ||
// // cy.deleteDiscussionItem('CommentItem', updatedNewComment) | ||
cy.step('Can delete their comment') | ||
cy.deleteDiscussionItem('CommentItem', updatedNewComment) | ||
|
||
// // cy.step('Replies still show for deleted comments') | ||
// // cy.get('[data-cy="deletedComment"]').should('be.visible') | ||
// // cy.get('[data-cy=OwnReplyItem]').contains(secondReply) | ||
cy.step('Replies still show for deleted comments') | ||
cy.get('[data-cy="deletedComment"]').should('be.visible') | ||
cy.get('[data-cy=OwnReplyItem]').contains(secondReply) | ||
|
||
// // cy.step('Can delete their reply') | ||
// // cy.deleteDiscussionItem('ReplyItem', secondReply) | ||
// }) | ||
// }) | ||
cy.step('Can delete their reply') | ||
cy.deleteDiscussionItem('ReplyItem', secondReply) | ||
}) | ||
}) |
Oops, something went wrong.