Browse Source

test: fix

pull/7611/head
DarkPhoenix2704 8 months ago
parent
commit
71d935337d
  1. 4
      packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue
  2. 14
      tests/playwright/pages/Dashboard/Grid/Column/index.ts
  3. 35
      tests/playwright/tests/db/views/viewCalendar.spec.ts

4
packages/nc-gui/components/smartsheet/calendar/WeekView/DateField.vue

@ -606,6 +606,7 @@ const dropEvent = (event: DragEvent) => {
<div
v-for="(record, id) in calendarData"
:key="id"
:data-testid="`nc-calendar-week-record-${record.row[displayField!.title!]}`"
:data-unique-id="record.rowMeta.id"
:style="{
...record.rowMeta.style,
@ -614,8 +615,7 @@ const dropEvent = (event: DragEvent) => {
? '0px 8px 8px -4px rgba(0, 0, 0, 0.04), 0px 20px 24px -4px rgba(0, 0, 0, 0.10)'
: 'none',
}"
class="absolute group draggable-record pointer-events-auto"
data-testid="nc-calendar-week-record-card"
class="absolute group draggable-record pointer-events-auto nc-calendar-week-record-card"
@mousedown="dragStart($event, record)"
@mouseleave="hoverRecord = null"
@mouseover="hoverRecord = record.rowMeta.id"

14
tests/playwright/pages/Dashboard/Grid/Column/index.ts

@ -216,8 +216,12 @@ export class ColumnPageObject extends BasePage {
await this.get().locator('.nc-column-name-input').fill(title);
}
async selectType({ type }: { type: string }) {
await this.get().locator('.ant-select-selector > .ant-select-selection-item').first().click();
async selectType({ type, first }: { type: string; first?: boolean }) {
if (first) {
await this.get().locator('.ant-select-selector > .ant-select-selection-item').first().click();
} else {
await this.get().locator('.ant-select-selector > .ant-select-selection-item').click();
}
await this.get().locator('.ant-select-selection-search-input[aria-expanded="true"]').waitFor();
await this.get().locator('.ant-select-selection-search-input[aria-expanded="true"]').fill(type);
@ -279,6 +283,7 @@ export class ColumnPageObject extends BasePage {
format,
dateFormat = '',
timeFormat = '',
selectType = false,
}: {
title: string;
type?: string;
@ -286,6 +291,7 @@ export class ColumnPageObject extends BasePage {
format?: string;
dateFormat?: string;
timeFormat?: string;
selectType?: boolean;
}) {
// when clicked on the dropdown cell header
await this.getColumnHeader(title).locator('.nc-ui-dt-dropdown').scrollIntoViewIfNeeded();
@ -294,7 +300,9 @@ export class ColumnPageObject extends BasePage {
await this.get().waitFor({ state: 'visible' });
await this.selectType({ type });
if (selectType) {
await this.selectType({ type, first: true });
}
switch (type) {
case 'Formula':

35
tests/playwright/tests/db/views/viewCalendar.spec.ts

@ -1,4 +1,4 @@
import { test } from '@playwright/test';
import { Page, test } from '@playwright/test';
import { DashboardPage } from '../../../pages/Dashboard';
import { ToolbarPage } from '../../../pages/Dashboard/common/Toolbar';
@ -45,6 +45,23 @@ test.describe('View', () => {
let dashboard: DashboardPage, toolbar: ToolbarPage, topbar: TopbarPage, calendarTopbar: CalendarTopbarPage;
let context: any;
async function undo({ page, dashboard }: { page: Page; dashboard: DashboardPage }) {
const isMac = await dashboard.grid.isMacOs();
if (validateResponse) {
await dashboard.grid.waitForResponse({
uiAction: () => page.keyboard.press(isMac ? 'Meta+z' : 'Control+z'),
httpMethodsToMatch: ['PATCH'],
requestUrlPathToMatch: `/api/v1/db/data/noco/`,
});
} else {
await page.keyboard.press(isMac ? 'Meta+z' : 'Control+z');
// allow time for undo to complete rendering
await page.waitForTimeout(500);
}
}
test.beforeEach(async ({ page }) => {
context = await setup({ page, isEmptyProject: false });
dashboard = new DashboardPage(page, context.base);
@ -255,7 +272,7 @@ test.describe('View', () => {
await dashboard.viewSidebar.deleteView({ title: 'Calendar' });
});
test('Calendar Drag and Drop & Undo Redo Operations', async () => {
test.only('Calendar Drag and Drop & Undo Redo Operations', async () => {
await dashboard.viewSidebar.createCalendarView({
title: 'Calendar',
});
@ -388,6 +405,7 @@ test.describe('View', () => {
title: 'StartDate',
type: 'Date',
dateFormat: 'YYYY-MM-DD',
selectType: true,
});
await dashboard.grid.column.save({ isUpdated: true });
@ -432,5 +450,18 @@ test.describe('View', () => {
await calendar.calendarWeekDate.selectDay({ dayIndex: 1 });
await calendar.sideMenu.verifySideBarRecords({ records: [] });
await calendar.calendarWeekDate.dragAndDrop({
record: 'Team Catchup',
dayIndex: 2,
});
await calendar.calendarWeekDate.selectDay({ dayIndex: 3 });
await calendar.calendarWeekDate.selectDay({ dayIndex: 2 });
await calendar.sideMenu.updateFilter({ filter: 'In selected date' });
await calendar.sideMenu.verifySideBarRecords({ records: ['Team Catchup'] });
});
});

Loading…
Cancel
Save