Fullcalendar 量角器e2e全日历阻力测试;滴
我需要用量角器在周视图中模拟对fullcalendar的拖放。我找到了坐标,但我想要一个“不依赖浏览器窗口的解决方案”。。。按类别或id在周视图中也找不到确切的起始单元格……或者至少,我不知道如何选择一天中一行的单个单元格,因为使用Chrome的项目选择器,似乎每行都有相同的classFullcalendar 量角器e2e全日历阻力测试;滴,fullcalendar,protractor,Fullcalendar,Protractor,我需要用量角器在周视图中模拟对fullcalendar的拖放。我找到了坐标,但我想要一个“不依赖浏览器窗口的解决方案”。。。按类别或id在周视图中也找不到确切的起始单元格……或者至少,我不知道如何选择一天中一行的单个单元格,因为使用Chrome的项目选择器,似乎每行都有相同的classfc widget content,并且单元格不是“可选”元素 还有其他机会吗?也许这有点帮助(也很晚了;)。我也想用FullCalendar测试我的应用程序,但我用的是Cypress(类似于量角器) 我们从外部列
fc widget content
,并且单元格不是“可选”元素
还有其他机会吗?也许这有点帮助(也很晚了;)。我也想用FullCalendar测试我的应用程序,但我用的是Cypress(类似于量角器) 我们从外部列表中计划项目,并在FullCalendar中的特定日期/时间将其分配给资源(我们使用scheduler插件) 我发现
拖拽
和拖拽
事件在某种程度上被代码截获,并用事件的属性(如日期、标题和其他)丰富了它。我如何丰富这些数据是在Cypresstrigger('drop',data)
命令中。数据是由Draggable
类设置的数据:
// Executed on the external list items, where every item we want to plan has class `.fc-event`.
this.draggableContainer = new Draggable(this.containerEl.nativeElement, {
itemSelector: '.fc-event',
eventData(eventEl) {
const id = eventEl.dataset.id;
return {
duration,
id: currentWorkItem.id,
title: currentWorkItem.description,
extendedProps: {
duration,
customRender: true,
data: currentWorkItem,
},
};
}
然后,在测试文件(Cypress)中
因此,.trigger('drop',eventData)
将填充eventDrop信息。这与手动操作并不完全相同,但对我来说很有效
注意事项:
- 我还没有找到在其他资源上计划它的方法(我们使用FullCalendar.io的资源调度插件)。这并不重要,因为您可以在evenData(
中指定它resource:{id:'my resource id'}}
- 没有视觉反馈,因为没有显示拖动镜像。在e2e测试期间,这不是一个大问题,但现在它有点像黑盒子。也许这是可以解决的
const eventData = {
date: new Date(),
dateStr: new Date().toISOString(),
draggedEl: {
dataset: {
notificationId: '123',
priority: '0',
title: 'Test',
},
},
jsEvent: null,
resource: {
id: '123',
},
event: null,
oldEvent: null,
};
cy.get('.fc-event') // selector for the external event I want to drag in the calendar
.trigger('dragstart')
.get('.fc-time-grid table tr[data-time="07:00:00"] td.fc-widget-content:nth-child(2)') // selector for where I want to drop the event.
.trigger('drop', eventData) // this will fire the eventDrop event