salix/e2e/paths/10-travel/01_thermograph.spec.js

49 lines
1.7 KiB
JavaScript
Raw Normal View History

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() => {
await page.waitForState('travel.card.thermograph.index');
});
it('should click the add thermograph floating button', async() => {
await page.waitToClick(selectors.travelThermograph.add);
await page.waitForState('travel.card.thermograph.create');
});
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');
});
});