From ff11ee49c6f05246b7938f8692324953b27e52f7 Mon Sep 17 00:00:00 2001 From: Phan An Date: Mon, 4 Jan 2021 23:37:19 +0100 Subject: [PATCH] chore(test): eliminate the use of variable in queue.spec --- cypress/integration/queuing.spec.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/cypress/integration/queuing.spec.ts b/cypress/integration/queuing.spec.ts index 7b4761e0..537f99c2 100644 --- a/cypress/integration/queuing.spec.ts +++ b/cypress/integration/queuing.spec.ts @@ -74,21 +74,15 @@ context('Queuing', { scrollBehavior: false }, () => { cy.$shuffleSeveralSongs() cy.$clickSidebarItem('All Songs') - let songTitle - cy.get('#songsWrapper').within(() => { - cy.get('tr.song-item:nth-child(4) .title') - .invoke('text') - .then(text => { - songTitle = text - }) - + cy.get('#songsWrapper').within(function () { + cy.get('tr.song-item:nth-child(4) .title').invoke('text').as('title') cy.get('tr.song-item:nth-child(4)').dblclick() }) cy.$clickSidebarItem('Current Queue') - cy.get('#queueWrapper').within(() => { + cy.get('#queueWrapper').within(function () { cy.get('tr.song-item').should('have.length', 4) - cy.get(`tr.song-item:nth-child(2) .title`).should('have.text', songTitle) + cy.get(`tr.song-item:nth-child(2) .title`).should('have.text', this.title) cy.get('tr.song-item:nth-child(2)').should('have.class', 'playing') })