salix/e2e/paths/01-salix/02_starred-modules.spec.js

44 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-03-01 16:43:34 +00:00
import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
describe('Starred modules path', async() => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.login('employee');
});
afterAll(async() => {
await browser.close();
});
it('should make sure there are no modules pinned yet', async() => {
const count = await page.countElement(selectors.moduleIndex.anyStarredModule);
expect(count).toEqual(0);
});
it('should set a module as favore', async() => {
await page.waitToClick(selectors.moduleIndex.firstModulePinIcon);
const message = await page.waitForSnackbar();
const count = await page.countElement(selectors.moduleIndex.anyStarredModule);
expect(message.text).toContain('Data saved!');
expect(count).toEqual(1);
});
it('should remove the module from favores', async() => {
await page.waitToClick(selectors.moduleIndex.firstModuleRemovePinIcon);
const message = await page.waitForSnackbar();
const count = await page.countElement(selectors.moduleIndex.anyStarredModule);
expect(message.text).toContain('Data saved!');
expect(count).toEqual(0);
});
});