chore: writes e2e test for duplicative base fields

This commit is contained in:
Jacob Fletcher
2023-03-07 10:29:00 -05:00
parent b92ad4a2d6
commit 5d84a98d7b
2 changed files with 28 additions and 2 deletions

View File

@@ -9,6 +9,12 @@ const RowFields: CollectionConfig = {
defaultColumns: ['title', 'id'],
},
fields: [
{
name: 'id',
label: 'Custom ID',
type: 'text',
required: true,
},
{
type: 'row',
fields: [

View File

@@ -742,8 +742,10 @@ describe('fields', () => {
await page.goto(url.create);
// fill the required fields, including the row field
const idInput = page.locator('input#field-id');
await idInput.fill('123');
const titleInput = page.locator('input#field-title');
await titleInput.fill('Test Row');
await titleInput.fill('Row 123');
await page.locator('#action-save').click();
await wait(200);
await expect(page.locator('.Toastify')).toContainText('successfully');
@@ -756,7 +758,25 @@ describe('fields', () => {
// ensure the 'title' field shows the correct value in the table cell
const titleCell = page.locator('.row-1 td.cell-title');
await expect(titleCell).toBeVisible();
await expect(titleCell).toContainText('Test Row');
await expect(titleCell).toContainText('Row 123');
});
test('should not show duplicative ID field', async () => {
await page.goto(url.create);
// fill the required fields, including the custom ID field
const idInput = page.locator('input#field-id');
await idInput.fill('456');
const titleInput = page.locator('input#field-title');
await titleInput.fill('Row 456');
await page.locator('#action-save').click();
await wait(200);
await expect(page.locator('.Toastify')).toContainText('successfully');
// ensure there are not two ID fields in the table header
await page.goto(url.list);
const idHeadings = page.locator('th#heading-id');
await expect(idHeadings).toBeVisible();
await expect(idHeadings).toHaveCount(1);
});
});
});