Skip to content

Commit 18616df

Browse files
Add cypress upload test for subgenre (#3833)
Co-authored-by: amendelsohn <[email protected]>
1 parent 8a76f7c commit 18616df

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

packages/probers/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ To run a against staging
2424

2525
```
2626
npm run cypress:run-stage
27+
npm run cypress:open-stage
2728
```
2829

2930
**IMPORTANT: Probers by default will make accounts. Don't do this against prod.**

packages/probers/cypress/e2e/uploadTrack.cy.ts

+71
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,77 @@ describe('Upload Track', () => {
7070

7171
cy.findByRole('button', { name: /view track page/i }).click()
7272

73+
cy.findByRole('heading', { name: /track/i, level: 1 }).should('exist')
74+
})
75+
it.only('should upload a track with a subgenre', () => {
76+
const base64Entropy = Buffer.from(user.entropy).toString('base64')
77+
cy.visit(`trending?login=${base64Entropy}`)
78+
cy.findByText(user.name, { timeout: 20000 }).should('exist')
79+
80+
cy.findByRole('button', { name: /upload track/i }).click()
81+
82+
cy.findByRole('heading', { name: /upload tracks/i, level: 1 }).should(
83+
'exist'
84+
)
85+
86+
cy.findByTestId('upload-dropzone').attachFile('track.mp3', {
87+
subjectType: 'drag-n-drop'
88+
})
89+
90+
cy.findByRole('button', { name: /continue/i }).click()
91+
92+
cy.findByRole('combobox', { name: /pick a genre/i }).click()
93+
cy.get('.rc-virtual-list-holder').scrollTo('bottom', {
94+
ensureScrollable: false
95+
})
96+
cy.findByRole('option', { name: /electronic - dubstep/i }).click()
97+
98+
// Add track artwork
99+
cy.findByRole('button', { name: /change artwork/i }).click()
100+
101+
cy.findByTestId('upload-dropzone').attachFile('track-artwork.jpeg', {
102+
subjectType: 'drag-n-drop'
103+
})
104+
105+
cy.findByRole('button', { name: /close popup/ })
106+
107+
cy.findByRole('button', { name: /continue/i }).click()
108+
109+
cy.findByRole('main').within(() => {
110+
cy.findByRole('progressbar').should('have.attr', 'aria-valuenow', '0')
111+
112+
cy.waitUntil(() => {
113+
return cy.findByRole('progressbar').then((progressbar) => {
114+
return Number(progressbar.attr('aria-valuenow')) > 0
115+
})
116+
})
117+
118+
cy.waitUntil(() => {
119+
return cy.findByRole('progressbar').then((progressbar) => {
120+
return Number(progressbar.attr('aria-valuenow')) > 50
121+
})
122+
})
123+
124+
cy.waitUntil(
125+
() => {
126+
return cy.findByRole('progressbar').then((progressbar) => {
127+
return Number(progressbar.attr('aria-valuenow')) === 100
128+
})
129+
},
130+
{ timeout: 10000 }
131+
)
132+
})
133+
134+
cy.findByText(/processing.../i).should('exist')
135+
136+
cy.findByRole('heading', {
137+
name: /upload complete/i,
138+
level: 1,
139+
timeout: 40000
140+
}).should('exist')
141+
142+
cy.findByRole('button', { name: /view track page/i }).click()
143+
73144
cy.findByRole('heading', { name: /track/i, level: 1 }).should('exist')
74145
})
75146
})

0 commit comments

Comments
 (0)