Skip to content

Commit

Permalink
chore: Fix triggers flaky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinSchoeler committed Sep 29, 2023
1 parent 12e66c0 commit 58788c7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/meteor/app/livechat/imports/server/rest/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { isGETLivechatTriggersParams, isPOSTLivechatTriggersParams } from '@rock

import { API } from '../../../../api/server';
import { getPaginationItems } from '../../../../api/server/helpers/getPaginationItems';
import { findTriggers, findTriggerById } from '../../../server/api/lib/triggers';
import { findTriggers, findTriggerById, deleteTrigger } from '../../../server/api/lib/triggers';

API.v1.addRoute(
'livechat/triggers',
Expand Down Expand Up @@ -57,5 +57,12 @@ API.v1.addRoute(
trigger,
});
},
async delete() {
await deleteTrigger({
triggerId: this.urlParams._id,
});

return API.v1.success();
},
},
);
4 changes: 4 additions & 0 deletions apps/meteor/app/livechat/server/api/lib/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ export async function findTriggers({
export async function findTriggerById({ triggerId }: { triggerId: string }): Promise<ILivechatTrigger | null> {
return LivechatTrigger.findOneById(triggerId);
}

export async function deleteTrigger({ triggerId }: { triggerId: string }): Promise<void> {
await LivechatTrigger.removeById(triggerId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ test.describe.serial('Omnichannel Triggers', () => {

const { page } = await createAuxContext(browser, Users.user1, '/omnichannel/triggers');
agent = { page, poHomeOmnichannel: new HomeOmnichannel(page) };
await page.emulateMedia({ reducedMotion: 'reduce' });
});

test.beforeEach(async ({ page, api }) => {
Expand All @@ -39,6 +40,7 @@ test.describe.serial('Omnichannel Triggers', () => {
await Promise.all([
api.delete('/livechat/users/agent/user1'),
api.delete('/livechat/users/manager/user1'),
api.delete(`/livechat/triggers/${triggersName}`),
api.post('/settings/Livechat_clear_local_storage_when_chat_ended', { value: false }),
]);
await agent.page.close();
Expand Down
6 changes: 6 additions & 0 deletions packages/livechat/src/components/Modal/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ $modal-background-color: $bg-color-white;
line-height: 1.5;
}

@media (prefers-reduced-motion) {
.modal--animated {
animation: none;
}
}

@keyframes fadeInUp {
0% {
transform: translate3d(-50%, 100%, 0);
Expand Down
1 change: 1 addition & 0 deletions packages/rest-typings/src/v1/omnichannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3588,6 +3588,7 @@ export type OmnichannelEndpoints = {
};
'/v1/livechat/triggers/:_id': {
GET: () => { trigger: ILivechatTrigger | null };
DELETE: () => void;
};
'/v1/livechat/rooms': {
GET: (params: GETLivechatRoomsParams) => PaginatedResult<{ rooms: IOmnichannelRoom[] }>;
Expand Down

0 comments on commit 58788c7

Please sign in to comment.