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); }); });