salix/e2e/paths/12-entry/05_basicData.spec.js

122 lines
4.5 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Entry basic data path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'entry');
await page.accessToSearchResult('2');
await page.accessToSection('entry.card.basicData');
});
afterAll(async() => {
await browser.close();
});
it('should edit the basic data', async() => {
await page.write(selectors.entryBasicData.reference, 'new movement 8');
await page.write(selectors.entryBasicData.invoiceNumber, 'new movement 8');
await page.write(selectors.entryBasicData.notes, 'new notes');
await page.write(selectors.entryBasicData.observations, ' edited');
await page.autocompleteSearch(selectors.entryBasicData.supplier, 'Plants nick');
await page.autocompleteSearch(selectors.entryBasicData.currency, 'eur');
await page.clearInput(selectors.entryBasicData.commission);
await page.write(selectors.entryBasicData.commission, '100');
await page.autocompleteSearch(selectors.entryBasicData.company, 'CCs');
await page.waitToClick(selectors.entryBasicData.ordered);
await page.waitToClick(selectors.entryBasicData.confirmed);
await page.waitToClick(selectors.entryBasicData.inventory);
await page.waitToClick(selectors.entryBasicData.raid);
await page.waitToClick(selectors.entryBasicData.booked);
await page.waitToClick(selectors.entryBasicData.save);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should confirm the reference was edited', async() => {
await page.reloadSection('entry.card.basicData');
const result = await page.waitToGetProperty(selectors.entryBasicData.reference, 'value');
expect(result).toEqual('new movement 8');
});
it('should confirm the invoiceNumber was edited', async() => {
await page.reloadSection('entry.card.basicData');
const result = await page.waitToGetProperty(selectors.entryBasicData.invoiceNumber, 'value');
expect(result).toEqual('new movement 8');
});
it('should confirm the note was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.notes, 'value');
expect(result).toEqual('new notes');
});
it('should confirm the observation was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.observations, 'value');
expect(result).toEqual('observation two edited');
});
it('should confirm the supplier was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.supplier, 'value');
expect(result).toEqual('1 - Plants nick');
});
it('should confirm the currency was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.currency, 'value');
expect(result).toEqual('EUR');
});
it('should confirm the commission was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.commission, 'value');
expect(result).toEqual('100');
});
it('should confirm the company was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.company, 'value');
expect(result).toEqual('CCs');
});
it('should confirm ordered was edited', async() => {
const result = await page.checkboxState(selectors.entryBasicData.ordered);
expect(result).toBe('checked');
});
it('should confirm confirmed was edited', async() => {
const result = await page.checkboxState(selectors.entryBasicData.confirmed);
expect(result).toBe('checked');
});
it('should confirm inventory was edited', async() => {
const result = await page.checkboxState(selectors.entryBasicData.inventory);
expect(result).toBe('checked');
});
it('should confirm raid was edited', async() => {
const result = await page.checkboxState(selectors.entryBasicData.raid);
expect(result).toBe('checked');
});
it('should confirm booked was edited', async() => {
const result = await page.checkboxState(selectors.entryBasicData.booked);
expect(result).toBe('checked');
});
});