53 lines
1.7 KiB
JavaScript
53 lines
1.7 KiB
JavaScript
|
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() => {
|
||
|
const result = await page.expectURL('/thermograph/index');
|
||
|
|
||
|
expect(result).toBe(true);
|
||
|
});
|
||
|
|
||
|
it('should click the add thermograph floating button', async() => {
|
||
|
await page.waitToClick(selectors.travelThermograph.add);
|
||
|
const result = await page.expectURL('/thermograph/create');
|
||
|
|
||
|
expect(result).toBe(true);
|
||
|
});
|
||
|
|
||
|
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');
|
||
|
});
|
||
|
});
|