Browse Source

Adding more options

djhvscf 4 years ago
parent
commit
03699fb73a
1 changed files with 35 additions and 2 deletions
  1. 35 2
      cypress/extensions/filter-control/options.js

+ 35 - 2
cypress/extensions/filter-control/options.js

@@ -1,10 +1,43 @@
 module.exports = (theme = '') => {
-    const baseUrl = require('../../common/utils')(theme, 'extensions')
+    const baseUrl = require('../../common/utils')(theme, 'for-tests/extensions/filter-control')
   
     describe('Test basic filter control', () => {
       it('Test basic filter control', () => {
         cy.visit(`${baseUrl}filter-control.html`)
-          .get('.table > thead > tr > th > .fht-cell > .filter-control').its('length').should('be.gte', 1)
+          .get('.table > thead > tr > th > .fht-cell > .filter-control')
+          .its('length')
+          .should('be.gte', 1)
+      })
+
+      it('Test if filter control visible is set to false, controls shouldnt be visible.', () => {
+        cy.visit(`${baseUrl}filter-control-filterControlVisible.html`)
+          .get('.table > thead > tr > th > .fht-cell > .filter-control')
+          .invoke('attr', 'style')
+          .should('eq', 'display: none;')
+      })
+
+      it('Test if filter control searchOnEnteyKey is set to true. Type "cypress" and validate table should not perform any action.', () => {
+        cy.visit(`${baseUrl}filter-control-searchOnEnterKey.html`)
+          .wait(1000)
+          .get('.table > thead > tr > th > .fht-cell > .filter-control')
+          .find('input')
+          .type('cypress')
+          .get('.table > tbody > tr')
+          .its('length')
+          .should('eq', 21)
+      })
+
+      it('Test if filter control searchOnEnteyKey is set to true. Type "Item 0", hit enter and validate table should perform search action.', () => {
+        cy.visit(`${baseUrl}filter-control-searchOnEnterKey.html`)
+          .wait(1000)
+          .get('.table > thead > tr > th > .fht-cell > .filter-control')
+          .find('input')
+          .type('Item 0')
+          .type('{enter}')
+          .wait(1000)
+          .get('.table > tbody > tr')
+          .its('length')
+          .should('eq', 1)
       })
     })
   }