2018-02-26 12:24:47 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/helpers';
|
|
|
|
|
2018-04-05 06:55:47 +00:00
|
|
|
describe('Item', () => {
|
|
|
|
describe('Edit tax path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-02-26 12:24: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-02-26 12:24:47 +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-26 12:24:47 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should search for the item Gem of Time', done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
|
|
|
|
.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-26 12:24:47 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the search result to access to the item tax`, done => {
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.itemTax.taxButton)
|
|
|
|
.waitForURL('tax')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('tax');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 12:24:47 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should add the item tax to all countries`, done => {
|
2018-02-26 12:24:47 +00:00
|
|
|
return nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitToClick(selectors.itemTax.firstClassSelect)
|
|
|
|
.waitToClick(selectors.itemTax.firstClassSelectOptionTwo)
|
|
|
|
.waitToClick(selectors.itemTax.secondClassSelect)
|
|
|
|
.waitToClick(selectors.itemTax.secondClassSelectOptionOne)
|
|
|
|
.waitToClick(selectors.itemTax.thirdClassSelect)
|
|
|
|
.waitToClick(selectors.itemTax.thirdClassSelectOptionTwo)
|
|
|
|
.click(selectors.itemTax.submitTaxButton)
|
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-04-05 06:55:47 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should confirm the item tax class was edited`, done => {
|
2018-02-26 12:24:47 +00:00
|
|
|
return nightmare
|
2018-04-05 06:55:47 +00:00
|
|
|
.click(selectors.itemTags.tagsButton)
|
|
|
|
.wait(selectors.itemTags.firstTagDisabled)
|
2018-10-19 17:54:46 +00:00
|
|
|
.click(selectors.itemTax.taxButton)
|
2018-04-05 06:55:47 +00:00
|
|
|
.waitToClick(selectors.itemTax.taxButton)
|
2018-10-19 17:54:46 +00:00
|
|
|
.waitForTextInInput(selectors.itemTax.firstClassSelect, 'reduced')
|
2018-04-05 06:55:47 +00:00
|
|
|
.getInputValue(selectors.itemTax.firstClassSelect)
|
|
|
|
.then(result => {
|
2018-10-19 17:54:46 +00:00
|
|
|
expect(result).toEqual('Reduced VAT');
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemTax.secondClassSelect);
|
|
|
|
})
|
|
|
|
.then(result => {
|
2018-10-19 17:54:46 +00:00
|
|
|
expect(result).toEqual('General VAT');
|
2018-04-05 06:55:47 +00:00
|
|
|
return nightmare
|
|
|
|
.getInputValue(selectors.itemTax.thirdClassSelect);
|
|
|
|
})
|
|
|
|
.then(result => {
|
2018-10-19 17:54:46 +00:00
|
|
|
expect(result).toEqual('Reduced VAT');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-02-26 12:24:47 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|