mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 01:12:56 +03:00
console: : e2e testing for one-off scheduled triggers
This PR adds e2e testing for one-off scheduled triggers. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/8965 GitOrigin-RevId: e2416376d8d5b7c339e32b232d657a5611158069
This commit is contained in:
parent
c7d4117964
commit
9e65da5429
@ -0,0 +1,101 @@
|
||||
describe('Create Scheduled trigger', () => {
|
||||
it('with longest path everything should work', () => {
|
||||
cy.log('**------------------------------**');
|
||||
cy.log('**------------------------------**');
|
||||
cy.log('**------------------------------**');
|
||||
cy.log('**--- Step 1: Create an Scheduled trigger with longest path**');
|
||||
cy.log('**------------------------------**');
|
||||
cy.log('**------------------------------**');
|
||||
cy.log('**------------------------------**');
|
||||
|
||||
cy.visit('/events/one-off-scheduled-events/add', {
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// add webhook url
|
||||
cy.log('**--- Add webhook url');
|
||||
cy.get('[name=webhook]').type('http://httpbin.org/post');
|
||||
|
||||
// add scheduled time
|
||||
cy.log('**--- Add scheduled time');
|
||||
cy.get('.rdt').click();
|
||||
cy.get('.rdtNext').click();
|
||||
cy.get('.rdtDays').find('td').eq(1).click();
|
||||
|
||||
// add payload
|
||||
cy.log('**--- Add request payload');
|
||||
cy.get('.ace_content').type('{{}"name":"json_payload"}');
|
||||
|
||||
// Add headers
|
||||
cy.log('**--- Add headers');
|
||||
cy.findByText('Advance Settings').click();
|
||||
cy.findAllByRole('button', { name: 'Add request headers' }).click();
|
||||
cy.findByPlaceholderText('Key...').type('user_id');
|
||||
cy.findByPlaceholderText('Value...').type('1234');
|
||||
|
||||
// Add headers retry config
|
||||
cy.log('**--- Add headers');
|
||||
cy.findByText('Retry Configuration').click();
|
||||
cy.get('[name=num_retries]').clear().type('3');
|
||||
cy.get('[name=retry_interval_seconds]').clear().type('20');
|
||||
cy.get('[name=timeout_seconds]').clear().type('80');
|
||||
|
||||
// click on create button to save scheduled trigger
|
||||
cy.log('**--- Click on Create scheduled event');
|
||||
cy.findAllByRole('button', { name: 'Create scheduled event' }).click();
|
||||
|
||||
// expect success notification
|
||||
cy.log('**--- Expect success notification');
|
||||
cy.expectSuccessNotificationWithMessage('Event scheduled successfully');
|
||||
|
||||
cy.visit('/events/one-off-scheduled-events/pending', {
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// expect scheduled event in pending events table
|
||||
cy.get('[data-test=event-filter-table').should('exist');
|
||||
cy.get('[data-test=event-filter-table')
|
||||
.find('.rt-tbody')
|
||||
.within(() => {
|
||||
cy.get('div').should('have.length', 13);
|
||||
});
|
||||
});
|
||||
it('with shortest path everything should work', () => {
|
||||
cy.log('**------------------------------**');
|
||||
cy.log('**------------------------------**');
|
||||
cy.log('**------------------------------**');
|
||||
cy.log('**--- Step 1: Create an Scheduled trigger with shortest path**');
|
||||
cy.log('**------------------------------**');
|
||||
cy.log('**------------------------------**');
|
||||
cy.log('**------------------------------**');
|
||||
|
||||
cy.visit('/events/one-off-scheduled-events/add', {
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
// add webhook url
|
||||
cy.log('**--- Add webhook url');
|
||||
cy.get('[name=webhook]').type('http://httpbin.org/post');
|
||||
|
||||
// add payload
|
||||
cy.log('**--- Add request payload');
|
||||
cy.get('.ace_content').type('{{}"name":"json_payload"}');
|
||||
|
||||
// click on create button to save scheduled trigger
|
||||
cy.log('**--- Click on Create scheduled event');
|
||||
cy.findAllByRole('button', { name: 'Create scheduled event' }).click();
|
||||
|
||||
// expect success notification
|
||||
cy.log('**--- Expect success notification');
|
||||
cy.expectSuccessNotificationWithMessage('Event scheduled successfully');
|
||||
|
||||
// expect scheduled event in pending events table
|
||||
cy.get('[data-test=event-filter-table').should('exist');
|
||||
|
||||
cy.get('[data-test=event-filter-table')
|
||||
.find('.rt-tbody')
|
||||
.within(() => {
|
||||
cy.get('div').should('have.length', 26);
|
||||
});
|
||||
});
|
||||
});
|
@ -57,7 +57,7 @@ const FilterQuery: React.FC<Props> = props => {
|
||||
|
||||
return (
|
||||
<Analytics name="EventFilterQuery" {...REDACT_EVERYTHING}>
|
||||
<div className={styles.add_mar_top}>
|
||||
<div className={styles.add_mar_top} data-test="event-filter-table">
|
||||
{render(rows, state, setState, runQuery)}
|
||||
</div>
|
||||
</Analytics>
|
||||
|
@ -124,7 +124,14 @@ export const useFilterQuery = (
|
||||
requestAction(endpoint, options, undefined, undefined, true, true)
|
||||
).then(
|
||||
(data: any) => {
|
||||
setRows(data ?? []);
|
||||
if (triggerType === 'data') {
|
||||
setRows(data ?? []);
|
||||
} else if (triggerOp !== 'invocation') {
|
||||
setRows(data?.events ?? []);
|
||||
} else {
|
||||
setRows(data?.invocations ?? []);
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
if (offset !== undefined) {
|
||||
setState(s => ({ ...s, offset }));
|
||||
|
Loading…
Reference in New Issue
Block a user