e2e path for niches completed plus extension name corrected

This commit is contained in:
Carlos Jimenez 2018-02-20 22:35:54 +01:00
parent da8610d814
commit 1e601ab6b6
15 changed files with 94 additions and 17 deletions

View File

@ -37,7 +37,7 @@ Nightmare.action('waitForLogin', function(done) {
.then(done);
});
Nightmare.action('urlParsed', function(done) {
Nightmare.action('parsedUrl', function(done) {
this.url()
.then(url => {
done(null, new URL(url));

View File

@ -151,8 +151,15 @@ export default {
},
itemNiches: {
nicheButton: `${components.vnMenuItem}[ui-sref="item.card.niche"]`,
addNicheButton: `${components.vnIcon}[icon="add_circle"]`,
firstWarehouseSelect: `${components.vnAutocomplete}[field="niche.warehouseFk"] > vn-vertical > ${components.vnTextfield}`,
firstWarehouseSelectFirstOption: `${components.vnAutocomplete}[field="niche.warehouseFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`,
secondNicheRemoveButton: `vn-horizontal:nth-child(2) > vn-one > ${components.vnIcon}[icon="remove_circle_outline"]`
firstWarehouseSelectSecondOption: `${components.vnAutocomplete}[field="niche.warehouseFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`,
thirdWarehouseSelect: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="niche.warehouseFk"] > vn-vertical > ${components.vnTextfield}`,
thirdWarehouseSelectFourthOption: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="niche.warehouseFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(4)`,
secondNicheRemoveButton: `vn-horizontal:nth-child(3) > vn-one > ${components.vnIcon}[icon="remove_circle_outline"]`,
firstCodeInput: `vn-horizontal:nth-child(2) > ${components.vnTextfield}`,
thirdCodeInput: `vn-horizontal:nth-child(4) > ${components.vnTextfield}`,
submitNichesButton: `${components.vnSubmit}`
}
};

View File

@ -8,7 +8,7 @@ describe('create client path', () => {
return nightmare
.click(selectors.moduleAccessView.clientsSectionButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});
@ -30,7 +30,7 @@ describe('create client path', () => {
return nightmare
.click(selectors.clientsIndex.createClientButton)
.wait(selectors.createClientView.createButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/create');
});
@ -144,7 +144,7 @@ describe('create client path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -10,7 +10,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -10,7 +10,7 @@ describe('Edit fiscalData path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -10,7 +10,7 @@ describe('Edit pay method path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -10,7 +10,7 @@ describe('Add address path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -10,7 +10,7 @@ describe('Add address notes path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -10,7 +10,7 @@ describe('Edit web access path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -10,7 +10,7 @@ describe('Add notes path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -10,7 +10,7 @@ describe('Add credit path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -10,7 +10,7 @@ describe('Add greuge path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -10,7 +10,7 @@ describe('mandate path', () => {
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});

View File

@ -0,0 +1,70 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('create item niche path', () => {
const nightmare = createNightmare();
it('should access to the items index by clicking the items button', () => {
return nightmare
.click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/item/list');
});
});
it('should search for the item Gem of Time', () => {
return nightmare
.wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countSearchResults(selectors.itemsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
});
});
it(`should click on the search result to access to the item niches`, () => {
return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemNiches.nicheButton)
.waitForURL('niche')
.url()
.then(url => {
expect(url).toContain('niche');
});
});
it(`should click create a new niche, edit another and delete a former one`, () => {
return nightmare
.waitToClick(selectors.itemNiches.addNicheButton)
.waitToClick(selectors.itemNiches.firstWarehouseSelect)
.waitToClick(selectors.itemNiches.firstWarehouseSelectSecondOption)
.clearInput(selectors.itemNiches.firstCodeInput)
.type(selectors.itemNiches.firstCodeInput, 'New Location')
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
.waitToClick(selectors.itemNiches.thirdWarehouseSelect)
.waitToClick(selectors.itemNiches.thirdWarehouseSelectFourthOption)
.type(selectors.itemNiches.thirdCodeInput, 'a code')
.click(selectors.itemNiches.submitNichesButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Data saved!');
});
});
it(`should confirm the remaining niches are for the second third and fourth warehouses`, () => {
return nightmare
.click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput)
.click(selectors.itemNiches.nicheButton)
.wait(200)
.getInputValue(selectors.itemNiches.thirdCodeInput)
.then(result => {
expect(result).toEqual('a code');
});
});
});

View File

@ -8,7 +8,7 @@ describe('create item barcodes path', () => {
return nightmare
.click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton)
.urlParsed()
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/item/list');
});