test: add testcases for like\follow\logout
This commit is contained in:
parent
71a030834e
commit
23369beec1
|
|
@ -9,7 +9,7 @@ describe('test for like-follow', () => {
|
|||
cy.visit('/')
|
||||
})
|
||||
|
||||
it('no-login:like artiles', () => {
|
||||
it('no-login:like articles', () => {
|
||||
cy.get('i.ion-heart:first')
|
||||
.click()
|
||||
|
||||
|
|
@ -20,6 +20,19 @@ describe('test for like-follow', () => {
|
|||
.should('contain.text', ' Sign in ')
|
||||
})
|
||||
|
||||
it('login:like articles', () => {
|
||||
// login
|
||||
cy.fixture('users.json').then(users => {
|
||||
cy.login(users.loginPass)
|
||||
})
|
||||
|
||||
// like articles
|
||||
cy.get('i.ion-heart:first')
|
||||
.click()
|
||||
cy.get('.article-meta:first button')
|
||||
.should('have.class', 'btn-primary')
|
||||
})
|
||||
|
||||
it('no-login:follow author', () => {
|
||||
cy.get('.article-preview:first')
|
||||
.click()
|
||||
|
|
@ -39,4 +52,23 @@ describe('test for like-follow', () => {
|
|||
cy.url()
|
||||
.should('contain', 'login')
|
||||
})
|
||||
|
||||
it('login: follow author', () => {
|
||||
// login
|
||||
cy.fixture('users.json').then(users => {
|
||||
cy.login(users.loginPass)
|
||||
})
|
||||
|
||||
// click article
|
||||
cy.get('a.preview-link:first span')
|
||||
.contains('Read more...')
|
||||
.click()
|
||||
// follow author
|
||||
cy.get('.article-meta button.btn-outline-secondary')
|
||||
.should('contain', 'Follow')
|
||||
cy.get('.article-meta button.btn-outline-secondary:first')
|
||||
.click()
|
||||
cy.get('.article-actions button.btn-outline-secondary:last')
|
||||
.should('contain', 'Unfollow')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,9 +9,20 @@ describe('test for login', () => {
|
|||
cy.visit('/')
|
||||
})
|
||||
|
||||
it('login in home page', () => {
|
||||
it('login and logout in home page', () => {
|
||||
// login
|
||||
cy.fixture('users.json').then(users => {
|
||||
cy.login(users.loginPass)
|
||||
})
|
||||
|
||||
// logout
|
||||
cy.get('[href="#/settings"]')
|
||||
.click()
|
||||
cy.get('button.btn-outline-danger')
|
||||
.contains('logout')
|
||||
.click()
|
||||
cy.get('ul.navbar-nav')
|
||||
.should('contain', ' Sign in')
|
||||
.should('contain', ' Sign up')
|
||||
})
|
||||
})
|
||||
Loading…
Reference in New Issue