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

37 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2020-11-17 15:52:19 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2023-02-21 13:12:06 +00:00
describe('Travel descriptor path', () => {
2020-11-17 15:52:19 +00:00
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'travel');
2023-06-26 10:32:08 +00:00
await page.write(selectors.travelIndex.generalSearchFilter, '3');
2023-03-24 08:21:55 +00:00
await page.keyboard.press('Enter');
2020-11-17 15:52:19 +00:00
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);
2023-06-26 10:32:08 +00:00
expect(result).toBeGreaterThanOrEqual(1);
2020-11-17 15:52:19 +00:00
});
it('should navigate to the first search result', async() => {
await page.waitToClick(selectors.travelIndex.firstSearchResult);
await page.waitForState('travel.card.summary');
2021-01-20 19:28:22 +00:00
const state = await page.getState();
expect(state).toBe('travel.card.summary');
});
2020-11-17 15:52:19 +00:00
});