Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/components/auth/api-key-auth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class ApiKeyAuth extends React.Component {
<label>Value:</label>
{
value ? <code> ****** </code>
: <Col><Input type="text" onChange={ this.onChange }/></Col>
: <Col><Input type="text" onChange={ this.onChange } autoFocus/></Col>
}
</Row>
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/auth/basic-auth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default class BasicAuth extends React.Component {
<label>Username:</label>
{
username ? <code> { username } </code>
: <Col><Input type="text" required="required" name="username" onChange={ this.onChange }/></Col>
: <Col><Input type="text" required="required" name="username" onChange={ this.onChange } autoFocus/></Col>
}
</Row>
<Row>
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/auth/oauth2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default class Oauth2 extends React.Component {
{
isAuthorized ? <code> { this.state.username } </code>
: <Col tablet={10} desktop={10}>
<input id="oauth_username" type="text" data-name="username" onChange={ this.onInputChange }/>
<input id="oauth_username" type="text" data-name="username" onChange={ this.onInputChange } autoFocus/>
</Col>
}
</Row>
Expand Down
13 changes: 12 additions & 1 deletion test/e2e-cypress/tests/features/oauth2-flows/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ describe("OAuth2 Application flow", function() {
}).as("tokenRequest")
})

// https://github.com/swagger-api/swagger-ui/issues/6395
it("should have first authorization input autofocused", () => {
cy
.visit("/?url=http://localhost:3231/swagger.yaml")
.get(".btn.authorize")
.click()

cy.focused()
.should("have.id", "oauth_username")
})

it("should make an application flow Authorization header request", () => {
cy
.visit("/?url=http://localhost:3231/swagger.yaml")
Expand Down Expand Up @@ -52,4 +63,4 @@ describe("OAuth2 Application flow", function() {
.get(".live-responses-table .response-col_status")
.contains("200")
})
})
})