Browse Source

fix : fixed test cases for webhook and date options

pull/7181/head
musharaf-nocodb 12 months ago
parent
commit
9140d4bfdd
  1. 6
      packages/nc-gui/components/smartsheet/column/DateOptions.vue
  2. 2
      packages/nc-gui/components/smartsheet/column/DateTimeOptions.vue
  3. 30
      tests/playwright/pages/Dashboard/Grid/Column/index.ts
  4. 8
      tests/playwright/pages/Dashboard/WebhookForm/index.ts

6
packages/nc-gui/components/smartsheet/column/DateOptions.vue

@ -18,9 +18,9 @@ if (!vModel.value.meta?.date_format) {
<template> <template>
<a-form-item :label="$t('labels.dateFormat')"> <a-form-item :label="$t('labels.dateFormat')">
<a-select v-model:value="vModel.meta.date_format" class="nc-date-select" dropdown-class-name="nc-dropdown-date-format"> <a-select show-search v-model:value="vModel.meta.date_format" class="nc-date-select" dropdown-class-name="nc-dropdown-date-format">
<a-select-option v-for="(format, i) of [...dateMonthFormats, ...dateFormats]" :key="i" :value="format"> <a-select-option v-for="(format, i) of [ ...dateFormats,...dateMonthFormats]" :key="i" :value="format">
<div class="flex gap-2 justify-between items-center" :data-testid="`nc-date-select-${format}`"> <div class="flex gap-2 justify-between items-center">
{{ format }} {{ format }}
<component <component
:is="iconMap.check" :is="iconMap.check"

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

@ -25,7 +25,7 @@ if (!vModel.value.meta?.time_format) {
<a-form-item :label="$t('labels.dateFormat')"> <a-form-item :label="$t('labels.dateFormat')">
<a-select v-model:value="vModel.meta.date_format" class="nc-date-select" dropdown-class-name="nc-dropdown-date-format"> <a-select v-model:value="vModel.meta.date_format" class="nc-date-select" dropdown-class-name="nc-dropdown-date-format">
<a-select-option v-for="(format, i) of dateFormats" :key="i" :value="format"> <a-select-option v-for="(format, i) of dateFormats" :key="i" :value="format">
<div class="flex gap-2 w-full justify-between items-center" :data-testid="`nc-date-${format}`"> <div class="flex gap-2 w-full justify-between items-center">
{{ format }} {{ format }}
<component <component
:is="iconMap.check" :is="iconMap.check"

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

@ -104,20 +104,19 @@ export class ColumnPageObject extends BasePage {
.click(); .click();
} }
break; break;
case 'Date':
await this.get().locator('.nc-date-select').click();
await this.rootPage.locator('.nc-date-select').pressSequentially(dateFormat);
await this.rootPage.locator('.ant-select-item').locator(`text="${dateFormat}"`).click();
break;
case 'DateTime': case 'DateTime':
// Date Format // Date Format
await this.get().locator('.nc-date-select').click(); await this.get().locator('.nc-date-select').click();
await this.rootPage.locator('.ant-select-item').locator(`[data-testid="nc-date-${dateFormat}"]`).click(); await this.rootPage.locator('.ant-select-item').locator(`text="${dateFormat}"`).click();
// Time Format // Time Format
await this.get().locator('.nc-time-select').click(); await this.get().locator('.nc-time-select').click();
await this.rootPage.locator('.ant-select-item').locator(`[data-testid="nc-time-${timeFormat}"]`).click(); await this.rootPage.locator('.ant-select-item').locator(`text="${timeFormat}"`).click();
break;
case 'Date': {
// Date Format
await this.get().locator('.nc-date-select').click();
await this.rootPage.locator('.ant-select-item').locator(`[data-testid="nc-date-select-${dateFormat}"]`).click();
break; break;
}
case 'Formula': case 'Formula':
await this.get().locator('.nc-formula-input').fill(formula); await this.get().locator('.nc-formula-input').fill(formula);
break; break;
@ -307,19 +306,18 @@ export class ColumnPageObject extends BasePage {
}) })
.click(); .click();
break; break;
case 'Date': {
// Date Format
await this.get().locator('.nc-date-select').click();
await this.rootPage.locator('.ant-select-item').locator(`[data-testid="nc-date-select-${dateFormat}"]`).click();
break;
}
case 'DateTime': case 'DateTime':
// Date Format // Date Format
await this.get().locator('.nc-date-select').click(); await this.get().locator('.nc-date-select').click();
await this.rootPage.locator('.ant-select-item').locator(`[data-testid="nc-date-${dateFormat}"]`).click(); await this.rootPage.locator('.ant-select-item').locator(`text="${dateFormat}"`).click();
// Time Format // Time Format
await this.get().locator('.nc-time-select').click(); await this.get().locator('.nc-time-select').click();
await this.rootPage.locator('.ant-select-item').locator(`[data-testid="nc-time-${timeFormat}"]`).click(); await this.rootPage.locator('.ant-select-item').locator(`text="${timeFormat}"`).click();
break;
case 'Date':
await this.get().locator('.nc-date-select').click();
await this.rootPage.locator('.nc-date-select').pressSequentially(dateFormat);
await this.rootPage.locator('.ant-select-item').locator(`text="${dateFormat}"`).click();
break; break;
default: default:
break; break;

8
tests/playwright/pages/Dashboard/WebhookForm/index.ts

@ -154,13 +154,7 @@ export class WebhookFormPage extends BasePage {
await this.rootPage.waitForTimeout(500); await this.rootPage.waitForTimeout(500);
// kludge, as the dropdown is not visible even after scroll into view // kludge, as the dropdown is not visible even after scroll into view
await this.rootPage.locator('.ant-select-dropdown:visible').hover(); await this.rootPage.locator('.ant-select-selection-search').pressSequentially(key);
await this.rootPage
.locator('.ant-select-dropdown:visible')
.locator(`.ant-select-item`)
.last()
.scrollIntoViewIfNeeded();
await this.rootPage await this.rootPage
.locator('.ant-select-dropdown:visible') .locator('.ant-select-dropdown:visible')
.locator(`.ant-select-item:has-text("${key}")`) .locator(`.ant-select-item:has-text("${key}")`)

Loading…
Cancel
Save