Skip to content
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 #301

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions cypress/e2e/article.cy.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
describe('', () => {
before(() => {
/// <reference types='cypress' />
import { generateArticle } from '../support/generateArticle';

describe('Article flow', () => {
const user = {
email: '[email protected]',
password: 'Password10@'
};

const { title, description, body, tag } = generateArticle();

const articlePayload = {
title,
description,
body,
taglist: [
tag
]
};

beforeEach(() => {
cy.login(user);
cy.visit('');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cy.visit(''); command is visiting an empty URL, which might not be the intended behavior. Ensure that the correct URL or path is provided to navigate to the desired page.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cy.visit(''); command is visiting an empty URL. Ensure that the correct URL or path is provided to visit the intended page.

});

it('', () => {
it('should create the article', () => {
cy.contains('.nav-link', 'New Article').click();

cy.get('[placeholder="Article Title"]').type(title);
cy.get('[placeholder="What\'s this article about?"]')
.type(description);
cy.get('[placeholder="Write your article (in markdown)"]')
.type(body);
cy.get('[placeholder="Enter tags"]').type(`${tag}{enter}`);

cy.contains('.btn', 'Publish Article').click();

cy.url().should('contain', 'article/');
});

it('', () => {
it('should delete the article', () => {
cy.createArticle(user, articlePayload);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cy.createArticle(user, articlePayload); command suggests a custom command is being used. Ensure that this custom command is correctly defined in your Cypress support files and that it behaves as expected.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cy.createArticle(user, articlePayload); command assumes that a custom command createArticle exists. Ensure that this command is defined in your Cypress commands file, or replace it with the appropriate steps to create an article.


cy.contains('.btn', 'Delete Article').click();

cy.contains('.article-preview', 'No articles are here... yet.')
.should('be.visible');
});
});