salix/e2e/paths/10-travel/03_descriptor.spec.js

37 lines
1.3 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Travel descriptor path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'travel');
await page.write(selectors.travelIndex.generalSearchFilter, '3');
await page.keyboard.press('Enter');
await page.waitForState('travel.card.summary');
});
afterAll(async() => {
await browser.close();
});
it('should click the descriptor button to navigate to the travel index showing all travels with current agency', async() => {
await page.waitToClick(selectors.travelDescriptor.filterByAgencyButton);
await page.waitForState('travel.index');
const result = await page.countElement(selectors.travelIndex.anySearchResult);
expect(result).toBeGreaterThanOrEqual(1);
});
it('should navigate to the first search result', async() => {
await page.waitToClick(selectors.travelIndex.firstSearchResult);
await page.waitForState('travel.card.summary');
const state = await page.getState();
expect(state).toBe('travel.card.summary');
});
});