Browse Source

test: kludge - add delay for response

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5597/head
Raju Udava 2 years ago
parent
commit
df6f0501eb
  1. 6
      tests/playwright/tests/db/01-webhook.spec.ts

6
tests/playwright/tests/db/01-webhook.spec.ts

@ -23,6 +23,9 @@ async function clearServerData({ request }) {
async function getWebhookResponses({ request, count = 1 }) { async function getWebhookResponses({ request, count = 1 }) {
let response; let response;
// kludge- add delay to allow server to process webhook
await new Promise(resolve => setTimeout(resolve, 1000));
// retry since there can be lag between the time the hook is triggered and the time the server receives the request // retry since there can be lag between the time the hook is triggered and the time the server receives the request
for (let i = 0; i < 20; i++) { for (let i = 0; i < 20; i++) {
response = await request.get(hookPath + '/count'); response = await request.get(hookPath + '/count');
@ -425,6 +428,9 @@ test.describe.serial('Webhook', () => {
test('Bulk operations', async ({ request, page }) => { test('Bulk operations', async ({ request, page }) => {
async function verifyBulkOperationTrigger(rsp, type) { async function verifyBulkOperationTrigger(rsp, type) {
// kludge- add delay to allow server to process webhook
await new Promise(resolve => setTimeout(resolve, 1000));
for (let i = 0; i < rsp.length; i++) { for (let i = 0; i < rsp.length; i++) {
expect(rsp[i].type).toBe(type); expect(rsp[i].type).toBe(type);
expect(rsp[i].data.table_name).toBe('Test'); expect(rsp[i].data.table_name).toBe('Test');

Loading…
Cancel
Save