mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 08:02:15 +03:00
test: fix event trigger e2e test
## Description Solving the issue raised here https://hasurahq.slack.com/archives/C049N7YU9EU/p1685109887435229 The event trigger test sometimes failed because the trigger created by previous tests was not cleaned up. An additional cleanup has been added to the `before` function that tries to delete the event trigger if exists. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9324 GitOrigin-RevId: 1bdc96312324cbad6d85a91a9ab827c0218290f4
This commit is contained in:
parent
776a893eaa
commit
58ff864b33
@ -11,9 +11,48 @@ describe('Create event trigger with shortest possible path', () => {
|
||||
cy.visit('/data/default/schema/public', {
|
||||
timeout: 10000,
|
||||
});
|
||||
|
||||
cy.get('[data-test=add-track-table-user_table]', {
|
||||
timeout: 10000,
|
||||
}).click();
|
||||
|
||||
// if there is a trigger from a previous test, delete it
|
||||
cy.visit('/events/data/event_trigger_test/modify', {
|
||||
timeout: 10000,
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, 'prompt').returns('event_trigger_test');
|
||||
},
|
||||
});
|
||||
|
||||
// wait for loading to not be visible
|
||||
cy.get('span:contains("Loading...")', { timeout: 10000 }).should(
|
||||
'not.be.visible'
|
||||
);
|
||||
|
||||
cy.get('body').then($body => {
|
||||
cy.log(
|
||||
'**--- Delete the ET',
|
||||
$body.find('button[data-test=delete-trigger]')
|
||||
);
|
||||
if ($body.find('button[data-test=delete-trigger]').length > 0) {
|
||||
cy.log('**--- Delete the ET 2');
|
||||
cy.intercept('POST', 'http://localhost:8080/v1/metadata', req => {
|
||||
if (JSON.stringify(req.body).includes('delete_event_trigger')) {
|
||||
req.alias = 'deleteTrigger';
|
||||
}
|
||||
req.continue();
|
||||
});
|
||||
|
||||
cy.intercept('POST', 'http://localhost:9693/apis/migrate', req => {
|
||||
if (JSON.stringify(req.body).includes('delete_event_trigger')) {
|
||||
req.alias = 'deleteTrigger';
|
||||
}
|
||||
});
|
||||
|
||||
cy.get('button[data-test=delete-trigger]').click();
|
||||
cy.wait('@deleteTrigger');
|
||||
}
|
||||
});
|
||||
});
|
||||
after(() => {
|
||||
// delete the table
|
||||
@ -254,6 +293,7 @@ describe('Create event trigger with logest possible path', () => {
|
||||
);
|
||||
cy.findAllByRole('button', { name: 'Edit' }).eq(1).click();
|
||||
cy.get('[name=update]').click();
|
||||
|
||||
cy.get('[name=column-id]').click();
|
||||
cy.findByRole('button', { name: 'Save' }).click();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user