|
|
|
@ -22,14 +22,16 @@ export class FormPage extends BasePage {
|
|
|
|
|
readonly formSubHeading: Locator; |
|
|
|
|
readonly afterSubmitMsg: Locator; |
|
|
|
|
|
|
|
|
|
readonly formFields: Locator; |
|
|
|
|
|
|
|
|
|
constructor(dashboard: DashboardPage) { |
|
|
|
|
super(dashboard.rootPage); |
|
|
|
|
this.dashboard = dashboard; |
|
|
|
|
this.toolbar = new ToolbarPage(this); |
|
|
|
|
this.topbar = new TopbarPage(this); |
|
|
|
|
|
|
|
|
|
this.addAllButton = dashboard.get().locator('[data-testid="nc-form-add-all"]'); |
|
|
|
|
this.removeAllButton = dashboard.get().locator('[data-testid="nc-form-remove-all"]'); |
|
|
|
|
this.addAllButton = dashboard.get().locator('[data-testid="nc-form-show-all-fields"]').locator('.nc-switch'); |
|
|
|
|
this.removeAllButton = 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"]'); |
|
|
|
@ -40,6 +42,8 @@ export class FormPage extends BasePage {
|
|
|
|
|
this.formHeading = dashboard.get().locator('[data-testid="nc-form-heading"]'); |
|
|
|
|
this.formSubHeading = dashboard.get().locator('[data-testid="nc-form-sub-heading"]'); |
|
|
|
|
this.afterSubmitMsg = dashboard.get().locator('[data-testid="nc-form-after-submit-msg"]'); |
|
|
|
|
|
|
|
|
|
this.formFields = dashboard.get().locator('.nc-form-fields-list'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
get() { |
|
|
|
@ -50,21 +54,21 @@ export class FormPage extends BasePage {
|
|
|
|
|
return this.dashboard.get().locator('[data-testid="nc-form-wrapper-submit"]'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getFormHiddenColumn() { |
|
|
|
|
return this.get().locator('[data-testid="nc-form-hidden-column"]'); |
|
|
|
|
} |
|
|
|
|
// getFormHiddenColumn() {
|
|
|
|
|
// return this.get().locator('[data-testid="nc-form-hidden-column"]');
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
getFormFields() { |
|
|
|
|
return this.get().locator('[data-testid="nc-form-fields"]'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getDragNDropToHide() { |
|
|
|
|
return this.get().locator('[data-testid="nc-drag-n-drop-to-hide"]'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getFormFieldsRemoveIcon() { |
|
|
|
|
return this.get().locator('[data-testid="nc-field-remove-icon"]'); |
|
|
|
|
} |
|
|
|
|
// getDragNDropToHide() {
|
|
|
|
|
// return this.get().locator('[data-testid="nc-drag-n-drop-to-hide"]');
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// getFormFieldsRemoveIcon() {
|
|
|
|
|
// return this.get().locator('[data-testid="nc-field-remove-icon"]');
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
getFormFieldsRequired() { |
|
|
|
|
return this.get().locator('[data-testid="nc-form-input-required"] + button'); |
|
|
|
@ -124,8 +128,11 @@ export class FormPage extends BasePage {
|
|
|
|
|
const dst = this.get().locator(`[data-testid="nc-drag-n-drop-to-hide"]`); |
|
|
|
|
await src.dragTo(dst); |
|
|
|
|
} else if (mode === 'hideField') { |
|
|
|
|
const src = this.get().locator(`.nc-form-drag-${field.replace(' ', '')}`); |
|
|
|
|
await src.locator(`[data-testid="nc-field-remove-icon"]`).click(); |
|
|
|
|
// const src = this.get().locator(`.nc-form-drag-${field.replace(' ', '')}`);
|
|
|
|
|
// await src.locator(`[data-testid="nc-field-remove-icon"]`).click();
|
|
|
|
|
|
|
|
|
|
// 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(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -141,15 +148,13 @@ export class FormPage extends BasePage {
|
|
|
|
|
await src.dragTo(dst, { trial: true }); |
|
|
|
|
await src.dragTo(dst); |
|
|
|
|
} else if (mode === 'clickField') { |
|
|
|
|
const src = this.get().locator(`[data-testid="nc-form-hidden-column-${field}"]`); |
|
|
|
|
await src.click(); |
|
|
|
|
// const src = this.get().locator(`[data-testid="nc-form-hidden-column-${field}"]`);
|
|
|
|
|
// await src.click();
|
|
|
|
|
await this.formFields.locator(`[data-testid="nc-form-field-item-${field}"]`).locator('.nc-switch').click(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async removeAllFields() { |
|
|
|
|
// TODO: Otherwise form input boxes are not visible sometimes
|
|
|
|
|
await this.rootPage.waitForTimeout(1000); |
|
|
|
|
|
|
|
|
|
await this.removeAllButton.click(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|