test: fix one-off event e2e test

This PR fixes the one-off trigger failing e2e test.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7323
GitOrigin-RevId: 44f1e4ce316ec488985d0c17b2da75719515fa94
This commit is contained in:
Daniele Cammareri 2022-12-19 18:08:44 +01:00 committed by hasura-bot
parent 5910864845
commit 209895988a
4 changed files with 25 additions and 12 deletions

View File

@ -27,21 +27,23 @@ export const scheduleOneoffEvent = () => {
// click on the schedule event tab // click on the schedule event tab
cy.visit('/events/one-off-scheduled-events/add'); cy.visit('/events/one-off-scheduled-events/add');
cy.url().should('eq', `${baseUrl}/events/one-off-scheduled-events/add`); cy.url().should('eq', `${baseUrl}/events/one-off-scheduled-events/add`);
// webhook url // type webhook url
cy.get(getElementFromAlias('one-off-webhook')).type(getWebhookURL()); cy.get('[data-testid=webhook]').type(getWebhookURL());
// advanced settings // open retry configuration accordion
cy.get(getElementFromAlias('event-advanced-configuration')).click(); cy.get('[data-testid=retry-configuration] > div > button').click();
// retry configuration // type retry configuration
cy.get(getElementFromAlias('no-of-retries')).clear().type(getNoOfRetries()); cy.get('[data-testid=num_retries]').clear().type(getNoOfRetries());
cy.get(getElementFromAlias('interval-seconds')) // type interval seconds
cy.get('[data-testid=retry_interval_seconds]')
.clear() .clear()
.type(getIntervalSeconds()); .type(getIntervalSeconds());
cy.get(getElementFromAlias('timeout-seconds')) // type payload
.clear() cy.get('textarea').clear({ force: true }).type('{}', { force: true });
.type(getTimeoutSeconds()); // type timeout seconds
cy.get('[data-testid=timeout_seconds]').clear().type(getTimeoutSeconds());
// Click on create // Click on create
cy.get(getElementFromAlias('create-schedule-event')).click(); cy.get('[data-testid=create-scheduled-event]').click();
cy.wait(10000); cy.wait(10000);
// Check if the trigger got created and navigated to processed events page // Check if the trigger got created and navigated to processed events page
cy.url().should('eq', `${baseUrl}/events/one-off-scheduled-events/pending`); cy.url().should('eq', `${baseUrl}/events/one-off-scheduled-events/pending`);

View File

@ -67,7 +67,12 @@ const OneOffScheduledEventForm = (props: Props) => {
<RetryConfiguration /> <RetryConfiguration />
</div> </div>
<div className="flex items-center mb-lg"> <div className="flex items-center mb-lg">
<Button type="submit" mode="primary" isLoading={mutation.isLoading}> <Button
data-testid="create-scheduled-event"
type="submit"
mode="primary"
isLoading={mutation.isLoading}
>
Create scheduled event Create scheduled event
</Button> </Button>
</div> </div>

View File

@ -12,6 +12,7 @@ export const RetryConfiguration = () => {
return ( return (
<> <>
<Collapse <Collapse
data-testid="retry-configuration"
title="Retry Configuration" title="Retry Configuration"
tooltip="Retry configuration if the call to the webhook fails" tooltip="Retry configuration if the call to the webhook fails"
> >
@ -26,6 +27,7 @@ export const RetryConfiguration = () => {
{/* TODO: This is a horizontal/inline input field, currently we do not have it in common so this component implements its own, {/* TODO: This is a horizontal/inline input field, currently we do not have it in common so this component implements its own,
we should replace this in future with the common component */} we should replace this in future with the common component */}
<input <input
data-testid="num_retries"
type="number" type="number"
className={inputStyes} className={inputStyes}
aria-label="num_retries" aria-label="num_retries"
@ -40,6 +42,7 @@ export const RetryConfiguration = () => {
</div> </div>
<div className="col-span-6"> <div className="col-span-6">
<input <input
data-testid="retry_interval_seconds"
type="number" type="number"
className={inputStyes} className={inputStyes}
aria-label="retry_interval_seconds" aria-label="retry_interval_seconds"
@ -54,6 +57,7 @@ export const RetryConfiguration = () => {
</div> </div>
<div className="col-span-6"> <div className="col-span-6">
<input <input
data-testid="timeout_seconds"
type="number" type="number"
className={inputStyes} className={inputStyes}
aria-label="timeout_seconds" aria-label="timeout_seconds"

View File

@ -119,6 +119,7 @@ export const Collapse = ({
disabled = false, disabled = false,
disabledMessage, disabledMessage,
rootClassName, rootClassName,
...props
}: CollapseProps): JSX.Element => { }: CollapseProps): JSX.Element => {
const [open, setOpen] = React.useState(defaultOpen); const [open, setOpen] = React.useState(defaultOpen);
@ -131,6 +132,7 @@ export const Collapse = ({
open={open} open={open}
onOpenChange={onOpenChange} onOpenChange={onOpenChange}
className={rootClassName} className={rootClassName}
{...props}
> >
<CollapseCtx.Provider value={{ open }}> <CollapseCtx.Provider value={{ open }}>
{!!title && ( {!!title && (