64 lines
2.4 KiB
JavaScript
64 lines
2.4 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Travel thermograph path', () => {
|
|
const thermographName = '7H3-37H3RN4L-FL4M3';
|
|
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 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() => {
|
|
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);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
const state = await page.getState();
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
expect(state).toBe('travel.card.thermograph.index');
|
|
});
|
|
|
|
it('should check everything was saved correctly', async() => {
|
|
const result = await page.waitToGetProperty(selectors.travelThermograph.createdThermograph, 'innerText');
|
|
|
|
expect(result).toContain(thermographName);
|
|
});
|
|
});
|