2018-02-21 11:02:47 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-02-21 11:02:47 +00:00
|
|
|
|
2018-07-18 07:23:51 +00:00
|
|
|
describe('Item', () => {
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Create botanical path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-02-21 11:02:47 +00:00
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
2018-10-11 07:14:26 +00:00
|
|
|
.waitForLogin('buyer');
|
2018-04-05 06:55:47 +00:00
|
|
|
});
|
2018-03-02 11:15:17 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should access to the items index by clicking the items button', done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.click(selectors.moduleAccessView.itemsSectionButton)
|
|
|
|
.wait(selectors.itemsIndex.createItemButton)
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
2018-05-25 08:03:45 +00:00
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:02:47 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should search for the item Mjolnir', done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Mjolnir')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
2018-08-02 12:04:46 +00:00
|
|
|
.countElement(selectors.itemsIndex.searchResult)
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:02:47 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the search result to access to the item botanical`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir')
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.itemBotanical.botanicalButton)
|
|
|
|
.waitForURL('botanical')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('botanical');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:02:47 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should create a new botanical for the item with id Mjolnir`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.type(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
|
|
|
|
.waitToClick(selectors.itemBotanical.genusSelect)
|
|
|
|
.waitToClick(selectors.itemBotanical.genusSelectOptionOne)
|
|
|
|
.waitToClick(selectors.itemBotanical.speciesSelect)
|
|
|
|
.waitToClick(selectors.itemBotanical.speciesSelectOptionOne)
|
|
|
|
.waitToClick(selectors.itemBotanical.submitBotanicalButton)
|
2018-09-17 08:50:15 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
2018-09-17 08:50:15 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:02:47 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should confirm the botanical for item Mjolnir was created`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.click(selectors.itemBasicData.basicDataButton)
|
|
|
|
.wait(selectors.itemBasicData.nameInput)
|
|
|
|
.click(selectors.itemBotanical.botanicalButton)
|
|
|
|
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
|
|
|
|
.getInputValue(selectors.itemBotanical.botanicalInput)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Cicuta maculata');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:02:47 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should confirm the Genus for item Mjolnir was created`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia')
|
|
|
|
.getInputValue(selectors.itemBotanical.genusSelect)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Abelia');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:02:47 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should confirm the Species for item Mjolnir was created`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemBotanical.speciesSelect)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('dealbata');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:02:47 +00:00
|
|
|
});
|
2018-02-21 11:47:48 +00:00
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should edit botanical for the item Mjolnir`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.clearInput(selectors.itemBotanical.botanicalInput)
|
|
|
|
.type(selectors.itemBotanical.botanicalInput, 'Herp Derp')
|
|
|
|
.waitToClick(selectors.itemBotanical.genusSelect)
|
|
|
|
.waitToClick(selectors.itemBotanical.genusSelectOptionTwo)
|
|
|
|
.waitToClick(selectors.itemBotanical.speciesSelect)
|
|
|
|
.waitToClick(selectors.itemBotanical.speciesSelectOptionTwo)
|
|
|
|
.waitToClick(selectors.itemBotanical.submitBotanicalButton)
|
2018-09-17 08:50:15 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-04-05 06:55:47 +00:00
|
|
|
.then(result => {
|
2018-09-17 08:50:15 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:47:48 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should confirm the botanical for item Mjolnir was edited`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.click(selectors.itemBasicData.basicDataButton)
|
|
|
|
.wait(selectors.itemBasicData.nameInput)
|
|
|
|
.click(selectors.itemBotanical.botanicalButton)
|
|
|
|
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp')
|
|
|
|
.getInputValue(selectors.itemBotanical.botanicalInput)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Herp Derp');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:47:48 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should confirm the Genus for item Mjolnir was edited`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies')
|
|
|
|
.getInputValue(selectors.itemBotanical.genusSelect)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('Abies');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:47:48 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should confirm the Species for item Mjolnir was edited`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemBotanical.speciesSelect)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('decurrens');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-21 11:47:48 +00:00
|
|
|
});
|
|
|
|
});
|
2018-02-21 11:02:47 +00:00
|
|
|
});
|