salix/e2e/paths/item-module/06_create_item_barcode.spec.js

72 lines
2.3 KiB
JavaScript
Raw Normal View History

import config from '../../helpers/config.js';
import createNightmare from '../../helpers/nightmare';
import selectors from '../../helpers/selectors.js';
import {catchErrors} from '../../../services/utils/jasmineHelpers';
const nightmare = createNightmare();
const moduleAccessViewHashURL = '#!/';
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
describe('create item barcodes path', () => {
it('should log in', done => {
nightmare
.login()
.waitForURL(moduleAccessViewHashURL)
.url()
.then(url => {
expect(url).toEqual(config.url + moduleAccessViewHashURL);
done();
})
.catch(catchErrors(done));
});
it('should make sure the language is English', done => {
nightmare
.changeLanguageToEnglish()
.then(() => {
done();
})
.catch(catchErrors(done));
});
it('should access to the items index by clicking the items button', done => {
nightmare
.click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton)
.url()
.then(url => {
expect(url).toEqual(config.url + '#!/item/list');
done();
})
.catch(catchErrors(done));
});
it('should search for the item Gem of Time', done => {
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);
done();
})
.catch(catchErrors(done));
});
// it(`should click on the search result to access to the item barcodes`, done => {
// nightmare
// .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
// .waitToClick(selectors.itemsIndex.searchResult)
// .waitToClick(selectors.itemBarcodes.barcodeButton)
// .waitForURL('barcode')
// .url()
// .then(url => {
// expect(url).toContain('barcode');
// done();
// })
// .catch(catchErrors(done));
// });
});