mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 07:15:36 +00:00
Merge branch 'main' into next
This commit is contained in:
commit
7d0aadcf52
@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
import { expect, test } from '@nocobase/test/e2e';
|
||||
import { dayjs } from '@nocobase/utils';
|
||||
import { subTableDefaultValue } from './templatesOfBug';
|
||||
|
||||
test.describe('subTable', () => {
|
||||
@ -18,25 +19,29 @@ test.describe('subTable', () => {
|
||||
// timeEnd: {{ $iteration.timeStart }}
|
||||
await mockPage(subTableDefaultValue).goto();
|
||||
|
||||
// 1. Click "Add new" to add a row, default values should display correctly
|
||||
// This is to handle timezone differences between CI environment and local environment
|
||||
const expectedDateBeforeModify = dayjs('2024-11-06T16:00:00.000Z').format('YYYY-MM-DD');
|
||||
const expectedDateAfterModify = '2024-11-08';
|
||||
|
||||
// 1. Click "Add new" to add a row, default values should display correctly`
|
||||
await page.getByRole('button', { name: 'Add new' }).click();
|
||||
await expect(page.getByTestId('select-object-single').getByText('Super Admin')).toBeVisible();
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-group-form-group.timeStart-').getByPlaceholder('Select date'),
|
||||
).toHaveValue('2024-11-07');
|
||||
).toHaveValue(expectedDateBeforeModify);
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-group-form-group.timeEnd-').getByPlaceholder('Select date'),
|
||||
).toHaveValue('2024-11-07');
|
||||
).toHaveValue(expectedDateBeforeModify);
|
||||
|
||||
// 2. Click "Add new" again to add another row, default values should display correctly
|
||||
await page.getByRole('button', { name: 'Add new' }).click();
|
||||
await expect(page.getByTestId('select-object-single').getByText('Super Admin').nth(1)).toBeVisible();
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-group-form-group.timeStart-').nth(1).getByPlaceholder('Select date'),
|
||||
).toHaveValue('2024-11-07');
|
||||
).toHaveValue(expectedDateBeforeModify);
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-group-form-group.timeEnd-').nth(1).getByPlaceholder('Select date'),
|
||||
).toHaveValue('2024-11-07');
|
||||
).toHaveValue(expectedDateBeforeModify);
|
||||
|
||||
// 3. After modifying timeStart in both first and second rows, their corresponding timeEnd should stay synchronized
|
||||
await page.getByPlaceholder('Select date').first().click();
|
||||
@ -47,19 +52,19 @@ test.describe('subTable', () => {
|
||||
// First row
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-group-form-group.timeStart-').nth(0).getByPlaceholder('Select date'),
|
||||
).toHaveValue('2024-11-08');
|
||||
).toHaveValue(expectedDateAfterModify);
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-group-form-group.timeEnd-').nth(0).getByPlaceholder('Select date'),
|
||||
).toHaveValue('2024-11-08');
|
||||
).toHaveValue(expectedDateAfterModify);
|
||||
await expect(page.getByTestId('select-object-single').getByText('Super Admin').nth(0)).toBeVisible();
|
||||
|
||||
// Second row
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-group-form-group.timeStart-').nth(1).getByPlaceholder('Select date'),
|
||||
).toHaveValue('2024-11-08');
|
||||
).toHaveValue(expectedDateAfterModify);
|
||||
await expect(
|
||||
page.getByLabel('block-item-CollectionField-group-form-group.timeEnd-').nth(1).getByPlaceholder('Select date'),
|
||||
).toHaveValue('2024-11-08');
|
||||
).toHaveValue(expectedDateAfterModify);
|
||||
await expect(page.getByTestId('select-object-single').getByText('Super Admin').nth(1)).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user