mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
3.0 KiB
63 lines
3.0 KiB
2 years ago
|
import { test } from '@playwright/test';
|
||
2 years ago
|
import { DashboardPage } from '../pages/Dashboard';
|
||
2 years ago
|
import { GridPage } from '../pages/Dashboard/Grid';
|
||
2 years ago
|
import setup from '../setup';
|
||
|
|
||
|
|
||
2 years ago
|
test.describe('Single select', () => {
|
||
2 years ago
|
let dashboard: DashboardPage, grid: GridPage;
|
||
|
let context: any;
|
||
|
|
||
|
test.beforeEach(async ({page}) => {
|
||
|
context = await setup({ page });
|
||
|
dashboard = new DashboardPage(page, context.project);
|
||
2 years ago
|
grid = dashboard.grid;
|
||
|
|
||
2 years ago
|
await dashboard.treeView.createTable({ title: 'sheet1' });
|
||
2 years ago
|
|
||
|
await grid.column.create({ title: 'SingleSelect', type: 'SingleSelect' });
|
||
2 years ago
|
await grid.addNewRow({index: 0, value: "Row 0"});
|
||
2 years ago
|
})
|
||
|
|
||
|
test('Select and clear options and rename options', async () => {
|
||
|
await grid.cell.selectOption.select({index: 0, columnHeader: 'SingleSelect', option: 'Option 1'});
|
||
|
await grid.cell.selectOption.verify({index: 0, columnHeader: 'SingleSelect', option: 'Option 1'});
|
||
|
|
||
|
await grid.cell.selectOption.select({index: 0, columnHeader: 'SingleSelect', option: 'Option 2'});
|
||
|
await grid.cell.selectOption.verify({index: 0, columnHeader: 'SingleSelect', option: 'Option 2'});
|
||
|
|
||
|
await grid.cell.selectOption.clear({index: 0, columnHeader: 'SingleSelect'});
|
||
|
await grid.cell.click({index: 0, columnHeader: 'SingleSelect'});
|
||
|
|
||
|
await grid.column.selectOption.addOption({index: 2, option: 'Option 3', columnTitle: 'SingleSelect'});
|
||
|
|
||
|
await grid.cell.selectOption.select({index: 0, columnHeader: 'SingleSelect', option: 'Option 3'});
|
||
|
await grid.cell.selectOption.verify({index: 0, columnHeader: 'SingleSelect', option: 'Option 3'});
|
||
|
|
||
|
await grid.column.selectOption.editOption({index: 2, columnTitle: 'SingleSelect', newOption: 'New Option 3'});
|
||
|
await grid.cell.selectOption.verify({index: 0, columnHeader: 'SingleSelect', option: 'New Option 3'});
|
||
|
|
||
|
await grid.cell.selectOption.verifyOptions({index: 0, columnHeader: 'SingleSelect', options: ['Option 1', 'Option 2', 'New Option 3']});
|
||
|
|
||
|
await grid.deleteRow(0);
|
||
|
await grid.verifyRowDoesNotExist({index: 0});
|
||
|
});
|
||
|
|
||
2 years ago
|
test('Remove a option, reorder option and delete the column', async () => {
|
||
2 years ago
|
await grid.cell.selectOption.select({index: 0, columnHeader: 'SingleSelect', option: 'Option 1'});
|
||
|
await grid.column.selectOption.addOption({index: 2, option: 'Option 3', columnTitle: 'SingleSelect'});
|
||
|
|
||
|
await grid.cell.selectOption.select({index: 0, columnHeader: 'SingleSelect', option: 'Option 3'});
|
||
|
await grid.cell.selectOption.verify({index: 0, columnHeader: 'SingleSelect', option: 'Option 3'});
|
||
|
|
||
|
await grid.column.selectOption.deleteOption({index: 2, columnTitle: 'SingleSelect'});
|
||
|
await grid.cell.selectOption.verifyNoOptionsSelected({index: 0, columnHeader: 'SingleSelect'});
|
||
|
|
||
|
await grid.column.selectOption.reorderOption({sourceOption: "Option 1", columnTitle: 'SingleSelect', destinationOption: "Option 2"});
|
||
|
await grid.cell.selectOption.verifyOptions({index: 0, columnHeader: 'SingleSelect', options: ['Option 2', 'Option 1']});
|
||
|
|
||
|
await grid.column.delete({title: 'SingleSelect'});
|
||
|
});
|
||
|
|
||
|
});
|