Skip to content

Commit

Permalink
fix(frontend): cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashrafchowdury committed Dec 6, 2024
1 parent f924f8f commit 6246514
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 32 deletions.
23 changes: 1 addition & 22 deletions agenta-web/cypress/e2e/eval.comparison.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,7 @@ describe("Evaluation Comparison Test", function () {
})

it("Should create 2 new Evaluations", () => {
cy.request({
url: `${Cypress.env().baseApiURL}/evaluations?app_id=${app_id}`,
method: "GET",
}).then((resp) => {
cy.get('[data-cy="new-evaluation-button"]').click()
})
cy.get(".ant-modal-content").should("exist")

cy.get('[data-cy="select-testset-group"]').click()
cy.get('[data-cy="select-testset-option"]').eq(0).click()

cy.get('[data-cy="select-variant-group"]').click()
cy.get('[data-cy="select-variant-option"]').eq(0).click()
cy.get('[data-cy="select-variant-option"]').eq(1).click()
cy.get('[data-cy="select-variant-group"]').click()

cy.get('[data-cy="select-evaluators-group"]').click()
cy.get('[data-cy="select-evaluators-option"]').eq(0).click()
cy.get('[data-cy="select-evaluators-group"]').click()

cy.get(".ant-modal-footer > .ant-btn-primary > .ant-btn-icon > .anticon > svg").click()
cy.wait(1000)
cy.createNewEvaluation()
})

it("Should verify that there are completed evaluations in the list", () => {
Expand Down
16 changes: 7 additions & 9 deletions agenta-web/cypress/support/commands/evaluations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,15 @@ Cypress.Commands.add("createNewEvaluation", (evaluatorName = "Exact Match") => {
})
cy.get(".ant-modal-content").should("exist")

cy.get('[data-cy="select-testset-group"]').click()
cy.get('[data-cy="select-testset-option"]').eq(0).click()
cy.get('[data-cy="evaluation-testset-table"]').find('input[type="radio"]').eq(0).check()

cy.get('[data-cy="select-variant-group"]').click()
cy.get('[data-cy="select-variant-option"]').eq(0).click()
cy.get('[data-cy="select-variant-group"]').click()
cy.get('[data-cy="evaluation-variant-table"]').find('input[type="checkbox"]').eq(0).check()

cy.get('[data-cy="select-evaluators-group"]').click()
cy.get('[data-cy="select-evaluators-option"]').contains(evaluatorName).eq(0).click()
cy.get('[data-cy="select-evaluators-group"]').click({force: true})
cy.get('[data-cy="evaluation-search-evaluator"]')
.type(evaluatorName)
.should("have.value", evaluatorName)
cy.get('[data-cy="evaluation-evaluator-table"]').find('input[type="checkbox"]').eq(1).check()

cy.get(".ant-modal-footer > .ant-btn-primary > .ant-btn-icon > .anticon > svg").click()
cy.get(".ant-modal-footer > .ant-btn-primary").click()
cy.wait(1000)
})
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const SelectEvaluatorSection = ({
<Input.Search
placeholder="Search"
className="w-[300px]"
data-cy="evaluation-search-evaluator"
onClick={(event) => {
event.stopPropagation()
}}
Expand Down Expand Up @@ -158,6 +159,7 @@ const SelectEvaluatorSection = ({
},
}}
className="ph-no-capture"
data-cy="evaluation-evaluator-table"
columns={columns}
rowKey={"id"}
dataSource={filteredEvalConfigs}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const SelectTestsetSection = ({
setSelectedTestsetId(selectedRowKeys[0] as string)
},
}}
data-cy="app-testset-list"
data-cy="evaluation-testset-table"
className={`ph-no-capture`}
columns={columns}
dataSource={filteredTestset}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ const SelectVariantSection = ({
}}
className="ph-no-capture"
rowKey={"variantId"}
data-cy="evaluation-variant-table"
columns={columns}
dataSource={filteredVariant}
scroll={{x: true}}
Expand Down

0 comments on commit 6246514

Please sign in to comment.