Skip to content

Commit

Permalink
Merge pull request #182 from glific/feature/template-flows
Browse files Browse the repository at this point in the history
Feature/template flows
  • Loading branch information
akanshaaa19 authored Aug 8, 2024
2 parents e718f79 + 49855e7 commit f7ec997
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/contactBar/ContactBar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('Contact bar', function () {
});
});

it('should start a flow', () => {
it.only('should start a flow', () => {
cy.get('[data-testid="searchInput"]').click({ force: true }).wait(500).type('Glific Simulator');
cy.get('.contactsContainer > ul').find('a').first().click();
cy.startFlow();
Expand Down
8 changes: 7 additions & 1 deletion cypress/e2e/flow/Flow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ describe('Flow', () => {

it('should check require field validation', () => {
cy.get('[data-testid="newItemButton"]').click();
cy.get('[data-testid="middle-button"]').click();
// need some extra wait here to load formik validation library on page
cy.wait(1000);
cy.get('[data-testid=submitActionButton]').click({ force: true });
Expand All @@ -116,14 +117,16 @@ describe('Flow', () => {

it('should create new Flow with keyword', () => {
cy.get('[data-testid="newItemButton"]').click();
cy.get('[data-testid="middle-button"]').click();
cy.get('[data-testid=outlinedInput]').eq(0).click().wait(500).type(flow);
cy.get('[data-testid=outlinedInput]').eq(1).click().wait(500).type(randomFlowKeyword_en());
cy.get('[data-testid="submitActionButton"]').click({ force: true });
cy.get('div').should('contain', 'Flow created successfully!');
});

it('should throw keyword already exists validation', () => {
cy.get('[data-testid="newItemButton"]').click().wait(1000);
cy.get('[data-testid="newItemButton"]').click();
cy.get('[data-testid="middle-button"]').click().wait(1000);
cy.get('input[name=name]').click().wait(500).type('Activity');
cy.get('input[name=keywords]').click().wait(500).type('activity');
cy.get('[data-testid="submitActionButton"]').click({ force: true });
Expand Down Expand Up @@ -153,6 +156,7 @@ describe('Flow', () => {

it('should create new Flow in hindi', () => {
cy.get('[data-testid="newItemButton"]').click();
cy.get('[data-testid="middle-button"]').click();
cy.get('[data-testid=outlinedInput]').eq(0).click().wait(500).type(flow_hindi);
cy.get('[data-testid=outlinedInput]').eq(1).click().wait(500).type(randomFlowKeyword_hi());
cy.get('[data-testid="submitActionButton"]').click({ force: true });
Expand All @@ -162,6 +166,7 @@ describe('Flow', () => {

it('should create new Flow without keyword', () => {
cy.get('[data-testid="newItemButton"]').click();
cy.get('[data-testid="middle-button"]').click();
cy.get('[data-testid=outlinedInput]').eq(0).click().wait(500).type(flow_with_no_keyword);
cy.get('[data-testid="submitActionButton"]').click({ force: true });
cy.get('div').should('contain', 'Flow created successfully!');
Expand All @@ -170,6 +175,7 @@ describe('Flow', () => {

it('should check duplicate new Flow', () => {
cy.get('[data-testid="newItemButton"]').click();
cy.get('[data-testid="middle-button"]').click();
cy.get('[data-testid=outlinedInput]').eq(0).click().wait(500).type('Activity');
cy.wait(1000);
cy.get('[data-testid="submitActionButton"]').click({ force: true });
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/flow/FlowEditor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ describe('Flow', () => {

it('should configure Flow', () => {
cy.get('[data-testid="newItemButton"]').click();
cy.get('[data-testid="middle-button"]').click();
cy.get('[data-testid=outlinedInput]').eq(0).click().wait(500).type(flowName);
cy.get('[data-testid=outlinedInput]').eq(1).click().wait(500).type(randomFlowKeyword_en());
cy.get('[data-testid="additionalActionButton"]').click({ force: true });
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Cypress.Commands.add('startFlow', () => {
cy.get('[data-testid="flowButton"]').then((btn) => {
if (btn[0]['disabled'] == false) {
cy.get('[data-testid="flowButton"]').click({ force: true });
cy.get('[data-testid="autocomplete-element"]').click().type('Activity');
cy.get('[data-testid="autocomplete-element"]').click().type('AB');
cy.get('.MuiAutocomplete-popper').click();
cy.get('[data-testid=ok-button]').click({ force: true });
cy.wait(500);
Expand Down

0 comments on commit f7ec997

Please sign in to comment.