-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add favorite test and fix aria-label (#3817)
- Loading branch information
1 parent
d64d8a2
commit f145d99
Showing
10 changed files
with
349 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
apps/audius-client/packages/probers/cypress/e2e/favoriteTrack.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import track from '../fixtures/track.json' | ||
import user from '../fixtures/user.json' | ||
|
||
import { waitForTransaction } from './uilts' | ||
|
||
describe('Favorite Track', () => { | ||
beforeEach(() => { | ||
localStorage.setItem('HAS_REQUESTED_BROWSER_PUSH_PERMISSION', 'true') | ||
}) | ||
|
||
it('should favorite and unfavorite track correctly', () => { | ||
const base64Entropy = Buffer.from(user.entropy).toString('base64') | ||
cy.visit(`${track.route}?login=${base64Entropy}`) | ||
|
||
cy.findByText(user.name, { timeout: 20000 }).should('exist') | ||
cy.findByRole('heading', { name: track.name, timeout: 20000 }).should( | ||
'exist' | ||
) | ||
|
||
cy.findByRole('group', { name: /track actions/i }).within(() => { | ||
cy.findByRole('button', { name: /favorite$/i }).click() | ||
cy.findByRole('button', { name: /favorited/i }).should('exist') | ||
}) | ||
waitForTransaction(1) | ||
cy.reload() | ||
|
||
cy.findByRole('group', { name: /track actions/i }).within(() => { | ||
cy.findByRole('button', { name: /favorited/i }).click() | ||
cy.findByRole('button', { name: /favorite$/i }).should('exist') | ||
}) | ||
|
||
waitForTransaction(2) | ||
cy.reload() | ||
|
||
cy.findByRole('group', { name: /track actions/i }).within(() => { | ||
cy.findByRole('button', { name: /favorite$/i }).should('exist') | ||
}) | ||
}) | ||
}) |
25 changes: 1 addition & 24 deletions
25
apps/audius-client/packages/probers/cypress/e2e/repostTrack.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export const waitForTransaction = (transactionNumber: number) => { | ||
cy.intercept({ method: 'POST', url: '**/relay' }).as( | ||
`relayCheck-${transactionNumber}` | ||
) | ||
cy.wait(`@relayCheck-${transactionNumber}`).then((xhr) => { | ||
const { blockHash, blockNumber } = xhr.response.body.receipt | ||
cy.intercept({ | ||
url: '**/block_confirmation*', | ||
query: { blockhash: blockHash, blocknumber: String(blockNumber) } | ||
}).as(`blockConfirmation-${blockNumber}`) | ||
|
||
waitForBlockConfirmation(`@blockConfirmation-${blockNumber}`) | ||
}) | ||
} | ||
|
||
const waitForBlockConfirmation = (routeAlias, retries = 3) => { | ||
cy.wait(routeAlias).then((xhr) => { | ||
const { block_found, block_passed } = xhr.response.body.data | ||
if (block_found && block_passed) { | ||
} else if (retries > 0) waitForBlockConfirmation(routeAlias, retries - 1) | ||
// wait for the next response | ||
else throw new Error('All requests returned non-200 response') | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/audius-client/packages/probers/cypress/fixtures/remixes.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"route": "chrisyu321/happy-buddy-987/remixes" | ||
"route": "mb430/traektoria-source-2217/remixes" | ||
} |
Oops, something went wrong.