add testcase for like and follow

This commit is contained in:
plumrx 2020-11-01 23:31:11 +08:00
parent 89ff285b20
commit 782d571221
4 changed files with 63 additions and 2 deletions

View File

@ -0,0 +1,19 @@
{
"article": {
"title": "статья",
"slug": "-45l18w",
"body": "уцауцауц",
"createdAt": "2020-11-01T14:59:39.404Z",
"updatedAt": "2020-11-01T14:59:39.404Z",
"tagList": [],
"description": "цуцуа",
"author": {
"username": "sdfsdfsadsdfsdf",
"bio": null,
"image": "https://static.productionready.io/images/smiley-cyrus.jpg",
"following": false
},
"favorited": false,
"favoritesCount": 0
}
}

View File

@ -1,4 +1,4 @@
describe('View the homepage by guest', () => {
describe('View the homepage', () => {
beforeEach(() => {
cy.server()
cy.route2('GET', /articles\?tag=butt/, { fixture: 'article_of_tag' }).as('article_of_tag')

View File

@ -0,0 +1,42 @@
describe('test for like-follow mode', () => {
beforeEach(() => {
cy.server()
cy.route2('GET', /articles\?tag=butt/, { fixture: 'article_of_tag' }).as('article_of_tag')
cy.route2('GET', /articles\?/, { fixture: 'articles.json' }).as('getArticles')
cy.route2('GET', /articles\//, { fixture: 'article.json' }).as('getArticle')
cy.route2('GET', /tags/, { fixture: 'tags.json' }).as('getTags')
cy.visit('/')
})
it('no-login:like artiles', () => {
cy.get('i.ion-heart:first')
.click()
cy.url()
.should('contain', 'login')
cy.get('h1.text-xs-center')
.should('contain.text', ' Sign in ')
})
it.only('no-login:follow author', () => {
cy.get('.article-preview:first')
.click()
cy.url()
.should('contain', 'article')
cy.get('body')
.should('contain', ' to add comments on this article. ')
cy.get('.article-meta button.space:first')
.should('contain.text', ' Follow')
cy.get('.article-meta button.space:first')
.click()
cy.url()
.should('contain', 'login')
})
})

View File

@ -1,4 +1,4 @@
describe('View the homepage by guest', () => {
describe('test for tag mode', () => {
beforeEach(() => {
cy.server()
cy.route2('GET', /articles\?tag=butt/, { fixture: 'article_of_tag' }).as('article_of_tag')