Save workspace changes

This commit is contained in:
2026-04-18 17:02:56 +02:00
parent f02ea9a711
commit 87d60af5a9
4220 changed files with 1388603 additions and 1554 deletions

View File

@@ -121,20 +121,32 @@ async function completeStep1ToReady() {
})
}
async function completeRequiredDetails({ title = 'My Art', mature = false } = {}) {
async function completeRequiredDetails({ title = 'My Art' } = {}) {
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))
})
}
function queryPrimaryPublishButton() {
return screen
.queryAllByRole('button', { name: /^publish now$/i })
.find((button) => !button.hasAttribute('aria-pressed')) || null
}
function getPrimaryPublishButton() {
const button = queryPrimaryPublishButton()
if (!button) {
throw new Error('Primary publish action button not found')
}
return button
}
describe('UploadWizard step flow', () => {
let originalImage
let originalScrollTo
@@ -311,7 +323,7 @@ describe('UploadWizard step flow', () => {
await completeStep1ToReady()
expect(await screen.findByText(/artwork details/i)).not.toBeNull()
expect(screen.queryByRole('button', { name: /^publish$/i })).toBeNull()
expect(queryPrimaryPublishButton()?.disabled).toBe(true)
await completeRequiredDetails({ title: 'My Art' })
@@ -320,12 +332,12 @@ describe('UploadWizard step flow', () => {
})
await waitFor(() => {
const publish = screen.getByRole('button', { name: /^publish$/i })
const publish = getPrimaryPublishButton()
expect(publish.disabled).toBe(false)
})
await act(async () => {
await userEvent.click(screen.getByRole('button', { name: /^publish$/i }))
await userEvent.click(getPrimaryPublishButton())
})
await waitFor(() => {
@@ -335,7 +347,7 @@ describe('UploadWizard step flow', () => {
expect(window.axios.post).not.toHaveBeenCalledWith('/api/uploads/session-1/publish', expect.anything(), expect.anything())
})
it('includes the mature flag in the final publish payload when selected', async () => {
it('hides the mature content checkbox in the details step', async () => {
installAxiosStubs({ statusValue: 'ready' })
await renderWizard({ initialDraftId: 311, contentTypes: [{ id: 1, name: 'Art', categories: [{ id: 10, name: 'Root', children: [{ id: 11, name: 'Sub' }] }] }] })
@@ -343,28 +355,7 @@ describe('UploadWizard step flow', () => {
await screen.findByText(/artwork details/i)
await completeRequiredDetails({ title: 'Mature Piece', mature: true })
await act(async () => {
await userEvent.click(screen.getByRole('button', { name: /continue to publish/i }))
})
await waitFor(() => {
const publish = screen.getByRole('button', { name: /^publish$/i })
expect(publish.disabled).toBe(false)
})
await act(async () => {
await userEvent.click(screen.getByRole('button', { name: /^publish$/i }))
})
await waitFor(() => {
expect(window.axios.post).toHaveBeenCalledWith(
'/api/uploads/311/publish',
expect.objectContaining({ is_mature: true }),
expect.anything(),
)
})
expect(screen.queryByLabelText(/mark this artwork as mature content/i)).toBeNull()
})
it('includes contributor credit metadata in the final publish payload', async () => {
@@ -399,12 +390,12 @@ describe('UploadWizard step flow', () => {
})
await waitFor(() => {
const publish = screen.getByRole('button', { name: /^publish$/i })
const publish = getPrimaryPublishButton()
expect(publish.disabled).toBe(false)
})
await act(async () => {
await userEvent.click(screen.getByRole('button', { name: /^publish$/i }))
await userEvent.click(getPrimaryPublishButton())
})
await waitFor(() => {
@@ -444,17 +435,49 @@ describe('UploadWizard step flow', () => {
await screen.findByText(/artwork details/i)
const publishAs = screen.getByRole('combobox', { name: /publishing identity/i })
expect(screen.getByRole('option', { name: /personal profile/i })).not.toBeNull()
await act(async () => {
await userEvent.click(publishAs)
})
expect(await screen.findByRole('option', { name: /personal profile/i })).not.toBeNull()
expect(screen.getByRole('option', { name: /warp collective/i })).not.toBeNull()
await act(async () => {
await userEvent.selectOptions(publishAs, 'warp-collective')
await userEvent.click(screen.getByRole('option', { name: /warp collective/i }))
})
expect(await screen.findByRole('combobox', { name: /primary author/i })).not.toBeNull()
expect(screen.getByText(/contributors/i)).not.toBeNull()
})
it('shows studio manager and editor links after publishing', async () => {
installAxiosStubs({ statusValue: 'ready' })
await renderWizard({ initialDraftId: 315, contentTypes: [{ id: 1, name: 'Art', categories: [{ id: 10, name: 'Root', children: [{ id: 11, name: 'Sub' }] }] }] })
await completeStep1ToReady()
await screen.findByText(/artwork details/i)
await completeRequiredDetails({ title: 'Studio Linked Piece' })
await act(async () => {
await userEvent.click(screen.getByRole('button', { name: /continue to publish/i }))
})
await waitFor(() => {
expect(getPrimaryPublishButton().disabled).toBe(false)
})
await act(async () => {
await userEvent.click(getPrimaryPublishButton())
})
const studioManagerLink = await screen.findByRole('link', { name: /view in studio/i })
expect(studioManagerLink.getAttribute('href')).toBe('/studio/artworks')
const studioEditLink = screen.getByRole('link', { name: /edit artwork in studio/i })
expect(studioEditLink.getAttribute('href')).toBe('/studio/artworks/315/edit')
})
it('keeps mobile sticky action bar visible class', async () => {
installAxiosStubs()
await renderWizard({ initialDraftId: 306 })