多维表格
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.

974 lines
32 KiB

import { expect, Locator } from '@playwright/test';
import { StringValidationType, UITypes } from 'nocodb-sdk';
import { DashboardPage } from '..';
import BasePage from '../../Base';
import { ToolbarPage } from '../common/Toolbar';
feat: Improved UI (#6222) * feat: Improved ui (#6156) * refactor: revert Signed-off-by: Pranav C <pranavxc@gmail.com> feat: shared base Signed-off-by: Pranav C <pranavxc@gmail.com> fix: remove duplicate import statement Signed-off-by: Pranav C <pranavxc@gmail.com> fix: disable starred & license menu Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix airtable wait issue Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable mysql in ci Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix checkbox order for sqlite Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: disable quick tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix dbType env variable for CI Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: workspace API access error fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable SQLite CI CD Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: use DB_TYPE env variable Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable SQLite UT Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: isHub cleanup Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: add check for EE Timezone spec Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: cleanup Signed-off-by: Pranav C <pranavxc@gmail.com> chore: cleanup Signed-off-by: Pranav C <pranavxc@gmail.com> test: EE check fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: test correction Signed-off-by: Pranav C <pranavxc@gmail.com> chore: sync latest changes Signed-off-by: Pranav C <pranavxc@gmail.com> test: set EE=false Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: set NC Edition to community in workflow file Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: update sdk build command Signed-off-by: Pranav C <pranavxc@gmail.com> refactor: i18n and other changes Signed-off-by: Pranav C <pranavxc@gmail.com> feat: new ui Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: sync tests Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: lint Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: shared view/base related bugs Signed-off-by: Pranav C <pranavxc@gmail.com> * test: checkbox verification sort order fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix sqlite reset Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable selfhosted runners Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: table ops (draft) Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * Docs: screenshots for table-operations.md * refactor: introduce missing buttons Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: get all fields Signed-off-by: Pranav C <pranavxc@gmail.com> * test: UT fix- new data API response Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: EE is false Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: webhook lookup as string in CE Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: include created_at and updated_at Signed-off-by: Pranav C <pranavxc@gmail.com> * test: fix UT newDataAPI response for PG Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: separate api for webhook related plugins Signed-off-by: Pranav C <pranavxc@gmail.com> * test: msyql filter corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: mysql group by test corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix datatype for rating field in groupby spec for pg Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: kanban datatype correction Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: column edit for mysql- rating field Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: misc fixes Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable 4 workers Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable 2 workers per shard only Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: table CRUD * Rename table-operations.md to table-crud.md * Create column-crud.md * docs: row CRUD * Rename row.md to row-crud.md * docs: project crud * docs: toolbar (skeleton) * refactor: single page UI and bug fixes Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: sync tests playwright Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: add missing dependency Signed-off-by: Pranav C <pranavxc@gmail.com> * feat: single page ui, test corrections Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: tests Signed-off-by: Pranav C <pranavxc@gmail.com> * test: project rename test correction Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: remove only Signed-off-by: Pranav C <pranavxc@gmail.com> * test: remove wrong import statement Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: delete option not visible in project context menu Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: move ws access within isEE() Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix groupby * test: groupby fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: signup & landing page * docs: project crud * docs: project-crud misc * docs: toolbar fields * docs: toolbar / filters * docs: toolbar / group by * docs: toolbar / sort * docs: toolbar / row height * docs: filters additional options * docs: file re-order Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: add links to column types * docs: code snippets * docs: links * docs: lookup * docs: rollup * docs: formula * docs: primary key * docs: display value * docs: development setup * docs: swagger * fix(nc-gui): encodeURIComponent for row id - closes: #6202 * docs: language * docs: expanded record * docs: import airtable * docs: airtable * docs: webhook * docs: revert file rename Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: account settings * docs: audit * docs: meta management * docs: project settings * docs: shared base * docs: shared view * docs: meta sync * docs: team-auth * docs: views * docs: fix URL * docs: URL corrections * fix: shared base, view related bugs Signed-off-by: Pranav C <pranavxc@gmail.com> * test: EE check for WSaccess Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: exclude EE tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: missing project delete closes #6215 Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: merge existing project meta if found closes #6216 Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: merge existing project meta if found closes #6216 Signed-off-by: Pranav C <pranavxc@gmail.com> --------- Signed-off-by: Pranav C <pranavxc@gmail.com> Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com> Co-authored-by: Wing-Kam Wong <wingkwong.code@gmail.com> * refactor: docs and other bug fixes Signed-off-by: Pranav C <pranavxc@gmail.com> * feat: populate default project on super admin signup Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: include created project details in signup response if avail, missing Dockerfile Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: use custom function for resolving ts path aliases Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: add missing generate script Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: webpack build correction - ts path resolve Signed-off-by: Pranav C <pranavxc@gmail.com> --------- Signed-off-by: Pranav C <pranavxc@gmail.com> Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: mertmit <mertmit99@gmail.com> Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com> Co-authored-by: Wing-Kam Wong <wingkwong.code@gmail.com>
1 year ago
import { TopbarPage } from '../common/Topbar';
export class FormPage extends BasePage {
readonly dashboard: DashboardPage;
readonly toolbar: ToolbarPage;
feat: Improved UI (#6222) * feat: Improved ui (#6156) * refactor: revert Signed-off-by: Pranav C <pranavxc@gmail.com> feat: shared base Signed-off-by: Pranav C <pranavxc@gmail.com> fix: remove duplicate import statement Signed-off-by: Pranav C <pranavxc@gmail.com> fix: disable starred & license menu Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix airtable wait issue Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable mysql in ci Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix checkbox order for sqlite Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: disable quick tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix dbType env variable for CI Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: workspace API access error fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable SQLite CI CD Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: use DB_TYPE env variable Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable SQLite UT Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: isHub cleanup Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: add check for EE Timezone spec Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: cleanup Signed-off-by: Pranav C <pranavxc@gmail.com> chore: cleanup Signed-off-by: Pranav C <pranavxc@gmail.com> test: EE check fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: test correction Signed-off-by: Pranav C <pranavxc@gmail.com> chore: sync latest changes Signed-off-by: Pranav C <pranavxc@gmail.com> test: set EE=false Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: set NC Edition to community in workflow file Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: update sdk build command Signed-off-by: Pranav C <pranavxc@gmail.com> refactor: i18n and other changes Signed-off-by: Pranav C <pranavxc@gmail.com> feat: new ui Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: sync tests Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: lint Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: shared view/base related bugs Signed-off-by: Pranav C <pranavxc@gmail.com> * test: checkbox verification sort order fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix sqlite reset Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable selfhosted runners Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: table ops (draft) Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * Docs: screenshots for table-operations.md * refactor: introduce missing buttons Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: get all fields Signed-off-by: Pranav C <pranavxc@gmail.com> * test: UT fix- new data API response Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: EE is false Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: webhook lookup as string in CE Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: include created_at and updated_at Signed-off-by: Pranav C <pranavxc@gmail.com> * test: fix UT newDataAPI response for PG Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: separate api for webhook related plugins Signed-off-by: Pranav C <pranavxc@gmail.com> * test: msyql filter corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: mysql group by test corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix datatype for rating field in groupby spec for pg Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: kanban datatype correction Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: column edit for mysql- rating field Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: misc fixes Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable 4 workers Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable 2 workers per shard only Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: table CRUD * Rename table-operations.md to table-crud.md * Create column-crud.md * docs: row CRUD * Rename row.md to row-crud.md * docs: project crud * docs: toolbar (skeleton) * refactor: single page UI and bug fixes Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: sync tests playwright Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: add missing dependency Signed-off-by: Pranav C <pranavxc@gmail.com> * feat: single page ui, test corrections Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: tests Signed-off-by: Pranav C <pranavxc@gmail.com> * test: project rename test correction Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: remove only Signed-off-by: Pranav C <pranavxc@gmail.com> * test: remove wrong import statement Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: delete option not visible in project context menu Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: move ws access within isEE() Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix groupby * test: groupby fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: signup & landing page * docs: project crud * docs: project-crud misc * docs: toolbar fields * docs: toolbar / filters * docs: toolbar / group by * docs: toolbar / sort * docs: toolbar / row height * docs: filters additional options * docs: file re-order Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: add links to column types * docs: code snippets * docs: links * docs: lookup * docs: rollup * docs: formula * docs: primary key * docs: display value * docs: development setup * docs: swagger * fix(nc-gui): encodeURIComponent for row id - closes: #6202 * docs: language * docs: expanded record * docs: import airtable * docs: airtable * docs: webhook * docs: revert file rename Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: account settings * docs: audit * docs: meta management * docs: project settings * docs: shared base * docs: shared view * docs: meta sync * docs: team-auth * docs: views * docs: fix URL * docs: URL corrections * fix: shared base, view related bugs Signed-off-by: Pranav C <pranavxc@gmail.com> * test: EE check for WSaccess Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: exclude EE tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: missing project delete closes #6215 Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: merge existing project meta if found closes #6216 Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: merge existing project meta if found closes #6216 Signed-off-by: Pranav C <pranavxc@gmail.com> --------- Signed-off-by: Pranav C <pranavxc@gmail.com> Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com> Co-authored-by: Wing-Kam Wong <wingkwong.code@gmail.com> * refactor: docs and other bug fixes Signed-off-by: Pranav C <pranavxc@gmail.com> * feat: populate default project on super admin signup Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: include created project details in signup response if avail, missing Dockerfile Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: use custom function for resolving ts path aliases Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: add missing generate script Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: webpack build correction - ts path resolve Signed-off-by: Pranav C <pranavxc@gmail.com> --------- Signed-off-by: Pranav C <pranavxc@gmail.com> Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: mertmit <mertmit99@gmail.com> Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com> Co-authored-by: Wing-Kam Wong <wingkwong.code@gmail.com>
1 year ago
readonly topbar: TopbarPage;
// todo: All the locator should be private
readonly addOrRemoveAllButton: Locator;
readonly submitButton: Locator;
readonly showAnotherFormRadioButton: Locator;
readonly showAnotherFormAfter5SecRadioButton: Locator;
readonly emailMeRadioButton: Locator;
readonly formHeading: Locator;
readonly formSubHeading: Locator;
readonly afterSubmitMsg: Locator;
readonly formFields: Locator;
// validation
readonly fieldPanel: Locator;
readonly customValidationBtn: Locator;
readonly customValidationDropdown: Locator;
constructor(dashboard: DashboardPage) {
super(dashboard.rootPage);
this.dashboard = dashboard;
this.toolbar = new ToolbarPage(this);
feat: Improved UI (#6222) * feat: Improved ui (#6156) * refactor: revert Signed-off-by: Pranav C <pranavxc@gmail.com> feat: shared base Signed-off-by: Pranav C <pranavxc@gmail.com> fix: remove duplicate import statement Signed-off-by: Pranav C <pranavxc@gmail.com> fix: disable starred & license menu Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix airtable wait issue Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable mysql in ci Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix checkbox order for sqlite Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: disable quick tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix dbType env variable for CI Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: workspace API access error fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable SQLite CI CD Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: use DB_TYPE env variable Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable SQLite UT Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: isHub cleanup Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: add check for EE Timezone spec Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: cleanup Signed-off-by: Pranav C <pranavxc@gmail.com> chore: cleanup Signed-off-by: Pranav C <pranavxc@gmail.com> test: EE check fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: test correction Signed-off-by: Pranav C <pranavxc@gmail.com> chore: sync latest changes Signed-off-by: Pranav C <pranavxc@gmail.com> test: set EE=false Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: set NC Edition to community in workflow file Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: update sdk build command Signed-off-by: Pranav C <pranavxc@gmail.com> refactor: i18n and other changes Signed-off-by: Pranav C <pranavxc@gmail.com> feat: new ui Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: sync tests Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: lint Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: shared view/base related bugs Signed-off-by: Pranav C <pranavxc@gmail.com> * test: checkbox verification sort order fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix sqlite reset Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable selfhosted runners Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: table ops (draft) Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * Docs: screenshots for table-operations.md * refactor: introduce missing buttons Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: get all fields Signed-off-by: Pranav C <pranavxc@gmail.com> * test: UT fix- new data API response Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: EE is false Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: webhook lookup as string in CE Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: include created_at and updated_at Signed-off-by: Pranav C <pranavxc@gmail.com> * test: fix UT newDataAPI response for PG Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: separate api for webhook related plugins Signed-off-by: Pranav C <pranavxc@gmail.com> * test: msyql filter corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: mysql group by test corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix datatype for rating field in groupby spec for pg Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: kanban datatype correction Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: column edit for mysql- rating field Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: misc fixes Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable 4 workers Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable 2 workers per shard only Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: table CRUD * Rename table-operations.md to table-crud.md * Create column-crud.md * docs: row CRUD * Rename row.md to row-crud.md * docs: project crud * docs: toolbar (skeleton) * refactor: single page UI and bug fixes Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: sync tests playwright Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: add missing dependency Signed-off-by: Pranav C <pranavxc@gmail.com> * feat: single page ui, test corrections Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: tests Signed-off-by: Pranav C <pranavxc@gmail.com> * test: project rename test correction Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: remove only Signed-off-by: Pranav C <pranavxc@gmail.com> * test: remove wrong import statement Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: delete option not visible in project context menu Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: move ws access within isEE() Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix groupby * test: groupby fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: signup & landing page * docs: project crud * docs: project-crud misc * docs: toolbar fields * docs: toolbar / filters * docs: toolbar / group by * docs: toolbar / sort * docs: toolbar / row height * docs: filters additional options * docs: file re-order Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: add links to column types * docs: code snippets * docs: links * docs: lookup * docs: rollup * docs: formula * docs: primary key * docs: display value * docs: development setup * docs: swagger * fix(nc-gui): encodeURIComponent for row id - closes: #6202 * docs: language * docs: expanded record * docs: import airtable * docs: airtable * docs: webhook * docs: revert file rename Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: account settings * docs: audit * docs: meta management * docs: project settings * docs: shared base * docs: shared view * docs: meta sync * docs: team-auth * docs: views * docs: fix URL * docs: URL corrections * fix: shared base, view related bugs Signed-off-by: Pranav C <pranavxc@gmail.com> * test: EE check for WSaccess Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: exclude EE tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: missing project delete closes #6215 Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: merge existing project meta if found closes #6216 Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: merge existing project meta if found closes #6216 Signed-off-by: Pranav C <pranavxc@gmail.com> --------- Signed-off-by: Pranav C <pranavxc@gmail.com> Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com> Co-authored-by: Wing-Kam Wong <wingkwong.code@gmail.com> * refactor: docs and other bug fixes Signed-off-by: Pranav C <pranavxc@gmail.com> * feat: populate default project on super admin signup Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: include created project details in signup response if avail, missing Dockerfile Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: use custom function for resolving ts path aliases Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: add missing generate script Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: webpack build correction - ts path resolve Signed-off-by: Pranav C <pranavxc@gmail.com> --------- Signed-off-by: Pranav C <pranavxc@gmail.com> Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: mertmit <mertmit99@gmail.com> Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com> Co-authored-by: Wing-Kam Wong <wingkwong.code@gmail.com>
1 year ago
this.topbar = new TopbarPage(this);
this.addOrRemoveAllButton = dashboard
.get()
.locator('[data-testid="nc-form-show-all-fields"]')
.locator('.nc-switch');
this.submitButton = dashboard.get().locator('[data-testid="nc-form-submit"]');
this.showAnotherFormRadioButton = dashboard.get().locator('[data-testid="nc-form-checkbox-submit-another-form"]');
this.showAnotherFormAfter5SecRadioButton = dashboard
.get()
.locator('[data-testid="nc-form-checkbox-show-blank-form"]');
this.emailMeRadioButton = dashboard.get().locator('[data-testid="nc-form-checkbox-send-email"]');
this.formHeading = dashboard.get().locator('[data-testid="nc-form-heading"]');
this.formSubHeading = dashboard.get().locator('[data-testid="nc-form-sub-heading"] .tiptap.ProseMirror');
this.afterSubmitMsg = dashboard.get().locator('[data-testid="nc-form-after-submit-msg"] .tiptap.ProseMirror');
this.formFields = dashboard.get().locator('.nc-form-fields-list');
// validation
this.fieldPanel = dashboard.get().locator('.nc-form-field-right-panel');
this.customValidationBtn = this.fieldPanel.locator('.nc-custom-validation-btn');
this.customValidationDropdown = this.rootPage.locator('.nc-custom-validator-dropdown');
}
get() {
return this.dashboard.get().locator('[data-testid="nc-form-wrapper"]');
}
getFormAfterSubmit() {
return this.dashboard.get().locator('[data-testid="nc-form-wrapper-submit"]');
}
getFormFields() {
return this.get().locator('[data-testid="nc-form-fields"]');
}
getFormFieldsRequired() {
Nc feat/form view builder field settings in right pannel and fixed column delete modal virtual cell icon issue (#7927) * feat(nc-gui): form field in right pannel setup * fix(nc-gui): inline form field reorder issue * fix(nc-gui): make edit form field right panel scrollable * fix(nc-gui): form field limit option hide btn focus box shadow style issue * fix(nc-gui): add support to edit form column in form view builder * feat(nc-gui): added form field header menu dropdown * fix(nc-gui): tab issue in form builder * feat(nc-gui): add support to edit column from form builder itself * fix(nc-gui): wrong virtual cell icon in column delete modal * feat(nc-gui): column edit, hide, delete option in form builder field settings * fix(nc-gui): move all form field settings radio btns to the right side * chore(nc-gui): lint * chore(nc-gui): lint errors * chore(nc-gui): lint * fix(nc-gui): update 'change icon color' text case * fix(nc-gui): small changes * fix(nc-gui): form builder side panel field div key issue * fix(nc-gui): form view outsideclick fild toggle issue * chore(nc-gui): lint * fix(nc-gui): hide select dropdown in value is selected and show if value is not selected * fix(nc-gui): suggested review changes * fix(nc-gui): make form field rich text options sticky at bottom * chore(nc-gui): lint * fix(nc-gui): small changes * fix(nc-gui): lazy import richtext component * fix(nc-gui): set the max height for form rich text fields * fix(nc-gui): move form settings switch inputs to the right side * fix(nc-gui): move form select type field layout option to appearance settings section * fix(nc-gui): select form active field text on focus * fix(nc-gui): form rich text element menu option tabindex issue * fix(nc-gui): form search field input autofill issue * fix(nc-gui): update position of rich text menu option of form description * feat(nc-gui): adjustable form view sidebar width * chore(nc-gui): lint * fix(nc-gui): typo mistake * fix(nc-gui): PR review changes
8 months ago
return this.get().locator('[data-testid="nc-form-input-required"]');
}
getFormFieldsInputLabel() {
return this.get().locator('textarea[data-testid="nc-form-input-label"]:visible');
}
getFormFieldsInputHelpText() {
return this.get().locator('[data-testid="nc-form-input-help-text"] .tiptap.ProseMirror:visible');
}
async verifyFormFieldLabel({ index, label }: { index: number; label: string }) {
await expect(this.getFormFields().nth(index).locator('[data-testid="nc-form-input-label"]')).toContainText(label);
}
async verifyFormFieldHelpText({ index, helpText }: { index: number; helpText: string }) {
await expect(this.getFormFields().nth(index).locator('[data-testid="nc-form-help-text"]')).toContainText(helpText);
}
async verifyFieldsIsEditable({ index }: { index: number }) {
await expect(this.getFormFields().nth(index)).toHaveClass(/nc-editable/);
}
async verifyAfterSubmitMsg({ msg }: { msg: string }) {
expect((await this.afterSubmitMsg.textContent()).includes(msg)).toBeTruthy();
}
async verifyFormViewFieldsOrder({ fields }: { fields: string[] }) {
const fieldLabels = this.get().locator('[data-testid="nc-form-input-label"]');
await expect(fieldLabels).toHaveCount(fields.length);
for (let i = 0; i < fields.length; i++) {
await expect(fieldLabels.nth(i)).toContainText(fields[i]);
}
}
async reorderFields({ sourceField, destinationField }: { sourceField: string; destinationField: string }) {
// TODO: Otherwise form input boxes are not visible sometimes
await this.rootPage.waitForTimeout(650);
await expect(this.get().locator(`.nc-form-drag-${sourceField}`)).toBeVisible();
await expect(this.get().locator(`.nc-form-drag-${destinationField}`)).toBeVisible();
const src = this.get().locator(`.nc-form-drag-${sourceField.replace(' ', '')}`);
const dst = this.get().locator(`.nc-form-drag-${destinationField.replace(' ', '')}`);
await src.dragTo(dst);
}
async removeField({ field, mode }: { mode: 'dragDrop' | 'hideField'; field: string }) {
// TODO: Otherwise form input boxes are not visible sometimes
await this.rootPage.waitForTimeout(650);
if (mode === 'dragDrop') {
const src = this.get().locator(`.nc-form-drag-${field.replace(' ', '')}`);
const dst = this.get().locator(`[data-testid="nc-drag-n-drop-to-hide"]`);
await src.dragTo(dst);
} else if (mode === 'hideField') {
// in form-v2, hide field will be using right sidebar
await this.formFields.locator(`[data-testid="nc-form-field-item-${field}"]`).locator('.nc-switch').click();
}
}
async addField({ field, mode }: { mode: string; field: string }) {
// TODO: Otherwise form input boxes are not visible sometimes
await this.rootPage.waitForTimeout(650);
if (mode === 'dragDrop') {
const src = this.get().locator(`[data-testid="nc-form-hidden-column-${field}"] > div.ant-card-body`);
const dst = this.get().locator(`[data-testid="nc-form-input-Country"]`);
await src.waitFor({ state: 'visible' });
await dst.waitFor({ state: 'visible' });
await src.dragTo(dst, { trial: true });
await src.dragTo(dst);
} else if (mode === 'clickField') {
await this.formFields.locator(`[data-testid="nc-form-field-item-${field}"]`).locator('.nc-switch').click();
}
}
async removeAllFields() {
if (await this.addOrRemoveAllButton.isChecked()) {
await this.addOrRemoveAllButton.click();
} else {
await this.addOrRemoveAllButton.click();
await this.addOrRemoveAllButton.click();
}
}
async addAllFields() {
if (!(await this.addOrRemoveAllButton.isChecked())) {
await this.addOrRemoveAllButton.click();
}
}
async configureHeader(param: { subtitle: string; title: string }) {
await this.waitForResponse({
uiAction: async () => {
await this.formHeading.click();
await this.formHeading.fill(param.title);
await this.formSubHeading.click();
},
requestUrlPathToMatch: '/api/v1/db/meta/forms',
httpMethodsToMatch: ['PATCH'],
});
await this.waitForResponse({
uiAction: async () => {
await this.formSubHeading.click();
await this.formSubHeading.fill(param.subtitle);
await this.formHeading.click();
},
requestUrlPathToMatch: '/api/v1/db/meta/forms',
httpMethodsToMatch: ['PATCH'],
});
}
async verifyHeader(param: { subtitle: string; title: string }) {
await expect.poll(async () => await this.formHeading.inputValue()).toBe(param.title);
await expect.poll(async () => await this.formSubHeading.textContent()).toBe(param.subtitle);
}
async fillForm(param: { field: string; value: string; type?: UITypes }[]) {
for (let i = 0; i < param.length; i++) {
await this.get()
.locator(`[data-testid="nc-form-input-${param[i].field.replace(' ', '')}"]`)
.click();
switch (param[i].type) {
case UITypes.LongText: {
await this.get()
.locator(`[data-testid="nc-form-input-${param[i].field.replace(' ', '')}"] >> textarea`)
.fill(param[i].value);
break;
}
default: {
await this.get()
.locator(`[data-testid="nc-form-input-${param[i].field.replace(' ', '')}"] >> input`)
.fill(param[i].value);
if ([UITypes.Date, UITypes.Time, UITypes.Year, UITypes.DateTime].includes(param[i].type)) {
await this.rootPage.keyboard.press('Enter');
}
await this.getVisibleField({ title: param[i].field }).click();
}
}
await this.rootPage.waitForTimeout(200);
}
}
getVisibleField({ title }: { title: string }) {
return this.get()
.locator(`.nc-form-drag-${title.replace(' ', '')}`)
.locator('[data-testid="nc-form-input-label"]');
}
async selectVisibleField({ title }: { title: string }) {
const field = this.getVisibleField({ title });
await field.scrollIntoViewIfNeeded();
await field.click();
// Wait for field settings right pannel
await this.fieldPanel.waitFor({ state: 'visible' });
}
async configureField({
field,
required,
label,
helpText,
}: {
field: string;
required: boolean;
label: string;
helpText: string;
}) {
const waitForResponse = async (action: () => Promise<any>) =>
await this.waitForResponse({
uiAction: action,
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
await this.selectVisibleField({ title: field });
await waitForResponse(() => this.getFormFieldsInputLabel().fill(label));
await waitForResponse(() => this.getFormFieldsInputHelpText().fill(helpText));
if (required) {
await waitForResponse(() => this.getFormFieldsRequired().click());
}
await this.formHeading.click();
}
async verifyField({
field,
required,
label,
helpText,
}: {
field: string;
required: boolean;
label: string;
helpText: string;
}) {
let expectText = '';
if (required) expectText = label + ' *';
else expectText = label;
const fieldLabel = this.getVisibleField({ title: field });
await fieldLabel.scrollIntoViewIfNeeded();
await expect(fieldLabel).toHaveText(expectText);
const fieldHelpText = this.get()
.locator(`.nc-form-drag-${field.replace(' ', '')}`)
.locator('div[data-testid="nc-form-input-help-text-label"] .tiptap.ProseMirror');
await expect(fieldHelpText).toHaveText(helpText);
}
async submitForm() {
await this.submitButton.click();
}
async verifyStatePostSubmit(param: { message?: string; submitAnotherForm?: boolean; showBlankForm?: boolean }) {
await this.rootPage.locator('.nc-form-success-msg').waitFor({ state: 'visible' });
if (undefined !== param.message) {
await expect(this.getFormAfterSubmit()).toContainText(param.message);
}
if (true === param.submitAnotherForm) {
await expect(this.getFormAfterSubmit().locator('button:has-text("Submit Another Form")')).toBeVisible();
}
if (true === param.showBlankForm) {
await this.get().waitFor();
}
}
async configureSubmitMessage(param: { message: string }) {
await this.waitForResponse({
uiAction: async () => {
await this.afterSubmitMsg.click();
await this.afterSubmitMsg.fill(param.message);
},
requestUrlPathToMatch: '/api/v1/db/meta/forms',
httpMethodsToMatch: ['PATCH'],
});
}
submitAnotherForm() {
return this.getFormAfterSubmit().locator('button:has-text("Submit Another Form")');
}
// todo: Wait for render to complete
async waitLoading() {
await this.rootPage.waitForTimeout(1000);
}
async verifyAfterSubmitMenuState(param: { showBlankForm?: boolean; submitAnotherForm?: boolean; emailMe?: boolean }) {
if (true === param.showBlankForm) {
await expect(
this.get().locator('[data-testid="nc-form-checkbox-show-blank-form"][aria-checked="true"]')
).toBeVisible();
}
if (true === param.submitAnotherForm) {
await expect(
this.get().locator('[data-testid="nc-form-checkbox-submit-another-form"][aria-checked="true"]')
).toBeVisible();
}
if (true === param.emailMe) {
await expect(
this.get().locator('[data-testid="nc-form-checkbox-send-email"][aria-checked="true"]')
).toBeVisible();
}
}
async getCustomValidationTypeOption({
type,
currValItem,
index,
}: {
type: StringValidationType;
currValItem: Locator;
index: number;
}) {
await currValItem.locator('.nc-custom-validation-type-selector .ant-select-selector').click();
const typeSelectorDropdown = this.rootPage.locator(`.nc-custom-validation-type-dropdown-${index}`);
await typeSelectorDropdown.waitFor();
const option = typeSelectorDropdown.getByTestId(`nc-custom-validation-type-option-${type}`);
await option.scrollIntoViewIfNeeded();
return {
option: this.rootPage.getByTestId(`nc-custom-validation-type-option-${type}`),
select: async () => {
await option.click();
await typeSelectorDropdown.waitFor({ state: 'hidden' });
},
closeSelector: async () =>
await currValItem.locator('.nc-custom-validation-type-selector .ant-select-selector').click(),
verify: async ({ isDisabled = false }: { isDisabled: boolean }) => {
if (isDisabled) {
await expect(option).toHaveClass(/ant-select-item-option-disabled/);
} else {
await expect(option).not.toHaveClass(/ant-select-item-option-disabled/);
}
},
};
}
async addCustomValidation({
type,
value,
errorMsg,
index,
}: {
type: StringValidationType;
value: string;
errorMsg?: string;
index: number;
}) {
await this.customValidationBtn.waitFor({ state: 'visible' });
await this.customValidationBtn.click();
const dropdown = this.customValidationDropdown;
await dropdown.waitFor({ state: 'visible' });
await dropdown.locator('.nc-custom-validation-add-btn').click();
const currValItem = this.customValidationDropdown.getByTestId(`nc-custom-validation-item-${index}`);
await currValItem.waitFor({ state: 'visible' });
// Select type
const { select } = await this.getCustomValidationTypeOption({ type, currValItem, index });
await select();
// add value
const valValueInput = currValItem.locator('.custom-validation-input >> input');
await valValueInput.click();
await valValueInput.fill(value);
if (errorMsg !== undefined) {
const valErrorMsgInput = currValItem.locator('.nc-custom-validation-error-message-input');
await valErrorMsgInput.click();
await valErrorMsgInput.fill(errorMsg);
}
//close dropdown
await this.customValidationBtn.click();
await dropdown.waitFor({ state: 'hidden' });
}
async updateCustomValidation({
type,
value,
errorMsg,
index,
}: {
type?: StringValidationType;
value?: string;
errorMsg?: string;
index: number;
}) {
await this.customValidationBtn.waitFor({ state: 'visible' });
await this.customValidationBtn.click();
const dropdown = this.customValidationDropdown;
await dropdown.waitFor({ state: 'visible' });
const currValItem = this.customValidationDropdown.getByTestId(`nc-custom-validation-item-${index}`);
await currValItem.waitFor({ state: 'visible' });
if (type) {
// Select type
const { select } = await this.getCustomValidationTypeOption({ type, currValItem, index });
await select();
}
// update value
if (value !== undefined) {
const valValueInput = currValItem.locator('.custom-validation-input >> input');
await valValueInput.click();
await valValueInput.fill(value);
}
if (errorMsg !== undefined) {
const valErrorMsgInput = currValItem.locator('.nc-custom-validation-error-message-input');
await valErrorMsgInput.click();
await valErrorMsgInput.fill(errorMsg);
}
//close dropdown
await this.customValidationBtn.click();
await dropdown.waitFor({ state: 'hidden' });
}
async verifyCustomValidationSelector({
type,
value: _value,
errorMsg: _errorMsg,
index,
}: {
type: StringValidationType;
value?: string;
errorMsg?: string;
index: number;
}) {
await this.customValidationBtn.waitFor({ state: 'visible' });
await this.customValidationBtn.click();
const dropdown = this.customValidationDropdown;
await dropdown.waitFor({ state: 'visible' });
const currValItem = this.customValidationDropdown.getByTestId(`nc-custom-validation-item-${index}`);
await currValItem.waitFor({ state: 'visible' });
const { verify } = await this.getCustomValidationTypeOption({
type,
currValItem,
index,
});
await verify({ isDisabled: true });
//close dropdown
await this.customValidationBtn.click();
await dropdown.waitFor({ state: 'hidden' });
}
async verifyCustomValidationValue({ value, hasError, index }: { value?: string; hasError?: boolean; index: number }) {
await this.customValidationBtn.waitFor({ state: 'visible' });
await this.customValidationBtn.click();
const dropdown = this.customValidationDropdown;
await dropdown.waitFor({ state: 'visible' });
const currValItem = this.customValidationDropdown.getByTestId(`nc-custom-validation-item-${index}`);
await currValItem.waitFor({ state: 'visible' });
// value
if (value !== undefined) {
const valValueInput = currValItem.locator('.custom-validation-input >> input');
await expect(valValueInput).toHaveValue(value);
}
if (hasError) {
const valValueErr = currValItem.locator(
'.nc-custom-validation-input-wrapper .nc-custom-validation-item-error-icon'
);
await expect(valValueErr).toBeVisible();
}
//close dropdown
await this.customValidationBtn.click();
await dropdown.waitFor({ state: 'hidden' });
}
async removeCustomValidationItem({ index }: { index: number }) {
await this.customValidationBtn.waitFor({ state: 'visible' });
await this.customValidationBtn.click();
const dropdown = this.customValidationDropdown;
await dropdown.waitFor({ state: 'visible' });
const currValItem = this.customValidationDropdown.getByTestId(`nc-custom-validation-item-${index}`);
await currValItem.waitFor({ state: 'visible' });
await currValItem.locator('.nc-custom-validation-delete-item').click();
await currValItem.waitFor({ state: 'hidden' });
//close dropdown
await this.customValidationBtn.click();
await dropdown.waitFor({ state: 'hidden' });
}
async verifyCustomValidationCount({ count }: { count: number }) {
await this.customValidationBtn.waitFor({ state: 'visible' });
const countStr = await this.customValidationBtn.locator('.nc-custom-validation-count').textContent();
expect(parseInt(countStr) || 0).toEqual(count);
}
async getFormFieldsEmailPhoneUrlValidatorConfig({
type,
}: {
type: UITypes.Email | UITypes.PhoneNumber | UITypes.URL;
}) {
const validateBtn = this.get().getByTestId(`nc-form-field-validate-${type}`);
return {
locator: validateBtn,
click: async ({ enable }: { enable: boolean }) => {
await validateBtn.waitFor({ state: 'visible' });
const isEnabled = await validateBtn.isChecked();
if ((enable && !isEnabled) || (!enable && isEnabled)) {
await this.waitForResponse({
uiAction: async () => {
await validateBtn.click();
},
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
}
},
verify: async ({ isEnabled, isDisabled }: { isEnabled?: boolean; isDisabled?: boolean }) => {
await validateBtn.waitFor({ state: 'visible' });
if (isEnabled !== undefined) {
if (isEnabled) {
await expect(validateBtn).toBeChecked();
} else {
await expect(validateBtn).not.toBeChecked();
}
}
if (isDisabled !== undefined) {
if (isDisabled) {
await expect(validateBtn).toBeDisabled();
} else {
await expect(validateBtn).not.toBeDisabled();
}
}
},
};
}
async getFormFieldsValidateWorkEmailConfig() {
const validateWorkEmailBtn = this.get().getByTestId('nc-form-field-allow-only-work-email');
return {
locator: validateWorkEmailBtn,
click: async ({ enable }: { enable: boolean }) => {
await validateWorkEmailBtn.waitFor({ state: 'visible' });
const isEnabled = await validateWorkEmailBtn.isChecked();
if ((enable && !isEnabled) || (!enable && isEnabled)) {
await this.waitForResponse({
uiAction: async () => {
await validateWorkEmailBtn.click();
},
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
}
},
verify: async ({
isEnabled,
isDisabled,
isVisible,
}: {
isEnabled?: boolean;
isDisabled?: boolean;
isVisible?: boolean;
}) => {
if (isEnabled !== undefined) {
await validateWorkEmailBtn.waitFor({ state: 'visible' });
if (isEnabled) {
await expect(validateWorkEmailBtn).toBeChecked();
} else {
await expect(validateWorkEmailBtn).not.toBeChecked();
}
}
if (isDisabled !== undefined) {
await validateWorkEmailBtn.waitFor({ state: 'visible' });
if (isDisabled) {
await expect(validateWorkEmailBtn).toBeDisabled();
} else {
await expect(validateWorkEmailBtn).not.toBeDisabled();
}
}
if (isVisible !== undefined) {
if (isVisible) {
await expect(validateWorkEmailBtn).toBeVisible();
} else {
await expect(validateWorkEmailBtn).not.toBeVisible();
}
}
},
};
}
async getFormFieldErrors({ title }: { title: string }) {
// ant-form-item-explain
const field = this.get().locator(`.nc-form-drag-${title.replace(' ', '')}`);
await field.scrollIntoViewIfNeeded();
const fieldErrorEl = field.locator('.ant-form-item-explain');
return {
locator: fieldErrorEl,
verify: async ({ hasError, hasErrorMsg }: { hasError?: boolean; hasErrorMsg?: string | RegExp }) => {
if (hasError !== undefined) {
if (hasError) {
await expect(fieldErrorEl).toBeVisible();
} else {
await expect(fieldErrorEl).not.toBeVisible();
}
}
if (hasErrorMsg !== undefined) {
await expect(fieldErrorEl).toBeVisible();
await expect(fieldErrorEl.locator('> div').filter({ hasText: hasErrorMsg }).first()).toHaveText(hasErrorMsg);
}
},
};
}
async addLimitToRangeMinOrMax({ type, isMinValue, value }: { type: UITypes; isMinValue: boolean; value: string }) {
const fieldLocator = this.get().getByTestId(`nc-limit-to-range-${isMinValue ? 'min' : 'max'}-${type}`);
switch (type) {
default: {
await fieldLocator.locator('input:visible').waitFor();
await this.waitForResponse({
uiAction: async () => {
await fieldLocator.locator(`input`).click();
await fieldLocator.locator(`input`).fill(value);
await this.rootPage.keyboard.press('Enter');
},
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
}
}
}
async getFormFieldsValidateLimitToRange({ type }: { type: UITypes }) {
const validateBtn = this.get().getByTestId(`nc-limit-to-range-${type}`);
return {
locator: validateBtn,
click: async ({ enable, min, max }: { enable: boolean; min?: string; max?: string }) => {
await validateBtn.waitFor({ state: 'visible' });
const isEnabled = await validateBtn.isChecked();
if (enable && !isEnabled) {
await validateBtn.click();
await this.get().locator('.nc-limit-to-range-wrapper').first().waitFor({ state: 'visible' });
if (min !== undefined) {
await this.addLimitToRangeMinOrMax({ type, isMinValue: true, value: min });
}
if (max !== undefined) {
await this.addLimitToRangeMinOrMax({ type, isMinValue: false, value: max });
}
} else if (!enable && isEnabled) {
await this.waitForResponse({
uiAction: async () => {
await validateBtn.click();
},
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
}
},
verify: async ({
isEnabled,
isDisabled,
isVisible,
}: {
isEnabled?: boolean;
isDisabled?: boolean;
isVisible?: boolean;
}) => {
if (isEnabled !== undefined) {
await validateBtn.waitFor({ state: 'visible' });
if (isEnabled) {
await expect(validateBtn).toBeChecked();
} else {
await expect(validateBtn).not.toBeChecked();
}
}
if (isDisabled !== undefined) {
await validateBtn.waitFor({ state: 'visible' });
if (isDisabled) {
await expect(validateBtn).toBeDisabled();
} else {
await expect(validateBtn).not.toBeDisabled();
}
}
if (isVisible !== undefined) {
if (isVisible) {
await expect(validateWorkEmailBtn).toBeVisible();
} else {
await expect(validateWorkEmailBtn).not.toBeVisible();
}
}
},
};
}
async getFormFieldsValidateAttFileType() {
const validateBtn = this.get().getByTestId('nc-att-limit-file-type');
const validationWrapper = this.get().locator('.nc-att-limit-file-type-wrapper');
await validateBtn.scrollIntoViewIfNeeded();
return {
locator: validateBtn,
click: async ({ enable, fillValue }: { enable: boolean; fillValue?: string }) => {
await validateBtn.waitFor({ state: 'visible' });
const isEnabled = await validateBtn.isChecked();
if (enable && !isEnabled) {
await validateBtn.click();
} else if (!enable && isEnabled) {
await this.waitForResponse({
uiAction: async () => {
await validateBtn.click();
},
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
}
if (enable && fillValue !== undefined) {
await validationWrapper.locator('input').first().waitFor({ state: 'visible' });
await this.waitForResponse({
uiAction: async () => {
await validationWrapper.locator('input').fill(fillValue);
},
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
}
},
verify: async ({ isEnabled, hasError }: { isEnabled?: boolean; hasError?: boolean }) => {
if (isEnabled !== undefined) {
await validateBtn.waitFor({ state: 'visible' });
if (isEnabled) {
await expect(validateBtn).toBeChecked();
} else {
await expect(validateBtn).not.toBeChecked();
}
}
if (hasError !== undefined) {
await validateBtn.waitFor({ state: 'visible' });
await validationWrapper.waitFor({ state: 'visible' });
if (hasError) {
await expect(validationWrapper.locator('.validation-input-error')).toBeVisible();
} else {
await expect(validationWrapper.locator('.validation-input-error')).not.toBeVisible();
}
}
},
};
}
async getFormFieldsValidateAttFileCount() {
const validateBtn = this.get().getByTestId('nc-att-limit-file-count');
const validationWrapper = this.get().locator('.nc-att-limit-file-count-wrapper');
await validateBtn.scrollIntoViewIfNeeded();
return {
locator: validateBtn,
click: async ({ enable, fillValue }: { enable: boolean; fillValue?: string }) => {
await validateBtn.waitFor({ state: 'visible' });
const isEnabled = await validateBtn.isChecked();
if (enable && !isEnabled) {
await validateBtn.click();
} else if (!enable && isEnabled) {
await this.waitForResponse({
uiAction: async () => {
await validateBtn.click();
},
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
}
if (enable && fillValue !== undefined) {
await validationWrapper.locator('input').first().waitFor({ state: 'visible' });
await this.waitForResponse({
uiAction: async () => {
await validationWrapper.locator('input').fill(fillValue);
},
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
}
},
verify: async ({ isEnabled, hasError }: { isEnabled?: boolean; hasError?: boolean }) => {
if (isEnabled !== undefined) {
await validateBtn.waitFor({ state: 'visible' });
if (isEnabled) {
await expect(validateBtn).toBeChecked();
} else {
await expect(validateBtn).not.toBeChecked();
}
}
if (hasError !== undefined) {
await validateBtn.waitFor({ state: 'visible' });
await validationWrapper.waitFor({ state: 'visible' });
if (hasError) {
await expect(validationWrapper.locator('.validation-input-error')).toBeVisible();
} else {
await expect(validationWrapper.locator('.validation-input-error')).not.toBeVisible();
}
}
},
};
}
async getFormFieldsValidateAttFileSize() {
const validateBtn = this.get().getByTestId('nc-att-limit-file-size');
const validationWrapper = this.get().locator('.nc-att-limit-file-size-wrapper');
await validateBtn.scrollIntoViewIfNeeded();
return {
locator: validateBtn,
click: async ({
enable,
fillValue,
unit = 'KB',
}: {
enable: boolean;
fillValue?: string;
unit?: 'KB' | 'MB';
}) => {
await validateBtn.waitFor({ state: 'visible' });
const isEnabled = await validateBtn.isChecked();
if (enable && !isEnabled) {
await validateBtn.click();
} else if (!enable && isEnabled) {
await this.waitForResponse({
uiAction: async () => {
await validateBtn.click();
},
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
}
if (enable && fillValue !== undefined) {
await validationWrapper.locator('.nc-validation-input-wrapper input').first().waitFor({ state: 'visible' });
await validationWrapper.locator('.ant-select-selector').click();
const dropdown = this.rootPage.locator('.nc-att-limit-file-size-unit-selector-dropdown');
await dropdown.waitFor({ state: 'visible' });
const option = dropdown.locator('.ant-select-item-option').getByText(unit);
await option.scrollIntoViewIfNeeded();
await option.waitFor({ state: 'visible' });
await option.click();
await this.waitForResponse({
uiAction: async () => {
await validationWrapper.locator('.nc-validation-input-wrapper input').fill(fillValue);
},
requestUrlPathToMatch: '/api/v1/db/meta/form-columns',
httpMethodsToMatch: ['PATCH'],
});
}
},
verify: async ({ isEnabled, hasError }: { isEnabled?: boolean; hasError?: boolean }) => {
if (isEnabled !== undefined) {
await validateBtn.waitFor({ state: 'visible' });
if (isEnabled) {
await expect(validateBtn).toBeChecked();
} else {
await expect(validateBtn).not.toBeChecked();
}
}
if (hasError !== undefined) {
await validateBtn.waitFor({ state: 'visible' });
await validationWrapper.waitFor({ state: 'visible' });
if (hasError) {
await expect(validationWrapper.locator('.validation-input-error')).toBeVisible();
} else {
await expect(validationWrapper.locator('.validation-input-error')).not.toBeVisible();
}
}
},
};
}
}