feat(oas31): display file upload input when contentMediaType or contentEncoding is present (#10412)

Refs #9278
This commit is contained in:
Oliwia Rogala
2025-04-11 15:38:35 +02:00
committed by GitHub
parent c29e7126c9
commit 26967308e9
3 changed files with 146 additions and 1 deletions

View File

@@ -199,6 +199,50 @@ describe("OpenAPI 3.1 Request Body upload file button", () => {
})
})
describe("schema contentMediaType is a non-empty string", () => {
beforeEach(() => {
cy.get("#operations-default-uploadSchemaContentMediaType").click()
})
it("should display description with the correct content type", () => {
cy.get(
".opblock-section-request-body .opblock-description-wrapper i"
).should(
"have.text",
"Example values are not available for application/x-custom media types."
)
})
it("should display a file upload button", () => {
cy.get(".try-out__btn").click()
cy.get(
".opblock-section-request-body .opblock-description-wrapper input"
).should("have.prop", "type", "file")
})
})
describe("schema contentEncoding is a non-empty string", () => {
beforeEach(() => {
cy.get("#operations-default-uploadSchemaContentEncoding").click()
})
it("should display description with the correct content type", () => {
cy.get(
".opblock-section-request-body .opblock-description-wrapper i"
).should(
"have.text",
"Example values are not available for application/x-custom media types."
)
})
it("should display a file upload button", () => {
cy.get(".try-out__btn").click()
cy.get(
".opblock-section-request-body .opblock-description-wrapper input"
).should("have.prop", "type", "file")
})
})
describe("multipart/form-data object property with schema type string and format binary", () => {
beforeEach(() => {
cy.get("#operations-default-uploadPropertySchemaFormatBinary").click()
@@ -254,4 +298,30 @@ describe("OpenAPI 3.1 Request Body upload file button", () => {
).should("have.prop", "type", "file")
})
})
describe("multipart/form-data object property schema has contentMediaType with non-empty string", () => {
beforeEach(() => {
cy.get("#operations-default-uploadPropertySchemaContentMediaType").click()
})
it("should display a file upload button", () => {
cy.get(".try-out__btn").click()
cy.get(
".opblock-section-request-body .opblock-description-wrapper input"
).should("have.prop", "type", "file")
})
})
describe("multipart/form-data object property schema has contentEncoding with non-empty string", () => {
beforeEach(() => {
cy.get("#operations-default-uploadPropertySchemaContentEncoding").click()
})
it("should display a file upload button", () => {
cy.get(".try-out__btn").click()
cy.get(
".opblock-section-request-body .opblock-description-wrapper input"
).should("have.prop", "type", "file")
})
})
})