-
Notifications
You must be signed in to change notification settings - Fork 342
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
Article-flow #298
base: main
Are you sure you want to change the base?
Article-flow #298
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,13 +1,55 @@ | ||
describe('', () => { | ||
before(() => { | ||
const { faker } = require('@faker-js/faker'); | ||
|
||
/// <reference types='cypress' /> | ||
|
||
const { articleData } = require('../support/articleData.cy'); | ||
|
||
describe('Article-flow', () => { | ||
let user; | ||
const article = articleData(); | ||
|
||
beforeEach(() => { | ||
const generatedUser = { | ||
email: faker.internet.email(), | ||
username: faker.internet.userName(), | ||
password: '12345Qwert!' | ||
}; | ||
user = generatedUser; | ||
|
||
cy.login(user.email, user.username, user.password); | ||
cy.visit(''); | ||
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 |
||
}); | ||
|
||
it('', () => { | ||
it('Should create an article with all filled fields', () => { | ||
cy.contains('.nav-link', 'New Article').click(); | ||
|
||
cy.get('[placeholder="Article Title"]').type(article.title); | ||
cy.get('[placeholder="What\'s this article about?"]') | ||
.type(article.description); | ||
cy.get('[placeholder="Write your article (in markdown)"]') | ||
.type(article.body); | ||
cy.get('[placeholder="Enter tags"]').type(`${article.tags}{enter}`); | ||
|
||
cy.contains('.btn', 'Publish Article').click(); | ||
|
||
cy.url().should('contain', 'article/'); | ||
}); | ||
|
||
it('', () => { | ||
it('Should be able to delete article', () => { | ||
cy.contains('.nav-link', 'New Article').click(); | ||
|
||
cy.get('[placeholder="Article Title"]').type(article.title); | ||
cy.get('[placeholder="What\'s this article about?"]') | ||
.type(article.description); | ||
cy.get('[placeholder="Write your article (in markdown)"]') | ||
.type(article.body); | ||
cy.get('[placeholder="Enter tags"]').type(`${article.tags}{enter}`); | ||
|
||
cy.contains('.btn', 'Publish Article').click(); | ||
|
||
cy.url().should('contain', 'article/'); | ||
|
||
cy.contains('.btn', ' Delete Article').click(); | ||
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. There is an extra space in the selector '.btn', ' Delete Article'. Ensure that the space is intentional and matches the actual button text. Otherwise, remove the extra space. |
||
cy.url().should('not.contain', 'article'); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const { faker } = require('@faker-js/faker'); | ||
|
||
export const articleData = () => { | ||
return { | ||
title: faker.word.words(2), | ||
description: faker.word.words(4), | ||
body: faker.word.words(8), | ||
tags: faker.word.words(1) | ||
}; | ||
}; |
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.login
command assumes that a custom Cypress command for logging in has been defined. Ensure that this command is correctly implemented in your Cypress support files.