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

View File

@ -67,7 +67,12 @@ const OneOffScheduledEventForm = (props: Props) => {
<RetryConfiguration />
</div>
<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
</Button>
</div>

View File

@ -12,6 +12,7 @@ export const RetryConfiguration = () => {
return (
<>
<Collapse
data-testid="retry-configuration"
title="Retry Configuration"
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,
we should replace this in future with the common component */}
<input
data-testid="num_retries"
type="number"
className={inputStyes}
aria-label="num_retries"
@ -40,6 +42,7 @@ export const RetryConfiguration = () => {
</div>
<div className="col-span-6">
<input
data-testid="retry_interval_seconds"
type="number"
className={inputStyes}
aria-label="retry_interval_seconds"
@ -54,6 +57,7 @@ export const RetryConfiguration = () => {
</div>
<div className="col-span-6">
<input
data-testid="timeout_seconds"
type="number"
className={inputStyes}
aria-label="timeout_seconds"

View File

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