2020-02-12 06:21:53 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
|
|
|
describe('Travel thermograph path', () => {
|
|
|
|
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
|
|
|
});
|
|
|
|
|
|
|
|
it('should select the thermograph and then the file to upload', async() => {
|
|
|
|
let currentDir = process.cwd();
|
|
|
|
let filePath = `${currentDir}/e2e/dms/ecc/3.jpeg`;
|
|
|
|
await page.autocompleteSearch(selectors.travelThermograph.thermographID, '138350-0');
|
|
|
|
|
|
|
|
const [fileChooser] = await Promise.all([
|
|
|
|
page.waitForFileChooser(),
|
|
|
|
page.waitToClick(selectors.travelThermograph.uploadIcon)
|
|
|
|
]);
|
|
|
|
await fileChooser.accept([filePath]);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.travelThermograph.upload);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should reload the section and check everything was saved', async() => {
|
|
|
|
let createdThermograph = await page.waitToGetProperty(selectors.travelThermograph.createdThermograph, 'innerText');
|
|
|
|
|
|
|
|
expect(createdThermograph).toContain('138350-0');
|
|
|
|
});
|
|
|
|
});
|