Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5276 from novuhq/nv-2938-web-workflows-search
feat(web): workflows allow searching by name or trigger identifier
- Loading branch information
Showing
29 changed files
with
693 additions
and
442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { TriggerTypeEnum } from '@novu/shared'; | ||
|
||
describe('Workflows Page', function () { | ||
beforeEach(function () { | ||
cy.initializeSession().as('session'); | ||
}); | ||
|
||
it('should allow searching by name or identifier', function () { | ||
cy.createWorkflows({ | ||
userId: this.session.user._id, | ||
organizationId: this.session.organization._id, | ||
environmentId: this.session.environment._id, | ||
workflows: [ | ||
{ name: 'SMS Workflow' }, | ||
{ triggers: [{ identifier: 'sms-test', variables: [], type: TriggerTypeEnum.EVENT }] }, | ||
], | ||
}); | ||
|
||
cy.intercept('GET', '**/v1/notification-groups').as('notification-groups'); | ||
cy.intercept('GET', '**/v1/notification-templates*').as('notification-templates'); | ||
|
||
cy.visit('/workflows'); | ||
cy.wait(['@notification-groups', '@notification-templates']); | ||
|
||
cy.getByTestId('workflows-search-input').type('SMS'); | ||
cy.wait('@notification-templates'); | ||
|
||
cy.getByTestId('workflow-row-name').should('have.length', 2); | ||
cy.getByTestId('workflow-row-name').contains('SMS Workflow'); | ||
cy.getByTestId('workflow-row-trigger-identifier').contains('sms-test'); | ||
}); | ||
|
||
it('should allow clearing the search', function () { | ||
cy.intercept('GET', '**/v1/notification-groups').as('notification-groups'); | ||
cy.intercept('GET', '**/v1/notification-templates*').as('notification-templates'); | ||
|
||
cy.visit('/workflows'); | ||
cy.wait(['@notification-groups', '@notification-templates']); | ||
|
||
cy.getByTestId('workflows-search-input').type('This template does not exist'); | ||
cy.wait('@notification-templates'); | ||
cy.getByTestId('workflows-no-matches').should('exist'); | ||
|
||
cy.getByTestId('search-input-clear').click(); | ||
cy.getByTestId('workflows-no-matches').should('not.exist'); | ||
}); | ||
|
||
it('should show no results view', function () { | ||
cy.intercept('GET', '**/v1/notification-groups').as('notification-groups'); | ||
cy.intercept('GET', '**/v1/notification-templates*').as('notification-templates'); | ||
|
||
cy.visit('/workflows'); | ||
cy.wait(['@notification-groups', '@notification-templates']); | ||
|
||
cy.getByTestId('workflows-search-input').type('This template does not exist'); | ||
cy.wait('@notification-templates'); | ||
|
||
cy.getByTestId('workflow-row-name').should('have.length', 0); | ||
cy.getByTestId('workflows-no-matches').should('exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { useDebounce } from './useDebounce'; | ||
|
||
interface IDebouncedFunction { | ||
(value: string): void; | ||
cancel: () => void; | ||
} | ||
|
||
export const useDebouncedSearch = (setSearch: (newSearch: string) => void): IDebouncedFunction => { | ||
return useDebounce((value: string) => setSearch(value), 500); | ||
}; |
Oops, something went wrong.