Browse Source

barcode column type: playwright tests (WIP)

pull/4641/head
flisowna 2 years ago
parent
commit
1994b8622b
  1. 2
      packages/nc-gui/components/smartsheet/column/BarcodeOptions.vue
  2. 25
      tests/playwright/pages/Dashboard/Grid/Column/index.ts
  3. 49
      tests/playwright/tests/columnBarcode.spec.ts

2
packages/nc-gui/components/smartsheet/column/BarcodeOptions.vue

@ -86,7 +86,7 @@ vModel.value.meta = {
/> />
</a-form-item> </a-form-item>
<a-form-item <a-form-item
class="flex w-1/2 pb-2 nc-code-value-column-select" class="flex w-1/2 pb-2 nc-barcode-format-select"
:label="$t('labels.barcodeFormat')" :label="$t('labels.barcodeFormat')"
v-bind="validateInfos.barcode_format" v-bind="validateInfos.barcode_format"
> >

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

@ -112,6 +112,12 @@ export class ColumnPageObject extends BasePage {
hasText: new RegExp(`^${barcodeValueColumnTitle}$`), hasText: new RegExp(`^${barcodeValueColumnTitle}$`),
}) })
.click(); .click();
// await this.get().locator('.ant-select-single').nth(2).click();
// await this.rootPage
// .locator(`.ant-select-item`, {
// hasText: new RegExp(`^${barcodeFormat}$`),
// })
// .click();
break; break;
case 'Lookup': case 'Lookup':
await this.get().locator('.ant-select-single').nth(1).click(); await this.get().locator('.ant-select-single').nth(1).click();
@ -229,6 +235,17 @@ export class ColumnPageObject extends BasePage {
await this.save(); await this.save();
} }
async changeBarcodeFormat({ barcodeFormatName }: { barcodeFormatName: string }) {
await this.get().locator('.nc-barcode-format-select .ant-select-single').click();
await this.rootPage
.locator(`.ant-select-item`, {
hasText: barcodeFormatName,
})
.click();
await this.save();
}
async delete({ title }: { title: string }) { async delete({ title }: { title: string }) {
await this.getColumnHeader(title).locator('svg.ant-dropdown-trigger').click(); await this.getColumnHeader(title).locator('svg.ant-dropdown-trigger').click();
// await this.rootPage.locator('li[role="menuitem"]:has-text("Delete")').waitFor(); // await this.rootPage.locator('li[role="menuitem"]:has-text("Delete")').waitFor();
@ -268,6 +285,14 @@ export class ColumnPageObject extends BasePage {
}) })
.click(); .click();
break; break;
// case 'Barcode':
// await this.get().locator('.ant-select-single').nth(1).click();
// await this.rootPage
// .locator(`.ant-select-item`, {
// hasText: format,
// })
// .click();
// break;
default: default:
break; break;
} }

49
tests/playwright/tests/columnBarcode.spec.ts

@ -124,9 +124,54 @@ test.describe('Virtual Columns', () => {
await dashboard.closeTab({ title: 'City' }); await dashboard.closeTab({ title: 'City' });
}); });
test('deletion of the barcode column: directly and indirectly when the reference value column is deleted', async () => {}); test('deletion of the barcode column: directly and indirectly when the reference value column is deleted', async () => {
await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'City' });
await grid.column.create({ title: 'column_name_a' });
await grid.column.verify({ title: 'column_name_a' });
await grid.column.create({
title: 'Barcode2',
type: 'Barcode',
barcodeValueColumnTitle: 'column_name_a',
});
await grid.column.verify({ title: 'Barcode2', isVisible: true });
await grid.column.delete({ title: 'Barcode2' });
await grid.column.verify({ title: 'Barcode2', isVisible: false });
test('changing the format of the Barcode is reflected in the change of the actual rendered barcode', async () => {}); await grid.column.create({
title: 'Barcode2',
type: 'Barcode',
barcodeValueColumnTitle: 'column_name_a',
});
await grid.column.verify({ title: 'Barcode2', isVisible: true });
await grid.column.delete({ title: 'column_name_a' });
await grid.column.verify({ title: 'Barcode2', isVisible: false });
await dashboard.closeTab({ title: 'City' });
});
test('changing the format of the Barcode is reflected in the change of the actual rendered barcode', async () => {
await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'City' });
await grid.column.create({ title: 'column_name_b' });
await grid.column.verify({ title: 'column_name_b' });
await grid.column.create({
title: 'Barcode3',
type: 'Barcode',
barcodeValueColumnTitle: 'column_name_b',
barcodeFormat: 'CODE128',
});
await grid.column.openEdit({
title: 'Barcode3',
type: 'Barcode',
});
await grid.column.changeBarcodeFormat({ barcodeFormatName: 'CODE39' });
});
test('barcode cells with invalid input for the choosen barcode format are showing a replacement message', async () => {}); test('barcode cells with invalid input for the choosen barcode format are showing a replacement message', async () => {});
}); });

Loading…
Cancel
Save