fix: adaptive cypress 6 intercept method

This commit is contained in:
mutoe 2021-02-27 00:18:02 +08:00
parent f8e332dfa3
commit acc6abfb54
5 changed files with 20 additions and 25 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('/')
})