Implement creator studio and upload updates

This commit is contained in:
2026-04-04 10:12:02 +02:00
parent 1da7d3bf88
commit 0b216b7ecd
15107 changed files with 31206 additions and 626514 deletions

View File

@@ -68,6 +68,15 @@ function installAxiosStubs({ statusValue = 'ready', initError = null, holdChunk
},
})
}
if (url === '/api/tags/popular' || String(url).startsWith('/api/tags/search')) {
return Promise.resolve({
data: {
data: [],
},
})
}
return Promise.reject(new Error(`Unhandled GET ${url}`))
}),
}
@@ -112,6 +121,20 @@ async function completeStep1ToReady() {
})
}
async function completeRequiredDetails({ title = 'My Art', mature = false } = {}) {
await act(async () => {
await userEvent.type(screen.getByRole('textbox', { name: /title/i }), title)
await userEvent.click(screen.getByRole('button', { name: /art .* open/i }))
await userEvent.click(await screen.findByRole('button', { name: /root .* choose/i }))
await userEvent.click(await screen.findByRole('button', { name: /sub .* choose/i }))
await userEvent.type(screen.getByLabelText(/search or add tags/i), 'fantasy{enter}')
if (mature) {
await userEvent.click(screen.getByLabelText(/mark this artwork as mature content/i))
}
await userEvent.click(screen.getByLabelText(/i confirm i own the rights to this content/i))
})
}
describe('UploadWizard step flow', () => {
let originalImage
let originalScrollTo
@@ -216,6 +239,43 @@ describe('UploadWizard step flow', () => {
})
})
it('uses the selected archive screenshot as the preview upload source', async () => {
installAxiosStubs({ statusValue: 'ready' })
await renderWizard({ initialDraftId: 312 })
await uploadPrimary(new File(['zip'], 'bundle.zip', { type: 'application/zip' }))
await uploadScreenshot(new File(['shot-1'], 'shot-1.png', { type: 'image/png' }))
await uploadScreenshot(new File(['shot-2'], 'shot-2.png', { type: 'image/png' }))
await act(async () => {
await userEvent.click(screen.getByRole('button', { name: /use shot-2\.png as default screenshot/i }))
})
await waitFor(() => {
expect(screen.getAllByText('Default').length).toBeGreaterThan(0)
})
await act(async () => {
await userEvent.click(await screen.findByRole('button', { name: /start upload/i }))
})
await waitFor(() => {
expect(window.axios.post).toHaveBeenCalledWith(
'/api/uploads/finish',
expect.objectContaining({
file_name: 'shot-2.png',
archive_file_name: 'bundle.zip',
additional_screenshot_sessions: [
expect.objectContaining({
file_name: 'shot-1.png',
}),
],
}),
expect.anything(),
)
})
})
it('allows navigation back to completed previous step', async () => {
installAxiosStubs({ statusValue: 'ready' })
await renderWizard({ initialDraftId: 304 })
@@ -227,7 +287,7 @@ describe('UploadWizard step flow', () => {
await act(async () => {
await userEvent.click(within(stepper).getByRole('button', { name: /upload/i }))
})
expect(await screen.findByText(/upload your artwork file/i)).not.toBeNull()
expect(await screen.findByRole('heading', { level: 2, name: /upload your artwork/i })).not.toBeNull()
})
it('triggers scroll-to-top behavior on step change', async () => {
@@ -253,11 +313,9 @@ describe('UploadWizard step flow', () => {
expect(screen.queryByRole('button', { name: /^publish$/i })).toBeNull()
await completeRequiredDetails({ title: 'My Art' })
await act(async () => {
await userEvent.type(screen.getByRole('textbox', { name: /title/i }), 'My Art')
await userEvent.selectOptions(screen.getByRole('combobox', { name: /root category/i }), '10')
await userEvent.selectOptions(screen.getByRole('combobox', { name: /subcategory/i }), '11')
await userEvent.click(screen.getByLabelText(/i confirm i own the rights to this content/i))
await userEvent.click(screen.getByRole('button', { name: /continue to publish/i }))
})
@@ -284,14 +342,10 @@ describe('UploadWizard step flow', () => {
await completeStep1ToReady()
await screen.findByText(/artwork details/i)
const titleInput = screen.getByPlaceholderText(/give your artwork a clear title/i)
await completeRequiredDetails({ title: 'Mature Piece', mature: true })
await act(async () => {
await userEvent.type(titleInput, 'Mature Piece')
await userEvent.selectOptions(screen.getByRole('combobox', { name: /root category/i }), '10')
await userEvent.selectOptions(screen.getByRole('combobox', { name: /subcategory/i }), '11')
await userEvent.click(screen.getByLabelText(/mark this artwork as mature content/i))
await userEvent.click(screen.getByLabelText(/i confirm i own the rights to this content/i))
await userEvent.click(screen.getByRole('button', { name: /continue to publish/i }))
})
@@ -361,7 +415,7 @@ describe('UploadWizard step flow', () => {
const dropzoneButton = screen.getByTestId('upload-dropzone')
expect(dropzoneButton.getAttribute('aria-disabled')).toBe('true')
})
expect(screen.getByText(/file is locked after upload\. reset to change\./i)).not.toBeNull()
expect(screen.getByText(/file is locked after upload starts\. reset to change the file\./i)).not.toBeNull()
await act(async () => {
await userEvent.click(screen.getByRole('button', { name: /reset upload/i }))