Browse Source

qr scanner: tests - WIP

pull/5114/head
Daniel Spaude 2 years ago
parent
commit
5c40166f6a
No known key found for this signature in database
GPG Key ID: 654A3D1FA4F35FFE
  1. 3
      packages/nc-gui/components/smartsheet/toolbar/QrScannerButton.vue
  2. 9
      tests/playwright/pages/Dashboard/FindRowByScanOverlay/index.ts
  3. 9
      tests/playwright/tests/findRowByScanner.spec.ts

3
packages/nc-gui/components/smartsheet/toolbar/QrScannerButton.vue

@ -92,7 +92,7 @@ const onDecode = async (codeValue: string) => {
</script> </script>
<template> <template>
<div class="nc-overlay-find-row-by-scan"> <div>
<a-button class="nc-btn-find-row-by-scan nc-toolbar-btn" @click="showCodeScannerOverlay = true"> <a-button class="nc-btn-find-row-by-scan nc-toolbar-btn" @click="showCodeScannerOverlay = true">
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<QrCodeScan /> <QrCodeScan />
@ -101,6 +101,7 @@ const onDecode = async (codeValue: string) => {
</a-button> </a-button>
<a-modal <a-modal
v-model:visible="showCodeScannerOverlay" v-model:visible="showCodeScannerOverlay"
class="nc-overlay-find-row-by-scan"
:closable="false" :closable="false"
width="28rem" width="28rem"
centered centered

9
tests/playwright/pages/Dashboard/FindRowByScanOverlay/index.ts

@ -23,6 +23,15 @@ export class FindRowByScanOverlay extends BasePage {
return await this.get().isVisible(); return await this.get().isVisible();
} }
async scannerScreenIsVisible() {
return await this.get().locator(`.nc-scanner-screen`).isVisible();
}
async selectColumnToScan({ columnName }: { columnName: string }) {
await this.selectColumnDropdown.click();
await this.selectColumnDropdown.selectOption({ label: columnName });
}
// async create({ title, event, url = 'http://localhost:9090/hook' }: { title: string; event: string; url?: string }) { // async create({ title, event, url = 'http://localhost:9090/hook' }: { title: string; event: string; url?: string }) {
// await this.toolbar.clickActions(); // await this.toolbar.clickActions();
// await this.toolbar.actions.click('Webhooks'); // await this.toolbar.actions.click('Webhooks');

9
tests/playwright/tests/findRowByScanner.spec.ts

@ -4,7 +4,7 @@ import { ToolbarPage } from '../pages/Dashboard/common/Toolbar';
import { FormPage } from '../pages/Dashboard/Form'; import { FormPage } from '../pages/Dashboard/Form';
import setup from '../setup'; import setup from '../setup';
test.describe.only('Find row by scanner', () => { test.describe('Find row by scanner', () => {
let dashboard: DashboardPage; let dashboard: DashboardPage;
let context: any; let context: any;
let toolbar: ToolbarPage; let toolbar: ToolbarPage;
@ -19,19 +19,12 @@ test.describe.only('Find row by scanner', () => {
test.describe('clicking on the toolbars scanner button', async () => { test.describe('clicking on the toolbars scanner button', async () => {
test.beforeEach(async () => { test.beforeEach(async () => {
// close 'Team & Auth' tab
await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'Country' }); await dashboard.treeView.openTable({ title: 'Country' });
await toolbar.clickFindRowByScanButton(); await toolbar.clickFindRowByScanButton();
}); });
test('opens the scanner overlay', async () => { test('opens the scanner overlay', async () => {
await dashboard.rootPage.pause();
expect(await dashboard.findRowByScanOverlay.isVisible()).toBeTruthy(); expect(await dashboard.findRowByScanOverlay.isVisible()).toBeTruthy();
}); });
test.describe('selecting a column', () => {
// Selecting a column
// expect that the scanner screen is visible
});
}); });
}); });

Loading…
Cancel
Save