e2e path for starred modules
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-03-01 17:43:34 +01:00
parent 5d528ff768
commit d6e440751b
6 changed files with 48 additions and 4 deletions

View File

@ -19,7 +19,6 @@ describe('getStarredModules()', () => {
});
it(`should return the starred modules for a given user`, async() => {
console.log('GET');
const newStarred = await app.models.StarredModule.create({workerFk: 9, moduleFk: 'Clients'});
const starredModules = await app.models.StarredModule.getStarredModules(ctx);

View File

@ -21,7 +21,6 @@ describe('toggleStarredModule()', () => {
});
it('should create a new starred module and then remove it by calling the method again with same args', async() => {
console.log('TOGGLE');
const starredModule = await app.models.StarredModule.toggleStarredModule(ctx, 'Orders');
let starredModules = await app.models.StarredModule.getStarredModules(ctx);

View File

@ -23,6 +23,11 @@ export default {
acceptButton: '.vn-confirm.shown button[response=accept]',
searchButton: 'vn-searchbar vn-icon[icon="search"]'
},
moduleIndex: {
anyStarredModule: 'vn-home > div:nth-child(1) > div.modules > a',
firstModulePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="push_pin"]',
firstModuleRemovePinIcon: 'vn-home a:nth-child(1) vn-icon[icon="remove_circle"]'
},
clientsIndex: {
createClientButton: `vn-float-button`
},

View File

@ -0,0 +1,43 @@
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);
});
});

View File

@ -25,8 +25,6 @@ export default class Controller extends Component {
if (module.starred) this.starredCount ++;
else this.regularCount ++;
});
console.log('this.starredCount', this.starredCount);
console.log('this.reg', this.regularCount);
}
getStarredModules() {