From 4d42e417c026f81c01c78060cefa9b6a0870abe6 Mon Sep 17 00:00:00 2001
From: Carlos Jimenez <=>
Date: Mon, 3 Dec 2018 00:45:34 +0100
Subject: [PATCH] #781 Extensiones nightmare for search and access sections
---
.../src/components/left-menu/left-menu.html | 2 +-
e2e/helpers/extensions.js | 42 +++++++++---
.../claim-module/01_edit_basic_data.spec.js | 25 +------
.../client-module/01_create_client.spec.js | 18 -----
.../client-module/02_edit_basic_data.spec.js | 52 ++-------------
.../client-module/03_edit_fiscal_data.spec.js | 66 ++-----------------
.../client-module/04_edit_pay_method.spec.js | 32 ++-------
.../client-module/05_add_address.spec.js | 26 +-------
.../06_add_address_notes.spec.js | 26 +-------
.../client-module/07_edit_web_access.spec.js | 27 +-------
e2e/paths/client-module/08_add_notes.spec.js | 26 +-------
e2e/paths/client-module/09_add_credit.spec.js | 26 +-------
e2e/paths/client-module/10_add_greuge.spec.js | 26 +-------
e2e/paths/client-module/11_mandate.spec.js | 27 +-------
.../12_lock_of_verified_data.spec.js | 35 +---------
e2e/paths/client-module/13_log.spec.js | 26 +-------
e2e/paths/client-module/14_risk.spec.js | 26 +-------
.../02_edit_item_basic_data.spec.js | 26 +-------
.../item-module/03_edit_item_tax.spec.js | 26 +-------
.../item-module/04_create_item_tags.spec.js | 26 +-------
.../item-module/05_create_item_niche.spec.js | 26 +-------
.../06_create_item_botanical.spec.js | 26 +-------
.../07_create_item_barcode.spec.js | 26 +-------
.../01_create_ticket_observations.spec.js | 26 +-------
.../02_delete_ticket_expeditions.spec.js | 26 +-------
e2e/paths/ticket-module/03_list_sale.spec.js | 26 +-------
.../04_create_ticket_packages.spec.js | 26 +-------
.../05_create_new_tracking_state.spec.js | 26 +-------
.../06_edit_basic_data_steps.spec.js | 26 +-------
e2e/paths/ticket-module/07_edit_sale.spec.js | 26 +-------
.../ticket-module/08_list_components.spec.js | 26 +-------
.../ticket-module/10_ticket_request.spec.js | 26 +-------
32 files changed, 130 insertions(+), 768 deletions(-)
diff --git a/client/salix/src/components/left-menu/left-menu.html b/client/salix/src/components/left-menu/left-menu.html
index 85a7716bb..13be520ab 100644
--- a/client/salix/src/components/left-menu/left-menu.html
+++ b/client/salix/src/components/left-menu/left-menu.html
@@ -10,7 +10,7 @@
{{::item.description}}
-
+
-
diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js
index 25bb4264c..4a6f9d329 100644
--- a/e2e/helpers/extensions.js
+++ b/e2e/helpers/extensions.js
@@ -1,6 +1,5 @@
/* eslint no-invalid-this: "off" */
-import selectors from './selectors.js';
import config from './config.js';
import Nightmare from 'nightmare';
import {URL} from 'url';
@@ -176,7 +175,6 @@ let actions = {
}, selector, count)
.then(done)
.catch(err => {
- console.error(err.name, err.message);
done(new Error(`.waitForNumberOfElements() for ${selector}, count ${count} timed out`));
});
},
@@ -285,15 +283,39 @@ let actions = {
}).catch(done);
},
- // indexSearchToSection: function(searchValue, sectionName, done) {
- // this.wait(`vn-${sectionName}-index vn-searchbar input`)
- // .type(`vn-${sectionName}-index vn-searchbar input`, searchValue)
- // .click(`vn-${sectionName}-index vn-searchbar vn-icon[icon="search"]`)
- // .waitForNumberOfElements(`vn-${sectionName}-index > div > div > vn-card:nth-child(2) > div > vn-item-client > a`, 1)
- // .countElement(selectors.clientsIndex.searchResult);
+ accessToSearchResult: function(searchValue, done) {
+ this.wait(`vn-searchbar input`)
+ .type(`vn-searchbar input`, searchValue)
+ .click(`vn-searchbar vn-icon[icon="search"]`)
+ .evaluate(() => {
+ return document.querySelector('ui-view vn-card vn-table') != null;
+ })
+ .then(result => {
+ if (result)
+ return this.waitToClick('ui-view vn-card vn-td');
- // expect(resultCount).toEqual(1);
- // }
+ return this.waitToClick('ui-view vn-card a');
+ })
+ .then(done)
+ .catch(done);
+ },
+
+ accessToSection: function(sectionRoute, done) {
+ this.wait(`vn-left-menu`)
+ .evaluate(sectionRoute => {
+ return document.querySelector(`vn-left-menu ul li ul li > a[ui-sref="${sectionRoute}"]`) != null;
+ }, sectionRoute)
+ .then(nested => {
+ if (!nested)
+ return this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
+
+ return this.waitToClick('vn-left-menu .collapsed')
+ .wait('vn-left-menu .expanded')
+ .waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`);
+ })
+ .then(done)
+ .catch(done);
+ }
};
Object.keys(actions).forEach(function(name) {
diff --git a/e2e/paths/claim-module/01_edit_basic_data.spec.js b/e2e/paths/claim-module/01_edit_basic_data.spec.js
index 734f2216d..b8354415e 100644
--- a/e2e/paths/claim-module/01_edit_basic_data.spec.js
+++ b/e2e/paths/claim-module/01_edit_basic_data.spec.js
@@ -6,28 +6,9 @@ describe('Claim edit basic data path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('salesAssistant', 'claim');
- });
-
- it('should search for the claim with id 1', async () => {
- const resultCount = await nightmare
- .wait(selectors.claimsIndex.searchClaimInput)
- .type(selectors.claimsIndex.searchClaimInput, '1')
- .click(selectors.claimsIndex.searchButton)
- .waitForNumberOfElements(selectors.claimsIndex.searchResult, 1)
- .countElement(selectors.claimsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the claim Basic Data`, async () => {
- const url = await nightmare
- .waitToClick(selectors.claimsIndex.searchResult)
- .waitToClick(selectors.claimBasicData.basicDataButton)
- .waitForURL('basic-data')
- .parsedUrl();
-
- expect(url.hash).toContain('basic-data');
+ .loginAndModule('salesAssistant', 'claim')
+ .accessToSearchResult('1')
+ .accessToSection('claim.card.basicData');
});
it(`should edit claim state, is paid with mana and observation fields`, async () => {
diff --git a/e2e/paths/client-module/01_create_client.spec.js b/e2e/paths/client-module/01_create_client.spec.js
index 1348f47b6..440ac6b1d 100644
--- a/e2e/paths/client-module/01_create_client.spec.js
+++ b/e2e/paths/client-module/01_create_client.spec.js
@@ -20,24 +20,6 @@ describe('Client create path', () => {
expect(result).toEqual(0);
});
- it('should access to the create client view by clicking the create-client floating button', async () => {
- const url = await nightmare
- .click(selectors.clientsIndex.createClientButton)
- .wait(selectors.createClientView.createButton)
- .parsedUrl();
-
- expect(url.hash).toEqual('#!/client/create');
- });
-
- it('should return to the client index by clicking the cancel button', async () => {
- const url = await nightmare
- .click(selectors.createClientView.cancelButton)
- .wait(selectors.clientsIndex.createClientButton)
- .parsedUrl();
-
- expect(url.hash).toEqual('#!/client/index');
- });
-
it('should now access to the create client view by clicking the create-client floating button', async () => {
const url = await nightmare
.click(selectors.clientsIndex.createClientButton)
diff --git a/e2e/paths/client-module/02_edit_basic_data.spec.js b/e2e/paths/client-module/02_edit_basic_data.spec.js
index 0af24ea41..b148f864a 100644
--- a/e2e/paths/client-module/02_edit_basic_data.spec.js
+++ b/e2e/paths/client-module/02_edit_basic_data.spec.js
@@ -6,33 +6,13 @@ describe('Client Edit basicData path', () => {
describe('as employee', () => {
beforeAll(() => {
nightmare
- .loginAndModule('employee', 'client');
- });
-
- it('should search for the user Bruce Wayne', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it('should click on the search result to access to the client summary', async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitForURL('summary')
- .parsedUrl();
-
- expect(url.hash).toContain('summary');
+ .loginAndModule('employee', 'client')
+ .accessToSearchResult('Bruce Wayne')
+ .accessToSection('client.card.basicData');
});
it('should not be able to change the salesPerson', async () => {
const result = await nightmare
- .click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.evaluate(selector => {
return document.querySelector(selector).disabled;
@@ -111,33 +91,13 @@ describe('Client Edit basicData path', () => {
beforeAll(() => {
nightmare
.waitToClick(selectors.globalItems.logOutButton)
- .loginAndModule('salesASsistant', 'client');
- });
-
- it('should now search for the user Ptonomy Wallace', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Ptonomy Wallace')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it('should now click on the search result to access to the client summary', async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Ptonomy Wallace')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitForURL('summary')
- .parsedUrl();
-
- expect(url.hash).toContain('summary');
+ .loginAndModule('salesASsistant', 'client')
+ .accessToSearchResult('Ptonomy Wallace')
+ .accessToSection('client.card.basicData');
});
it('should be able to change the salesPerson', async () => {
const result = await nightmare
- .click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.evaluate(selector => {
return document.querySelector(selector).disabled;
diff --git a/e2e/paths/client-module/03_edit_fiscal_data.spec.js b/e2e/paths/client-module/03_edit_fiscal_data.spec.js
index 5f803a770..8e2617a0e 100644
--- a/e2e/paths/client-module/03_edit_fiscal_data.spec.js
+++ b/e2e/paths/client-module/03_edit_fiscal_data.spec.js
@@ -6,33 +6,12 @@ describe('Client Edit fiscalData path', () => {
describe('as employee', () => {
beforeAll(() => {
nightmare
- .loginAndModule('employee', 'client');
- });
-
- it('should search for the user Bruce Banner', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
+ .loginAndModule('employee', 'client')
+ .accessToSearchResult('Bruce Banner')
+ .accessToSection('client.card.address.index');
});
// Confirms all addresses have EQtax false for future propagation test step 1
- it(`should click on the search result to access to the client's addresses`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientAddresses.addressesButton)
- .waitForURL('/address/index')
- .parsedUrl();
-
- expect(url.hash).toContain('/address/index');
- });
-
- // Confirms all addresses have EQtax false for future propagation test step 2
it(`should click on the 1st edit icon to check EQtax isnt checked`, async () => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.firstEditButton)
@@ -44,7 +23,7 @@ describe('Client Edit fiscalData path', () => {
expect(result).toBeFalsy();
});
- // Confirms all addresses have EQtax false for future propagation test step 3
+ // Confirms all addresses have EQtax false for future propagation test step 2
it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async () => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
@@ -79,40 +58,9 @@ describe('Client Edit fiscalData path', () => {
describe('as administrative', () => {
beforeAll(() => {
nightmare
- .waitForLogin('administrative');
- });
-
- it('should now click on the Clients button of the top bar menu', async () => {
- const url = await nightmare
- .waitToClick(selectors.globalItems.applicationsMenuButton)
- .wait(selectors.globalItems.applicationsMenuVisible)
- .waitToClick(selectors.globalItems.clientsButton)
- .wait(selectors.clientsIndex.createClientButton)
- .parsedUrl();
-
- expect(url.hash).toEqual('#!/client/index');
- });
-
- it('should now search for the user Bruce Banner', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should access to the client fiscal data`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientFiscalData.fiscalDataButton)
- .waitForURL('fiscal-data')
- .parsedUrl();
-
- expect(url.hash).toContain('fiscal-data');
+ .loginAndModule('administrative', 'client')
+ .accessToSearchResult('Bruce Banner')
+ .accessToSection('client.card.fiscalData');
});
it('should receive an error if VIES and EQtax are being ticked together', async () => {
diff --git a/e2e/paths/client-module/04_edit_pay_method.spec.js b/e2e/paths/client-module/04_edit_pay_method.spec.js
index 5ac184c79..cab7b317c 100644
--- a/e2e/paths/client-module/04_edit_pay_method.spec.js
+++ b/e2e/paths/client-module/04_edit_pay_method.spec.js
@@ -6,29 +6,9 @@ describe('Client Edit pay method path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('administrative', 'client');
- });
-
- it('should search for the user Bruce Banner', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client's pay method`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientPayMethod.payMethodButton)
- .waitForURL('billing-data')
- .parsedUrl();
-
- expect(url.hash).toContain('billing-data');
+ .loginAndModule('administrative', 'client')
+ .accessToSearchResult('Bruce Banner')
+ .accessToSection('client.card.billingData');
});
it(`should attempt to edit the Pay method without an IBAN but fail`, async () => {
@@ -54,8 +34,8 @@ describe('Client Edit pay method path', () => {
it(`should add the IBAN but fail as it requires a BIC code`, async () => {
const snackbarMessage = await nightmare
.clearInput(selectors.clientPayMethod.IBANInput)
- .type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
- .waitForTextInInput(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
+ .type(selectors.clientPayMethod.IBANInput, 'ES9121000418450200051332')
+ .waitForTextInInput(selectors.clientPayMethod.IBANInput, 'ES9121000418450200051332')
.waitToClick(selectors.clientPayMethod.clearswiftBicButton)
.waitToClick(selectors.clientPayMethod.saveButton)
.waitForLastSnackbar();
@@ -92,7 +72,7 @@ describe('Client Edit pay method path', () => {
const IBAN = await nightmare
.waitToGetProperty(selectors.clientPayMethod.IBANInput, 'value');
- expect(IBAN).toEqual('ES91 2100 0418 4502 0005 1332');
+ expect(IBAN).toEqual('ES9121000418450200051332');
});
it('should confirm the swift / BIC code was saved', async () => {
diff --git a/e2e/paths/client-module/05_add_address.spec.js b/e2e/paths/client-module/05_add_address.spec.js
index e447aa256..b24acf57f 100644
--- a/e2e/paths/client-module/05_add_address.spec.js
+++ b/e2e/paths/client-module/05_add_address.spec.js
@@ -6,29 +6,9 @@ describe('Client Add address path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('employee', 'client');
- });
-
- it('should search for the user Bruce Banner', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client addresses`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientAddresses.addressesButton)
- .waitForURL('address/index')
- .parsedUrl();
-
- expect(url.hash).toContain('address/index');
+ .loginAndModule('employee', 'client')
+ .accessToSearchResult('Bruce Banner')
+ .accessToSection('client.card.address.index');
});
it(`should click on the add new address button to access to the new address form`, async () => {
diff --git a/e2e/paths/client-module/06_add_address_notes.spec.js b/e2e/paths/client-module/06_add_address_notes.spec.js
index 47896ba50..bd5582de4 100644
--- a/e2e/paths/client-module/06_add_address_notes.spec.js
+++ b/e2e/paths/client-module/06_add_address_notes.spec.js
@@ -6,29 +6,9 @@ describe('Client add address notes path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('employee', 'client');
- });
-
- it('should search for the user Petter Parker', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client addresses`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientAddresses.addressesButton)
- .waitForURL('address/index')
- .parsedUrl();
-
- expect(url.hash).toContain('address/index');
+ .loginAndModule('employee', 'client')
+ .accessToSearchResult('Petter Parker')
+ .accessToSection('client.card.address.index');
});
it(`should click on the edit icon of the default address`, async () => {
diff --git a/e2e/paths/client-module/07_edit_web_access.spec.js b/e2e/paths/client-module/07_edit_web_access.spec.js
index b427db7ae..2d26b074a 100644
--- a/e2e/paths/client-module/07_edit_web_access.spec.js
+++ b/e2e/paths/client-module/07_edit_web_access.spec.js
@@ -6,30 +6,9 @@ describe('Client Edit web access path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('employee', 'client');
- });
-
- it('should search for the user Bruce Banner', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client's web access`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientsIndex.othersButton)
- .waitToClick(selectors.clientWebAccess.webAccessButton)
- .waitForURL('web-access')
- .parsedUrl();
-
- expect(url.hash).toContain('web-access');
+ .loginAndModule('employee', 'client')
+ .accessToSearchResult('Bruce Banner')
+ .accessToSection('client.card.webAccess');
});
it(`should uncheck the Enable web access checkbox and update the name`, async () => {
diff --git a/e2e/paths/client-module/08_add_notes.spec.js b/e2e/paths/client-module/08_add_notes.spec.js
index 3764f1bb6..e67725cc2 100644
--- a/e2e/paths/client-module/08_add_notes.spec.js
+++ b/e2e/paths/client-module/08_add_notes.spec.js
@@ -6,29 +6,9 @@ describe('Client Add notes path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('employee', 'client');
- });
-
- it('should search for the user Bruce Banner', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client's notes`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientNotes.notesButton)
- .waitForURL('note/index')
- .parsedUrl();
-
- expect(url.hash).toContain('note/index');
+ .loginAndModule('employee', 'client')
+ .accessToSearchResult('Bruce Banner')
+ .accessToSection('client.card.note.index');
});
it(`should click on the add note button`, async () => {
diff --git a/e2e/paths/client-module/09_add_credit.spec.js b/e2e/paths/client-module/09_add_credit.spec.js
index 35c5b5c34..880d944cc 100644
--- a/e2e/paths/client-module/09_add_credit.spec.js
+++ b/e2e/paths/client-module/09_add_credit.spec.js
@@ -6,29 +6,9 @@ describe('Client Add credit path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('salesAssistant', 'client');
- });
-
- it('should search for the user Hank Pym', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Hank Pym')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client's credit`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Hank Pym')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientCredit.creditButton)
- .waitForURL('credit/index')
- .parsedUrl();
-
- expect(url.hash).toContain('credit/index');
+ .loginAndModule('salesAssistant', 'client')
+ .accessToSearchResult('Hank Pym')
+ .accessToSection('client.card.credit.index');
});
it(`should click on the add credit button`, async () => {
diff --git a/e2e/paths/client-module/10_add_greuge.spec.js b/e2e/paths/client-module/10_add_greuge.spec.js
index 75c2d76b9..9859fd07e 100644
--- a/e2e/paths/client-module/10_add_greuge.spec.js
+++ b/e2e/paths/client-module/10_add_greuge.spec.js
@@ -6,29 +6,9 @@ describe('Client Add greuge path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('salesAssistant', 'client');
- });
-
- it('should search for the user Petter Parker', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client's greuge`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientGreuge.greugeButton)
- .waitForURL('greuge/index')
- .parsedUrl();
-
- expect(url.hash).toContain('greuge/index');
+ .loginAndModule('salesAssistant', 'client')
+ .accessToSearchResult('Petter Parker')
+ .accessToSection('client.card.greuge.index');
});
it(`should click on the add greuge button`, async () => {
diff --git a/e2e/paths/client-module/11_mandate.spec.js b/e2e/paths/client-module/11_mandate.spec.js
index 81467d8fa..fe29c03f8 100644
--- a/e2e/paths/client-module/11_mandate.spec.js
+++ b/e2e/paths/client-module/11_mandate.spec.js
@@ -6,30 +6,9 @@ describe('Client mandate path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('salesPerson', 'client');
- });
-
- it('should search for the user Petter Parker', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client's mandate`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientsIndex.othersButton)
- .waitToClick(selectors.clientMandate.mandateButton)
- .waitForURL('mandate')
- .parsedUrl();
-
- expect(url.hash).toContain('mandate');
+ .loginAndModule('salesPerson', 'client')
+ .accessToSearchResult('Petter Parker')
+ .accessToSection('client.card.mandate');
});
it('should confirm the client has a mandate of the CORE type', async () => {
diff --git a/e2e/paths/client-module/12_lock_of_verified_data.spec.js b/e2e/paths/client-module/12_lock_of_verified_data.spec.js
index 5a6c7f03e..30d28e541 100644
--- a/e2e/paths/client-module/12_lock_of_verified_data.spec.js
+++ b/e2e/paths/client-module/12_lock_of_verified_data.spec.js
@@ -7,38 +7,9 @@ describe('Client lock verified data path', () => {
describe('as salesPerson', () => {
beforeAll(() => {
nightmare
- .loginAndModule('salesPerson', 'client');
- });
-
- it('should search for the user Petter Parker', async () => {
- const resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client's fiscal data`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientFiscalData.fiscalDataButton)
- .waitForURL('fiscal-data')
- .parsedUrl();
-
- expect(url.hash).toContain('fiscal-data');
- });
-
- it(`should click on the fiscal data button to start editing`, async () => {
- const url = await nightmare
- .waitToClick(selectors.clientFiscalData.fiscalDataButton)
- .waitForURL('fiscal-data')
- .parsedUrl();
-
- expect(url.hash).toContain('fiscal-data');
+ .loginAndModule('salesPerson', 'client')
+ .accessToSearchResult('Petter Parker')
+ .accessToSection('client.card.fiscalData');
});
it('should confirm verified data button is disabled for salesPerson', async () => {
diff --git a/e2e/paths/client-module/13_log.spec.js b/e2e/paths/client-module/13_log.spec.js
index dc2c7fd25..03d930340 100644
--- a/e2e/paths/client-module/13_log.spec.js
+++ b/e2e/paths/client-module/13_log.spec.js
@@ -6,29 +6,9 @@ describe('Client log path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('employee', 'client');
- });
-
- it('should search for the user David Charles Haller', async () => {
- let resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'DavidCharlesHaller')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client's fiscal data`, async () => {
- let url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'DavidCharlesHaller')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientBasicData.basicDataButton)
- .waitForURL('basic-data')
- .parsedUrl();
-
- expect(url.hash).toContain('basic-data');
+ .loginAndModule('employee', 'client')
+ .accessToSearchResult('DavidCharlesHaller')
+ .accessToSection('client.card.basicData');
});
it('should update the clients name', async () => {
diff --git a/e2e/paths/client-module/14_risk.spec.js b/e2e/paths/client-module/14_risk.spec.js
index c5302b6db..d20532a26 100644
--- a/e2e/paths/client-module/14_risk.spec.js
+++ b/e2e/paths/client-module/14_risk.spec.js
@@ -6,29 +6,9 @@ describe('Client risk path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('administrative', 'client');
- });
-
- it('should search for the user Petter Parker', async () => {
- let resultCount = await nightmare
- .wait(selectors.clientsIndex.searchClientInput)
- .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
- .click(selectors.clientsIndex.searchButton)
- .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
- .countElement(selectors.clientsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the client's risk`, async () => {
- let url = await nightmare
- .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
- .waitToClick(selectors.clientsIndex.searchResult)
- .waitToClick(selectors.clientRisk.riskButton)
- .waitForURL('/risk')
- .parsedUrl();
-
- expect(url.hash).toContain('/risk');
+ .loginAndModule('administrative', 'client')
+ .accessToSearchResult('Petter Parker')
+ .accessToSection('client.card.risk.index');
});
it('should click the new payment button', async () => {
diff --git a/e2e/paths/item-module/02_edit_item_basic_data.spec.js b/e2e/paths/item-module/02_edit_item_basic_data.spec.js
index a5c7e733d..ca108ac40 100644
--- a/e2e/paths/item-module/02_edit_item_basic_data.spec.js
+++ b/e2e/paths/item-module/02_edit_item_basic_data.spec.js
@@ -6,29 +6,9 @@ describe('Item Edit basic data path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('buyer', 'item');
- });
-
- it('should search for the item Gem of Mind', async () => {
- const resultCount = await nightmare
- .wait(selectors.itemsIndex.searchItemInput)
- .type(selectors.itemsIndex.searchItemInput, 'Gem of Mind')
- .click(selectors.itemsIndex.searchButton)
- .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
- .countElement(selectors.itemsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the item basic data`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind')
- .waitToClick(selectors.itemsIndex.searchResult)
- .waitToClick(selectors.itemBasicData.basicDataButton)
- .waitForURL('data')
- .parsedUrl();
-
- expect(url.hash).toContain('data');
+ .loginAndModule('buyer', 'item')
+ .accessToSearchResult('Gem of Mind')
+ .accessToSection('item.card.data');
});
it(`should edit the item basic data`, async () => {
diff --git a/e2e/paths/item-module/03_edit_item_tax.spec.js b/e2e/paths/item-module/03_edit_item_tax.spec.js
index efa22d7c8..2db067481 100644
--- a/e2e/paths/item-module/03_edit_item_tax.spec.js
+++ b/e2e/paths/item-module/03_edit_item_tax.spec.js
@@ -6,29 +6,9 @@ describe('Item edit tax path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('buyer', 'item');
- });
-
- it('should search for the item Gem of Time', async () => {
- const resultCount = await nightmare
- .wait(selectors.itemsIndex.searchItemInput)
- .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
- .click(selectors.itemsIndex.searchButton)
- .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
- .countElement(selectors.itemsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the item tax`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
- .waitToClick(selectors.itemsIndex.searchResult)
- .waitToClick(selectors.itemTax.taxButton)
- .waitForURL('tax')
- .parsedUrl();
-
- expect(url.hash).toContain('tax');
+ .loginAndModule('buyer', 'item')
+ .accessToSearchResult('Gem of Time')
+ .accessToSection('item.card.tax');
});
it(`should add the item tax to all countries`, async () => {
diff --git a/e2e/paths/item-module/04_create_item_tags.spec.js b/e2e/paths/item-module/04_create_item_tags.spec.js
index 6cb89b406..075dfd478 100644
--- a/e2e/paths/item-module/04_create_item_tags.spec.js
+++ b/e2e/paths/item-module/04_create_item_tags.spec.js
@@ -6,29 +6,9 @@ describe('Item create tags path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('buyer', 'item');
- });
-
- it('should search for the item Gem of Time', async () => {
- const resultCount = await nightmare
- .wait(selectors.itemsIndex.searchItemInput)
- .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
- .click(selectors.itemsIndex.searchButton)
- .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
- .countElement(selectors.itemsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the item tags`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
- .waitToClick(selectors.itemsIndex.searchResult)
- .waitToClick(selectors.itemTags.tagsButton)
- .waitForURL('tags')
- .parsedUrl();
-
- expect(url.hash).toContain('tags');
+ .loginAndModule('buyer', 'item')
+ .accessToSearchResult('Gem of Time')
+ .accessToSection('item.card.tags');
});
it(`should create a new tag and delete a former one`, async () => {
diff --git a/e2e/paths/item-module/05_create_item_niche.spec.js b/e2e/paths/item-module/05_create_item_niche.spec.js
index 2a3cc014e..a3c2b1d3d 100644
--- a/e2e/paths/item-module/05_create_item_niche.spec.js
+++ b/e2e/paths/item-module/05_create_item_niche.spec.js
@@ -6,29 +6,9 @@ describe('Item create niche path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('buyer', 'item');
- });
-
- it('should search for the item Gem of Time', async () => {
- const resultCount = await nightmare
- .wait(selectors.itemsIndex.searchItemInput)
- .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
- .click(selectors.itemsIndex.searchButton)
- .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
- .countElement(selectors.itemsIndex.searchResult);
-
- expect(resultCount).toEqual(1);
- });
-
- it(`should click on the search result to access to the item niches`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
- .waitToClick(selectors.itemsIndex.searchResult)
- .waitToClick(selectors.itemNiches.nicheButton)
- .waitForURL('niche')
- .parsedUrl();
-
- expect(url.hash).toContain('niche');
+ .loginAndModule('buyer', 'item')
+ .accessToSearchResult('Gem of Time')
+ .accessToSection('item.card.niche');
});
it(`should click create a new niche and delete a former one`, async () => {
diff --git a/e2e/paths/item-module/06_create_item_botanical.spec.js b/e2e/paths/item-module/06_create_item_botanical.spec.js
index 2cee46534..5ba0eb653 100644
--- a/e2e/paths/item-module/06_create_item_botanical.spec.js
+++ b/e2e/paths/item-module/06_create_item_botanical.spec.js
@@ -6,29 +6,9 @@ describe('Item Create botanical path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('buyer', 'item');
- });
-
- it('should search for the item Mjolnir', async () => {
- const result = await nightmare
- .wait(selectors.itemsIndex.searchItemInput)
- .type(selectors.itemsIndex.searchItemInput, 'Mjolnir')
- .click(selectors.itemsIndex.searchButton)
- .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
- .countElement(selectors.itemsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the item botanical`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir')
- .waitToClick(selectors.itemsIndex.searchResult)
- .waitToClick(selectors.itemBotanical.botanicalButton)
- .waitForURL('botanical')
- .parsedUrl();
-
- expect(url.hash).toContain('botanical');
+ .loginAndModule('buyer', 'item')
+ .accessToSearchResult('Mjolnir')
+ .accessToSection('item.card.botanical');
});
it(`should create a new botanical for the item with id Mjolnir`, async () => {
diff --git a/e2e/paths/item-module/07_create_item_barcode.spec.js b/e2e/paths/item-module/07_create_item_barcode.spec.js
index 7cda344cc..d3b55d3fc 100644
--- a/e2e/paths/item-module/07_create_item_barcode.spec.js
+++ b/e2e/paths/item-module/07_create_item_barcode.spec.js
@@ -6,29 +6,9 @@ describe('Item Create barcodes path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('buyer', 'item');
- });
-
- it('should search for the item Gem of Time', async () => {
- const result = await nightmare
- .wait(selectors.itemsIndex.searchItemInput)
- .type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
- .click(selectors.itemsIndex.searchButton)
- .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
- .countElement(selectors.itemsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the item barcodes`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
- .waitToClick(selectors.itemsIndex.searchResult)
- .waitToClick(selectors.itemBarcodes.barcodeButton)
- .waitForURL('barcode')
- .parsedUrl();
-
- expect(url.hash).toContain('barcode');
+ .loginAndModule('buyer', 'item')
+ .accessToSearchResult('Gem of Time')
+ .accessToSection('item.card.itemBarcode');
});
it(`should click create a new code and delete a former one`, async () => {
diff --git a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js b/e2e/paths/ticket-module/01_create_ticket_observations.spec.js
index e12de99cd..c42788644 100644
--- a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js
+++ b/e2e/paths/ticket-module/01_create_ticket_observations.spec.js
@@ -7,29 +7,9 @@ describe('Ticket', () => {
beforeAll(() => {
return nightmare
- .loginAndModule('employee', 'ticket');
- });
-
- it('should search for the ticket with id 1', async () => {
- let result = await nightmare
- .wait(selectors.ticketsIndex.searchTicketInput)
- .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
- .click(selectors.ticketsIndex.searchButton)
- .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
- .countElement(selectors.ticketsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the ticket notes`, async () => {
- let url = await nightmare
- .waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
- .waitToClick(selectors.ticketsIndex.searchResult)
- .waitToClick(selectors.ticketNotes.notesButton)
- .waitForURL('observation')
- .parsedUrl();
-
- expect(url.hash).toContain('observation');
+ .loginAndModule('employee', 'ticket')
+ .accessToSearchResult('id:1')
+ .accessToSection('ticket.card.observation');
});
it(`should click create a new note and delete a former one`, async () => {
diff --git a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js
index 8a66d130d..77b250799 100644
--- a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js
+++ b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js
@@ -7,29 +7,9 @@ describe('Ticket', () => {
beforeAll(() => {
return nightmare
- .loginAndModule('production', 'ticket');
- });
-
- it('should search for the ticket with id 1', async () => {
- const result = await nightmare
- .wait(selectors.ticketsIndex.searchTicketInput)
- .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
- .click(selectors.ticketsIndex.searchButton)
- .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
- .countElement(selectors.ticketsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the ticket expeditions`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
- .waitToClick(selectors.ticketsIndex.searchResult)
- .waitToClick(selectors.ticketExpedition.expeditionButton)
- .waitForURL('expedition')
- .parsedUrl();
-
- expect(url.hash).toContain('expedition');
+ .loginAndModule('production', 'ticket')
+ .accessToSearchResult('id:1')
+ .accessToSection('ticket.card.expedition');
});
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async () => {
diff --git a/e2e/paths/ticket-module/03_list_sale.spec.js b/e2e/paths/ticket-module/03_list_sale.spec.js
index d2cfe9f33..879231f58 100644
--- a/e2e/paths/ticket-module/03_list_sale.spec.js
+++ b/e2e/paths/ticket-module/03_list_sale.spec.js
@@ -6,29 +6,9 @@ describe('Ticket List sale path', () => {
beforeAll(() => {
return nightmare
- .loginAndModule('employee', 'ticket');
- });
-
- it('should search for the ticket 8', async () => {
- const result = await nightmare
- .wait(selectors.ticketsIndex.searchTicketInput)
- .type(selectors.ticketsIndex.searchTicketInput, 'id:8')
- .click(selectors.ticketsIndex.searchButton)
- .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
- .countElement(selectors.ticketsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the ticket's sale`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 24')
- .waitToClick(selectors.ticketsIndex.searchResult)
- .waitToClick(selectors.ticketSales.saleButton)
- .waitForURL('/sale')
- .parsedUrl();
-
- expect(url.hash).toContain('/sale');
+ .loginAndModule('employee', 'ticket')
+ .accessToSearchResult('id:1')
+ .accessToSection('ticket.card.sale');
});
it('should confirm the first ticket sale contains the colour', async () => {
diff --git a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js
index 500a91750..1f514fb3a 100644
--- a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js
+++ b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js
@@ -6,29 +6,9 @@ describe('Ticket Create packages path', () => {
beforeAll(() => {
return nightmare
- .loginAndModule('employee', 'ticket');
- });
-
- it('should search for the ticket 1', async () => {
- const result = await nightmare
- .wait(selectors.ticketsIndex.searchTicketInput)
- .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
- .click(selectors.ticketsIndex.searchButton)
- .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
- .countElement(selectors.ticketsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the ticket packages`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.ticketsIndex.searchResultAddress, 'address 21')
- .waitToClick(selectors.ticketsIndex.searchResult)
- .waitToClick(selectors.ticketPackages.packagesButton)
- .waitForURL('package/index')
- .parsedUrl();
-
- expect(url.hash).toContain('package/index');
+ .loginAndModule('employee', 'ticket')
+ .accessToSearchResult('id:1')
+ .accessToSection('ticket.card.package.index');
});
it(`should delete the first package and receive and error to save a new one with blank quantity`, async () => {
diff --git a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js b/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js
index 747668def..5f249a794 100644
--- a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js
+++ b/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js
@@ -7,29 +7,9 @@ describe('Ticket', () => {
beforeAll(() => {
return nightmare
- .loginAndModule('production', 'ticket');
- });
-
- it('should search for the ticket 1', async () => {
- let result = await nightmare
- .wait(selectors.ticketsIndex.searchTicketInput)
- .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
- .click(selectors.ticketsIndex.searchButton)
- .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
- .countElement(selectors.ticketsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the ticket Tracking`, async () => {
- let url = await nightmare
- .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
- .waitToClick(selectors.ticketsIndex.searchResult)
- .waitToClick(selectors.ticketTracking.trackingButton)
- .waitForURL('tracking/index')
- .parsedUrl();
-
- expect(url.hash).toContain('tracking/index');
+ .loginAndModule('production', 'ticket')
+ .accessToSearchResult('id:1')
+ .accessToSection('ticket.card.tracking.index');
});
it('should access to the create state view by clicking the create floating button', async () => {
diff --git a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js
index 5829183c7..cd0244c5c 100644
--- a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js
+++ b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js
@@ -6,29 +6,9 @@ describe('Ticket Edit basic data path', () => {
beforeAll(() => {
return nightmare
- .loginAndModule('employee', 'ticket');
- });
-
- it('should search for the ticket 11', async () => {
- let result = await nightmare
- .wait(selectors.ticketsIndex.searchTicketInput)
- .type(selectors.ticketsIndex.searchTicketInput, 'id:11')
- .click(selectors.ticketsIndex.searchButton)
- .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
- .countElement(selectors.ticketsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the ticket Basic Data`, async () => {
- let url = await nightmare
- .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne
- .waitToClick(selectors.ticketsIndex.searchResult)
- .waitToClick(selectors.ticketBasicData.basicDataButton)
- .waitForURL('data/step-one')
- .parsedUrl();
-
- expect(url.hash).toContain('data/step-one');
+ .loginAndModule('employee', 'ticket')
+ .accessToSearchResult('id:11')
+ .accessToSection('ticket.card.data.stepOne');
});
it(`should edit the client and address of the ticket then click next`, async () => {
diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js
index e3c21a0a3..555a750fe 100644
--- a/e2e/paths/ticket-module/07_edit_sale.spec.js
+++ b/e2e/paths/ticket-module/07_edit_sale.spec.js
@@ -6,29 +6,9 @@ describe('Ticket Edit sale path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('salesPerson', 'ticket');
- });
-
- it('should search for a specific ticket', async () => {
- const result = await nightmare
- .wait(selectors.ticketsIndex.searchTicketInput)
- .type(selectors.ticketsIndex.searchTicketInput, 'id:16')
- .click(selectors.ticketsIndex.searchButton)
- .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
- .countElement(selectors.ticketsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the ticket Sale`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
- .waitToClick(selectors.ticketsIndex.searchResult)
- .waitToClick(selectors.ticketSales.saleButton)
- .waitForURL('/sale')
- .parsedUrl();
-
- expect(url.hash).toContain('/sale');
+ .loginAndModule('salesPerson', 'ticket')
+ .accessToSearchResult('id:16')
+ .accessToSection('ticket.card.sale');
});
it(`should click on the first claim id to navigate over there`, async () => {
diff --git a/e2e/paths/ticket-module/08_list_components.spec.js b/e2e/paths/ticket-module/08_list_components.spec.js
index 04df126c8..ec043da97 100644
--- a/e2e/paths/ticket-module/08_list_components.spec.js
+++ b/e2e/paths/ticket-module/08_list_components.spec.js
@@ -6,29 +6,9 @@ describe('Ticket List components path', () => {
beforeAll(() => {
return nightmare
- .loginAndModule('employee', 'ticket');
- });
-
- it('should search for the ticket 1', async () => {
- const result = await nightmare
- .wait(selectors.ticketsIndex.searchTicketInput)
- .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
- .click(selectors.ticketsIndex.searchButton)
- .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
- .countElement(selectors.ticketsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the ticket components`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
- .waitToClick(selectors.ticketsIndex.searchResult)
- .waitToClick(selectors.ticketComponents.componentsButton)
- .waitForURL('components')
- .parsedUrl();
-
- expect(url.hash).toContain('components');
+ .loginAndModule('employee', 'ticket')
+ .accessToSearchResult('id:1')
+ .accessToSection('ticket.card.components');
});
it('should confirm the total base is correct', async () => {
diff --git a/e2e/paths/ticket-module/10_ticket_request.spec.js b/e2e/paths/ticket-module/10_ticket_request.spec.js
index e269e03e8..47515c6c4 100644
--- a/e2e/paths/ticket-module/10_ticket_request.spec.js
+++ b/e2e/paths/ticket-module/10_ticket_request.spec.js
@@ -6,29 +6,9 @@ describe('Ticket purchase request path', () => {
beforeAll(() => {
nightmare
- .loginAndModule('salesPerson', 'ticket');
- });
-
- it('should search for a specific ticket', async () => {
- const result = await nightmare
- .wait(selectors.ticketsIndex.searchTicketInput)
- .type(selectors.ticketsIndex.searchTicketInput, 'id:16')
- .click(selectors.ticketsIndex.searchButton)
- .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
- .countElement(selectors.ticketsIndex.searchResult);
-
- expect(result).toEqual(1);
- });
-
- it(`should click on the search result to access to the ticket Purchase request`, async () => {
- const url = await nightmare
- .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
- .waitToClick(selectors.ticketsIndex.searchResult)
- .waitToClick(selectors.ticketRequests.requestButton)
- .waitForURL('/request')
- .parsedUrl();
-
- expect(url.hash).toContain('/request');
+ .loginAndModule('salesPerson', 'ticket')
+ .accessToSearchResult('id:16')
+ .accessToSection('ticket.card.request.index');
});
it(`should add a new request`, async () => {