From e1fad8d0d72e12f7aa980970c519abe3c2be45b8 Mon Sep 17 00:00:00 2001 From: Link Date: Fri, 25 Dec 2020 15:19:31 +0800 Subject: [PATCH] test: try. The local test is passed, what is the problem with the online test --- .github/workflows/deploy.yml | 2 +- tests/e2e/integration/news.spec.js | 54 +++++++++++++++--------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 493fdf30..931f98c6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -101,7 +101,7 @@ jobs: if: always() with: name: test-results - path: tests/e2e + path: tests build: diff --git a/tests/e2e/integration/news.spec.js b/tests/e2e/integration/news.spec.js index ac5410f2..0b1c245b 100644 --- a/tests/e2e/integration/news.spec.js +++ b/tests/e2e/integration/news.spec.js @@ -58,33 +58,6 @@ context('News Music Basic', () => { cy.contains('.active-tag', '华语') }) - it('Double click to play the song', () => { - cy.visit('/music/toplist') - - // https://github.com/cypress-io/cypress/issues/14269 - // Found it is a cache problem - // Solution: Use a timestamp to ensure that the URL cannot hit the browser cache - cy.intercept(/\/api\/song\/url/).as('getUrl') - cy.intercept(/\/api\/song\/detail/).as('getDetail') - cy.intercept(/\/api\/lyric/).as('getLyric') - cy.get( - '.toplist-expansion-contanier:first-child .none-select:first-child' - ).dblclick() - - cy.wait(['@getUrl', '@getDetail', '@getLyric'], { - requestTimeout: 20 * 1000 - }).then(() => { - cy.get('source') - .invoke('attr', 'src') - .then(src => { - expect(src).to.have.string('.mp3') - }) - - // pause music - cy.get('.music-command-group button:nth-child(3)').click() - }) - }) - it('Singer filter', () => { cy.visit('/music/artists') cy.get('.artists-content ul') @@ -114,4 +87,31 @@ context('News Music Basic', () => { cy.contains('.secondary-bar-link-active', '专辑') }) + + it('Double click to play the song', () => { + cy.visit('/music/toplist') + + // https://github.com/cypress-io/cypress/issues/14269 + // Found it is a cache problem + // Solution: Use a timestamp to ensure that the URL cannot hit the browser cache + cy.intercept(/\/api\/song\/url/).as('getUrl') + cy.intercept(/\/api\/song\/detail/).as('getDetail') + cy.intercept(/\/api\/lyric/).as('getLyric') + cy.get( + '.toplist-expansion-contanier:first-child .none-select:first-child' + ).dblclick() + + cy.wait(['@getUrl', '@getDetail', '@getLyric'], { + requestTimeout: 20 * 1000 + }).then(() => { + cy.get('source') + .invoke('attr', 'src') + .then(src => { + expect(src).to.have.string('.mp3') + }) + + // pause music + cy.get('.music-command-group button:nth-child(3)').click() + }) + }) })