Skip to content

Commit

Permalink
fixy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrupper committed Jan 13, 2025
1 parent b903d19 commit dbcb4cc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
22 changes: 16 additions & 6 deletions cypress/integration/repo_settings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,28 +98,38 @@ context('Repo Settings', () => {
cy.get('[data-test=repo-approval-timeout] input').as(
'repoApprovalTimeoutInput',
);
cy.get('@repoApprovalTimeoutInput').should('be.visible').type('{selectall}123');
cy.get('@repoApprovalTimeoutInput')
.should('be.visible')
.type('{selectall}123');
cy.get('@repoApprovalTimeoutInput').should('have.value', '123');
})
});

it('approval timeout input should not allow letter/character input', () => {
cy.get('[data-test=repo-approval-timeout]').as('repoApprovalTimeout');
cy.get('[data-test=repo-approval-timeout] input').as('repoApprovalTimeoutInput');
cy.get('@repoApprovalTimeoutInput').should('be.visible').type('{selectall}cat');
cy.get('[data-test=repo-approval-timeout] input').as(
'repoApprovalTimeoutInput',
);
cy.get('@repoApprovalTimeoutInput')
.should('be.visible')
.type('{selectall}cat');
cy.get('@repoApprovalTimeoutInput').should('not.have.value', 'cat');
cy.get('@repoApprovalTimeoutInput').type('{selectall}12cat34');
cy.get('@repoApprovalTimeoutInput').should('have.value', '1234');
});

it('clicking update on approval timeout should update timeout and hide button', () => {
cy.get('[data-test=repo-approval-timeout]').as('repoApprovalTimeout');
cy.get('[data-test=repo-approval-timeout] input').as('repoApprovalTimeoutInput');
cy.get('[data-test=repo-approval-timeout] input').as(
'repoApprovalTimeoutInput',
);
cy.get('@repoApprovalTimeoutInput').should('be.visible').clear();
cy.get('@repoApprovalTimeoutInput').type('{selectall}80');
cy.get('[data-test=repo-approval-timeout] + button')
.should('be.visible')
.click({ force: true });
cy.get('[data-test=repo-approval-timeout] + button').should('be.disabled');
cy.get('[data-test=repo-approval-timeout] + button').should(
'be.disabled',
);
});

it('build limit input should allow number input', () => {
Expand Down
3 changes: 3 additions & 0 deletions src/elm/Pages/Org_/Repo_/Settings.elm
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ viewForkPolicy repo msg =
]
]


{-| viewApprovalTimeout : takes model and repo and renders the settings category for updating repo build approval timeout.
-}
viewApprovalTimeout : Vela.Repository -> Maybe Int -> (Int -> msg) -> (String -> msg) -> Html msg
Expand All @@ -879,6 +880,7 @@ viewApprovalTimeout repo inApprovalTimeout clickMsg inputMsg =
]
]


{-| viewApprovalTimeoutInput : takes repo, user input, and button action and renders the text input for updating build approval timeout.
-}
viewApprovalTimeoutInput : Vela.Repository -> Maybe Int -> (String -> msg) -> Html msg
Expand Down Expand Up @@ -937,6 +939,7 @@ validApprovalTimeout maxApprovalTimeout inApprovalTimeout _ repoApprovalTimeout
Nothing ->
False


{-| viewLimit : takes model and repo and renders the settings category for updating repo build limit.
-}
viewLimit : Shared.Model -> Vela.Repository -> Maybe Int -> (Int -> msg) -> (String -> msg) -> Html msg
Expand Down
2 changes: 1 addition & 1 deletion src/elm/Vela.elm
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ encodeRepoPayload repo =
, ( "timeout", encodeOptional Json.Encode.int repo.timeout )
, ( "counter", encodeOptional Json.Encode.int repo.counter )
, ( "pipeline_type", encodeOptional Json.Encode.string repo.pipeline_type )
, ( "approval_timeout", encodeOptional Json.Encode.int repo.approval_timeout)
, ( "approval_timeout", encodeOptional Json.Encode.int repo.approval_timeout )
]


Expand Down

0 comments on commit dbcb4cc

Please sign in to comment.