2020-02-12 06:21:53 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
|
|
|
describe('Travel thermograph path', () => {
|
2020-05-27 12:34:34 +00:00
|
|
|
const thermographName = '7H3-37H3RN4L-FL4M3';
|
2020-02-12 06:21:53 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('buyer', 'travel');
|
|
|
|
await page.accessToSearchResult('3');
|
|
|
|
await page.accessToSection('travel.card.thermograph.index');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should reach the thermograph section', async() => {
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('travel.card.thermograph.index');
|
2020-02-12 06:21:53 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should click the add thermograph floating button', async() => {
|
|
|
|
await page.waitToClick(selectors.travelThermograph.add);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('travel.card.thermograph.create');
|
2020-02-12 06:21:53 +00:00
|
|
|
});
|
|
|
|
|
2020-05-27 12:34:34 +00:00
|
|
|
it('should click on the add thermograph icon of the thermograph autocomplete', async() => {
|
|
|
|
await page.waitToClick(selectors.travelThermograph.addThermographIcon);
|
|
|
|
await page.write(selectors.travelThermograph.newThermographId, thermographName);
|
|
|
|
await page.autocompleteSearch(selectors.travelThermograph.newThermographModel, 'TEMPMATE');
|
|
|
|
await page.autocompleteSearch(selectors.travelThermograph.newThermographWarehouse, 'Warehouse Two');
|
|
|
|
await page.autocompleteSearch(selectors.travelThermograph.newThermographTemperature, 'WARM');
|
|
|
|
await page.waitToClick(selectors.travelThermograph.createThermographButton);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should select the file to upload', async() => {
|
2020-02-12 06:21:53 +00:00
|
|
|
let currentDir = process.cwd();
|
|
|
|
let filePath = `${currentDir}/e2e/dms/ecc/3.jpeg`;
|
|
|
|
|
|
|
|
const [fileChooser] = await Promise.all([
|
|
|
|
page.waitForFileChooser(),
|
|
|
|
page.waitToClick(selectors.travelThermograph.uploadIcon)
|
|
|
|
]);
|
|
|
|
await fileChooser.accept([filePath]);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.travelThermograph.upload);
|
2020-05-27 12:34:34 +00:00
|
|
|
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
const state = await page.getState();
|
|
|
|
|
|
|
|
expect(message.type).toBe('success');
|
|
|
|
expect(state).toBe('travel.card.thermograph.index');
|
2020-02-12 06:21:53 +00:00
|
|
|
});
|
|
|
|
|
2020-05-27 12:34:34 +00:00
|
|
|
it('should check everything was saved correctly', async() => {
|
|
|
|
const result = await page.waitToGetProperty(selectors.travelThermograph.createdThermograph, 'innerText');
|
2020-02-12 06:21:53 +00:00
|
|
|
|
2020-05-27 12:34:34 +00:00
|
|
|
expect(result).toContain(thermographName);
|
2020-02-12 06:21:53 +00:00
|
|
|
});
|
|
|
|
});
|