Skip to content

Commit

Permalink
fix: calendar tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkPhoenix2704 committed May 14, 2024
1 parent 03280aa commit 5ffc28c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/nc-gui/components/nc/DateWeekSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const emitDblClick = (date: dayjs.Dayjs) => {
class="flex justify-between border-b-1 px-3 py-0.5 nc-date-week-header items-center"
>
<NcTooltip v-if="!disablePagination">
<NcButton class="!border-0" data-testid="nc-calendar-prev-btn" size="small" type="secondary" @click="paginate('prev')">
<NcButton class="!border-0" size="small" type="secondary" @click="paginate('prev')">
<component :is="iconMap.arrowLeft" class="h-4 w-4" />
</NcButton>
<template #title>
Expand Down
4 changes: 2 additions & 2 deletions packages/nc-gui/components/nc/MonthYearSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const compareYear = (date1: dayjs.Dayjs, date2: dayjs.Dayjs) => {
<div v-if="!hideHeader" class="flex px-2 border-b-1 py-0.5 justify-between items-center">
<div class="flex">
<NcTooltip>
<NcButton class="!border-0" data-testid="nc-calendar-prev-btn" size="small" type="secondary" @click="paginate('prev')">
<NcButton class="!border-0" size="small" type="secondary" @click="paginate('prev')">
<component :is="iconMap.arrowLeft" class="h-4 w-4" />
</NcButton>
<template #title>
Expand All @@ -107,7 +107,7 @@ const compareYear = (date1: dayjs.Dayjs, date2: dayjs.Dayjs) => {
}}</span>
<div class="flex">
<NcTooltip>
<NcButton class="!border-0" data-testid="nc-calendar-next-btn" size="small" type="secondary" @click="paginate('next')">
<NcButton class="!border-0" size="small" type="secondary" @click="paginate('next')">
<component :is="iconMap.arrowRight" class="h-4 w-4" />
</NcButton>
<template #title>
Expand Down
5 changes: 3 additions & 2 deletions tests/playwright/pages/Dashboard/Calendar/CalendarSideMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export class CalendarSideMenuPage extends BasePage {

this.new_record_btn = this.get().getByTestId('nc-calendar-side-menu-new-btn');

this.next_btn = this.get().getByTestId('nc-calendar-next-btn');
this.prev_btn = this.get().getByTestId('nc-calendar-prev-btn');
this.next_btn = this.parent.toolbar.get().getByTestId('nc-calendar-next-btn');
this.prev_btn = this.parent.toolbar.get().getByTestId('nc-calendar-prev-btn');

this.searchToggleBtn = this.get().getByTestId('nc-calendar-sidebar-search-btn');
}
Expand Down Expand Up @@ -49,6 +49,7 @@ export class CalendarSideMenuPage extends BasePage {
}

async moveToDate({ date, action }: { date: string; action: 'prev' | 'next' }) {
console.log(await this.parent.toolbar.getActiveDate());
while ((await this.parent.toolbar.getActiveDate()) !== date) {
if (action === 'prev') {
await this.clickPrev();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export class CalendarWeekDateTimePage extends BasePage {
await this.rootPage.mouse.down();
await this.rootPage.waitForTimeout(500);

await this.rootPage.mouse.move(cord.x + cord.width / 2, cord.y + cord.height / 2);
await this.rootPage.mouse.move(cord.x + Math.ceil(cord.width / 2), cord.y + Math.ceil(cord.height / 2));
// await toDay.scrollIntoViewIfNeeded();
await this.rootPage.waitForTimeout(500);

await this.rootPage.mouse.up();
}

Expand All @@ -56,8 +59,8 @@ export class CalendarWeekDateTimePage extends BasePage {
hour.click({
force: true,
position: {
x: -1,
y: -1,
x: 1,
y: 1,
},
}),
requestUrlPathToMatch: '/api/v1/db/data/noco',
Expand Down
6 changes: 3 additions & 3 deletions tests/playwright/tests/db/views/viewCalendar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const dateRecords = [
{
Id: 1,
Title: 'Team Catchup',
StartDate: '2024-01-01 09:00',
StartDate: '2024-01-01 08:00',
EndDate: '2024-01-01 10:00',
},
{
Expand Down Expand Up @@ -337,13 +337,13 @@ test.describe('Calendar View', () => {
record: 'Team Catchup',
to: {
dayIndex: 0,
hourIndex: 5,
hourIndex: 7,
},
});

await calendar.sideMenu.updateFilter({ filter: 'In selected hours' });

await calendar.calendarWeekDateTime.selectHour({ dayIndex: 0, hourIndex: 5 });
await calendar.calendarWeekDateTime.selectHour({ dayIndex: 0, hourIndex: 7 });

await calendar.sideMenu.verifySideBarRecords({ records: ['Team Catchup'] });

Expand Down

1 comment on commit 5ffc28c

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR changes have been deployed. Please run the following command to verify:

docker run -d -p 8888:8080 nocodb/nocodb-timely:0.205.0-pr-8379-20240514-0450

Please sign in to comment.