From 7e0937f3edcca6ac93078f69ebdf090120c04e12 Mon Sep 17 00:00:00 2001 From: Sanju Date: Fri, 23 Jul 2021 16:38:44 +0530 Subject: [PATCH] chore: Cypress test case for create label flow --- .../dashboard/contacts/components/Header.vue | 1 + .../dashboard/settings/labels/AddLabel.vue | 3 +++ spec/cypress.json | 4 +++- .../admin_dashboard_authentication.js | 10 ++++----- .../admin_dashboard_create_label.js | 21 +++++++++++++++++++ 5 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 spec/cypress/integration/happy_paths/admin_dashboard_create_label.js diff --git a/app/javascript/dashboard/routes/dashboard/contacts/components/Header.vue b/app/javascript/dashboard/routes/dashboard/contacts/components/Header.vue index 1f7df7448..93e471a76 100644 --- a/app/javascript/dashboard/routes/dashboard/contacts/components/Header.vue +++ b/app/javascript/dashboard/routes/dashboard/contacts/components/Header.vue @@ -30,6 +30,7 @@ color-scheme="success" icon="ion-android-add-circle" @click="onToggleCreate" + data-testid="create-new-contact" > {{ $t('CREATE_CONTACT.BUTTON_LABEL') }} diff --git a/app/javascript/dashboard/routes/dashboard/settings/labels/AddLabel.vue b/app/javascript/dashboard/routes/dashboard/settings/labels/AddLabel.vue index 29c2ddd6d..cbf0ca3bf 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/labels/AddLabel.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/labels/AddLabel.vue @@ -12,6 +12,7 @@ :label="$t('LABEL_MGMT.FORM.NAME.LABEL')" :placeholder="$t('LABEL_MGMT.FORM.NAME.PLACEHOLDER')" :error="getLabelTitleErrorMessage" + data-testid="label-title" @input="$v.title.$touch" /> @@ -21,6 +22,7 @@ class="medium-12 columns" :label="$t('LABEL_MGMT.FORM.DESCRIPTION.LABEL')" :placeholder="$t('LABEL_MGMT.FORM.DESCRIPTION.PLACEHOLDER')" + data-testid="label-description" @input="$v.description.$touch" /> @@ -41,6 +43,7 @@ {{ $t('LABEL_MGMT.FORM.CREATE') }} diff --git a/spec/cypress.json b/spec/cypress.json index 7b1481225..dff0b2b58 100644 --- a/spec/cypress.json +++ b/spec/cypress.json @@ -1,4 +1,6 @@ { "baseUrl": "http://localhost:5050", - "defaultCommandTimeout": 10000 + "defaultCommandTimeout": 10000, + "viewportWidth": 1250, + "viewportHeight": 800 } diff --git a/spec/cypress/integration/happy_paths/admin_dashboard_authentication.js b/spec/cypress/integration/happy_paths/admin_dashboard_authentication.js index 20ec5f63d..fc7f35f1f 100644 --- a/spec/cypress/integration/happy_paths/admin_dashboard_authentication.js +++ b/spec/cypress/integration/happy_paths/admin_dashboard_authentication.js @@ -1,10 +1,10 @@ -describe('AdminDashboardAuthentication', function() { +describe('AdminDashboardAuthentication', function () { before(() => { cy.app('clean'); - cy.appScenario('default') + cy.appScenario('default'); }); - it('authenticates an admin ', function() { + it('authenticates an admin ', function () { cy.visit('/'); cy.get("[data-testid='email_input']") @@ -12,9 +12,9 @@ describe('AdminDashboardAuthentication', function() { .type('john@acme.inc'); cy.get("[data-testid='password_input']") .clear() - .type('123456'); + .type('Password1!'); cy.get("[data-testid='submit_button']").click(); - cy.contains('Conversations'); }); + }); diff --git a/spec/cypress/integration/happy_paths/admin_dashboard_create_label.js b/spec/cypress/integration/happy_paths/admin_dashboard_create_label.js new file mode 100644 index 000000000..c219a760a --- /dev/null +++ b/spec/cypress/integration/happy_paths/admin_dashboard_create_label.js @@ -0,0 +1,21 @@ +describe('AdminCreateLabel', () => { + before(() => { + cy.wait(3000); + }); + + it('open add label modal', () => { + cy.get( + 'ul.menu.vertical > li:last-child > a.sub-menu-title.side-menu > span.child-icon.ion-android-add-circle' + ).click(); + }); + it('create a label', () => { + cy.get("[data-testid='label-title'] > input") + .clear() + .type(`show_stopper_${new Date().getTime()}`); + cy.get("[data-testid='label-description'] > input") + .clear() + .type('denote it with show show stopper cases'); + + cy.get("[data-testid='label-submit']").click(); + }); +});