Merge branch 'master' of https://github.com/plumrx/vue3-realworld-example-app into plumrx-master
This commit is contained in:
commit
89ff285b20
File diff suppressed because one or more lines are too long
|
|
@ -1,40 +0,0 @@
|
|||
describe('View the homepage by guest', () => {
|
||||
beforeEach(() => {
|
||||
cy.server()
|
||||
cy.route2('GET', /articles/, { fixture: 'articles.json' }).as('getArticles')
|
||||
cy.route2('GET', /tags/, { fixture: 'tags.json' }).as('getTags')
|
||||
|
||||
cy.visit('/')
|
||||
})
|
||||
|
||||
it('should can access home page', () => {
|
||||
cy.get('h1.logo-font')
|
||||
.should('contain.text', 'conduit')
|
||||
})
|
||||
|
||||
it('should highlight Global Feed when home page loaded', () => {
|
||||
cy.get('.feed-toggle > .nav')
|
||||
.contains('Global Feed')
|
||||
.should('have.class', 'active')
|
||||
})
|
||||
|
||||
it('should display article when page loaded', () => {
|
||||
cy.wait('@getArticles')
|
||||
|
||||
cy.get('.article-preview:first')
|
||||
.find('h1')
|
||||
.should('contain.text', 'abc123')
|
||||
})
|
||||
|
||||
it('it should display correct tags when page loaded', () => {
|
||||
cy.wait('@getTags')
|
||||
|
||||
cy.get('div.tag-list')
|
||||
.find('a.tag-pill.tag-default')
|
||||
.should('have.length', 8)
|
||||
|
||||
cy.get('div.tag-list')
|
||||
.find('a.tag-pill.tag-default:nth-child(3)')
|
||||
.should('contain.text', 'HITLER')
|
||||
})
|
||||
})
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
describe('View the homepage by guest', () => {
|
||||
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', /tags/, { fixture: 'tags.json' }).as('getTags')
|
||||
|
||||
cy.visit('/')
|
||||
})
|
||||
|
||||
it('should can access home page', () => {
|
||||
cy.get('h1.logo-font')
|
||||
.should('contain.text', 'conduit')
|
||||
})
|
||||
|
||||
it('should highlight Global Feed when home page loaded', () => {
|
||||
cy.get('.feed-toggle > .nav')
|
||||
.contains('Global Feed')
|
||||
.should('have.class', 'active')
|
||||
})
|
||||
|
||||
it('should display article when page loaded', () => {
|
||||
cy.wait('@getArticles')
|
||||
|
||||
cy.get('.article-preview:first')
|
||||
.find('h1')
|
||||
.should('contain.text', 'abc123')
|
||||
})
|
||||
|
||||
it('should read more information of the first articles', () => {
|
||||
cy.get('div.article-preview:first span')
|
||||
.contains('Read more...')
|
||||
.click()
|
||||
|
||||
cy.get('.article-page')
|
||||
.contains(' to add comments on this article. ')
|
||||
})
|
||||
|
||||
it('should highlight Home nav-item when page load', () => {
|
||||
cy.get('ul.nav.navbar-nav.pull-xs-right a.nav-link')
|
||||
.contains('Home')
|
||||
.should('have.class', 'active')
|
||||
})
|
||||
|
||||
it.only('turn up the page', () => {
|
||||
cy.wait('@getArticles')
|
||||
cy.get('ul.pagination li.page-item:nth-child(2) a.page-link')
|
||||
.click()
|
||||
|
||||
cy.wait('@getArticles')
|
||||
.then(console.log)
|
||||
.its('request.url')
|
||||
.should('contain', 'limit=10&offset=10')
|
||||
})
|
||||
|
||||
// it('',()=>{
|
||||
|
||||
// })
|
||||
})
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
describe('View the homepage by guest', () => {
|
||||
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', /tags/, { fixture: 'tags.json' }).as('getTags')
|
||||
|
||||
cy.visit('/')
|
||||
})
|
||||
|
||||
it('it should display correct tags when page loaded', () => {
|
||||
cy.wait('@getTags')
|
||||
|
||||
cy.get('div.tag-list')
|
||||
.find('a.tag-pill.tag-default')
|
||||
.should('have.length', 8)
|
||||
|
||||
cy.get('div.tag-list')
|
||||
.find('a.tag-pill.tag-default:nth-child(3)')
|
||||
.should('contain.text', 'HITLER')
|
||||
})
|
||||
|
||||
it('should show right articles of tag', () => {
|
||||
// 点击最后一个tag
|
||||
cy.get('a.tag-pill.tag-default:last')
|
||||
.click()
|
||||
|
||||
cy.get('a.tag-pill.tag-default:last')
|
||||
.should('have.class', 'router-link-active')
|
||||
.should('have.class', 'router-link-exact-active')
|
||||
|
||||
cy.get('a.tag-pill.tag-default:last').invoke('text').then(tag => {
|
||||
const path = `#/tag/${tag}`
|
||||
|
||||
// check URL
|
||||
cy.url()
|
||||
.should('include', path)
|
||||
|
||||
// check sheet
|
||||
cy.get('a.active.router-link-exact-active.nav-link')
|
||||
.should('contain', tag)
|
||||
})
|
||||
})
|
||||
|
||||
it.only('check articles tag including butt', () => {
|
||||
// 点击最后一个tag
|
||||
cy.get('a.tag-pill.tag-default:last')
|
||||
.click()
|
||||
|
||||
// 文章标签元素
|
||||
cy.get('.article-preview ul.tag-list')
|
||||
.should('have.length', 9)
|
||||
})
|
||||
|
||||
// it('',()=>{
|
||||
|
||||
// })
|
||||
|
||||
// it('',()=>{
|
||||
|
||||
// })
|
||||
})
|
||||
Loading…
Reference in New Issue