Merge branch 'master' into testing-library

This commit is contained in:
mutoe 2021-02-27 00:37:33 +08:00
commit 50fbd604d8
9 changed files with 24 additions and 46 deletions

View File

@ -1,9 +1,8 @@
describe('View the homepage', () => {
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.intercept('GET', /articles\?tag=butt/, { fixture: 'article_of_tag' }).as('article_of_tag')
cy.intercept('GET', /articles/, { fixture: 'articles.json' }).as('getArticles')
cy.intercept('GET', /tags/, { fixture: 'tags.json' }).as('getTags')
cy.visit('/')
})

View File

@ -1,10 +1,9 @@
describe('test for like-follow', () => {
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.intercept('GET', /articles\?tag=butt/, { fixture: 'article_of_tag' }).as('article_of_tag')
cy.intercept('GET', /articles\?/, { fixture: 'articles.json' }).as('getArticles')
cy.intercept('GET', /articles\//, { fixture: 'article.json' }).as('getArticle')
cy.intercept('GET', /tags/, { fixture: 'tags.json' }).as('getTags')
cy.visit('/')
})
@ -17,7 +16,7 @@ describe('test for like-follow', () => {
.should('contain', 'login')
cy.get('h1.text-xs-center')
.should('contain.text', ' Sign in ')
.should('contain.text', 'Sign in')
})
it('login:like articles', () => {

View File

@ -1,10 +1,9 @@
describe('test for login', () => {
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.intercept('GET', /articles\?tag=butt/, { fixture: 'article_of_tag' }).as('article_of_tag')
cy.intercept('GET', /articles\?/, { fixture: 'articles.json' }).as('getArticles')
cy.intercept('GET', /articles\//, { fixture: 'article.json' }).as('getArticle')
cy.intercept('GET', /tags/, { fixture: 'tags.json' }).as('getTags')
cy.visit('/')
})

View File

@ -1,11 +1,10 @@
describe('test for register', () => {
beforeEach(() => {
cy.server()
cy.route2('POST', /users/, { fixture: 'register.json' }).as('register')
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.intercept('POST', /users/, { fixture: 'register.json' }).as('register')
cy.intercept('GET', /articles\?tag=butt/, { fixture: 'article_of_tag' }).as('article_of_tag')
cy.intercept('GET', /articles\?/, { fixture: 'articles.json' }).as('getArticles')
cy.intercept('GET', /articles\//, { fixture: 'article.json' }).as('getArticle')
cy.intercept('GET', /tags/, { fixture: 'tags.json' }).as('getTags')
cy.visit('/')
})

View File

@ -1,9 +1,8 @@
describe('test for tag', () => {
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.intercept('GET', /articles\?tag=butt/, { fixture: 'article_of_tag' }).as('article_of_tag')
cy.intercept('GET', /articles/, { fixture: 'articles.json' }).as('getArticles')
cy.intercept('GET', /tags/, { fixture: 'tags.json' }).as('getTags')
cy.visit('/')
})

View File

@ -5,7 +5,7 @@ import { router } from '../router'
describe('# AppFooter', () => {
beforeEach(async () => {
await router.push({ name: 'global-feed' })
await router.push('/')
})
it('should render correctly', () => {

View File

@ -4,7 +4,7 @@ import { router } from '../router'
describe('# AppLink', () => {
beforeEach(async () => {
await router.push({ name: 'global-feed' })
await router.push('/')
})
it('should redirect to another page when click the link', async () => {
@ -15,7 +15,7 @@ describe('# AppLink', () => {
slots: { default: 'Go to Foo tag' },
})
expect(container).toHaveTextContent('Go to Foo')
expect(container).toHaveTextContent('Go to Foo tag')
// when
const linkElement = getByRole('link', { name: 'tag' })

View File

@ -1,17 +0,0 @@
import { createRouter, createWebHistory } from 'vue-router'
export const routerForTests = createRouter({
history: createWebHistory(),
routes: [
{
path: '/',
name: 'home',
component: { template: 'Home page' },
},
{
path: '/foo',
name: 'foo',
component: { template: 'Foo page' },
},
],
})

View File

@ -983,7 +983,7 @@
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.0.6.tgz#d65576430fc4ad383dc7c829118798e5169178d4"
integrity sha512-c37C60HpelUZIx+SNZVEINSxkFzQYhIXFg5AynnIA4QDBmY4iSPoACfGSwSUTCTKImukPeCgY2oqRJVP3R1Mnw==
"@vue/test-utils@^2.0.0-rc.0", "@vue/test-utils@^2.0.0-rc.1":
"@vue/test-utils@^2.0.0-rc.0":
version "2.0.0-rc.1"
resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-2.0.0-rc.1.tgz#cc462997b50dc07d73dee151da0cbb1c39a40a5a"
integrity sha512-WWzSbHtszmSyC1KQ3Ak6lSs9FVcdyMekZFe/g0Fdcpi3TNxUj5mEfj98sn4/ySiC4gDh53bXgveqxXKK4RspDg==