Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: delete created app variant #1977

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
12 changes: 11 additions & 1 deletion agenta-web/cypress/e2e/ab-testing-evaluation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ describe("A/B Testing Evaluation workflow", () => {
})

context("When executing the evaluation", () => {
it("Should successfully execute the evaluation process", () => {
beforeEach(() => {
cy.visit(`/apps/${app_id}/annotations/human_a_b_testing`)
})

it("Should successfully execute the evaluation process", () => {
cy.url().should("include", "/annotations/human_a_b_testing")
cy.clickLinkAndWait('[data-cy="new-annotation-modal-button"]')

Expand Down Expand Up @@ -93,6 +96,13 @@ describe("A/B Testing Evaluation workflow", () => {
'[data-cy="evaluation-vote-panel-comparison-both-good-vote-button-button"]',
).click()
})

it("Should successfully delete the evalueation", () => {
cy.url().should("include", "/annotations/human_a_b_testing")
cy.get('[type="checkbox"]').eq(1).check().should("be.checked")
cy.get('[data-cy="annotation-delete-button"]').click()
cy.get('[data-cy="annotation-table"] > .ant-table-tbody').should("not.exist")
})
})

after(() => {
Expand Down
58 changes: 58 additions & 0 deletions agenta-web/cypress/e2e/app-variants.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {randString} from "../../src/lib/helpers/utils"

describe("Test App variant", () => {
let app_v2 = randString(5)
let app_id
before(() => {
cy.createVariant()
cy.get("@app_id").then((appId) => {
app_id = appId
})
})

context("When testing the app variant", () => {
beforeEach(() => {
cy.visit(`/apps/${app_id}/playground`)
})

it("Should successfully create a new app variant", () => {
cy.clickLinkAndWait("button.ant-tabs-nav-add")
cy.get('[data-cy="new-variant-modal"]').should("exist")
cy.get('[data-cy="new-variant-modal-select"]').click()
cy.get('[data-cy^="new-variant-modal-label"]').contains("app.default").click()
cy.get('[data-cy="new-variant-modal-input"]').type(app_v2)
cy.get('[data-cy="new-variant-modal"]').within(() => {
cy.get("button.ant-btn").contains(/ok/i).click()
})
cy.url().should("include", `/playground?variant=app.${app_v2}`)
cy.get('[data-cy="playground-save-changes-button"]').eq(1).click()
cy.get('[data-cy="playground-publish-button"]').should("exist")
cy.get(".ant-message-notice-content").should("exist")
})

it("Should verify user has more than one app variant", () => {
cy.get(".ant-tabs-nav-list").within(() => {
cy.get(".ant-tabs-tab").should("have.length.gt", 1)
})
})

it("Should delete the created app variant", () => {
cy.get(`[data-node-key="app.${app_v2}"]`).contains(`app.${app_v2}`).click()
cy.url().should("include", `/playground?variant=app.${app_v2}`)
cy.get('[data-cy="playground-delete-variant-button"]').eq(1).click()
cy.get(".ant-modal-content").within(() => {
cy.get(".ant-modal-confirm-btns > .ant-btn-primary").contains(/yes/i).click()
})
})

it("Should verify there is only one variant present", () => {
cy.get(".ant-tabs-nav-list").within(() => {
cy.get(".ant-tabs-tab").should("have.length.lte", 1)
})
})
})

after(() => {
cy.cleanupVariantAndTestset()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,11 @@ export default function HumanEvaluationResult({setIsEvalModalOpen}: HumanEvaluat
return (
<div>
<div className={classes.btnContainer}>
<Button onClick={onDelete} disabled={selectedRowKeys.length == 0}>
<Button
onClick={onDelete}
disabled={selectedRowKeys.length == 0}
data-cy="annotation-delete-button"
>
<DeleteOutlined key="delete" />
Delete
</Button>
Expand All @@ -366,6 +370,7 @@ export default function HumanEvaluationResult({setIsEvalModalOpen}: HumanEvaluat
className="ph-no-capture"
columns={columns}
dataSource={evaluationsList}
data-cy="annotation-table"
/>
</Spin>
</div>
Expand Down