diff --git a/.gitignore b/.gitignore index 1a3db7964..8d469628a 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,7 @@ npm-debug.log* /platforms /plugins /www -/www0 +/serve /mobilefirst # Custom diff --git a/jest-puppeteer.config.js b/jest-puppeteer.config.js index 740ce872b..75d3794bf 100644 --- a/jest-puppeteer.config.js +++ b/jest-puppeteer.config.js @@ -15,6 +15,12 @@ module.exports = { dumpio: true, headless: openChrome != 'true', product: 'chrome', + args: [`--window-size=1200,1080`], + defaultViewport: { + width:1200, + height:1080 + } }, browserContext: 'default', + } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ed0927f7e..d0bdfefbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11937,6 +11937,11 @@ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.0.tgz", "integrity": "sha1-4mifjzVvrWLMplo6kcXfX5VRaS8=" }, + "faker": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/faker/-/faker-5.5.3.tgz", + "integrity": "sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g==" + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", diff --git a/package.json b/package.json index a2eee7177..e7caaeb9f 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "date-fns": "^2.17.0", "depd": "^2.0.0", "dotenv": "^10.0.0", + "faker": "^5.5.3", "global": "^4.4.0", "http-server": "^0.12.3", "ibm-mfp-web-push": "^8.0.2020052213", diff --git a/src/app/models/event.model.ts b/src/app/models/event.model.ts index 2415eeb8f..d853cb321 100644 --- a/src/app/models/event.model.ts +++ b/src/app/models/event.model.ts @@ -19,7 +19,7 @@ export class Event{ AppointmentState: number; TimeZone: string; Organizer: string; - Categories: string; + Category: string; HasAttachments: boolean; EventRecurrence?: EventRecurrence; diff --git a/src/app/models/publication.ts b/src/app/models/publication.ts index 728f6a288..98e726232 100644 --- a/src/app/models/publication.ts +++ b/src/app/models/publication.ts @@ -1,12 +1,12 @@ /* import { Image } from './image'; */ export class Publication{ - DateIndex: Date; + DateIndex: Date | string; DocumentId:string; ProcessId:string; Title: string; Message: string; - DatePublication: Date; + DatePublication: Date | string; OriginalFileName?: string; FileBase64?:string; FileExtension?: string; diff --git a/src/app/pages/agenda/edit-event/edit-event.page.html b/src/app/pages/agenda/edit-event/edit-event.page.html index 1622a79a1..86e653e63 100644 --- a/src/app/pages/agenda/edit-event/edit-event.page.html +++ b/src/app/pages/agenda/edit-event/edit-event.page.html @@ -74,7 +74,7 @@
- {{ postEvent.Categories }} + {{ postEvent.Category }}
Campo obrigatório.
@@ -88,8 +88,8 @@
Reunião @@ -103,7 +103,7 @@
- {{ postEvent.Categories}} + {{ postEvent.Category}}
Campo obrigatório.
diff --git a/src/app/pages/agenda/edit-event/edit-event.page.ts b/src/app/pages/agenda/edit-event/edit-event.page.ts index 1ea220083..2a2344f09 100644 --- a/src/app/pages/agenda/edit-event/edit-event.page.ts +++ b/src/app/pages/agenda/edit-event/edit-event.page.ts @@ -162,7 +162,7 @@ export class EditEventPage implements OnInit { CalendarName: new FormControl(this.postEvent.CalendarName, [ Validators.required ]), - Categories: new FormControl(this.postEvent.Categories, [ + Categories: new FormControl(this.postEvent.Category, [ Validators.required ]), IsRecurring: new FormControl(this.postEvent.IsRecurring, [ diff --git a/src/app/pages/agenda/new-event/new-event.page.html b/src/app/pages/agenda/new-event/new-event.page.html index c7197f152..90e06c72a 100644 --- a/src/app/pages/agenda/new-event/new-event.page.html +++ b/src/app/pages/agenda/new-event/new-event.page.html @@ -90,7 +90,7 @@
Reunião @@ -104,7 +104,7 @@ - + Reunião diff --git a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts index 144da540f..a5dbaf60b 100644 --- a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts @@ -146,7 +146,7 @@ export class BookMeetingModalPage implements OnInit { this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000))); - this.postData.Categories = 'Reunião' + this.postData.Category = 'Reunião' } ngOnInit() { @@ -208,7 +208,7 @@ export class BookMeetingModalPage implements OnInit { participantes: new FormControl(this.taskParticipants, [ Validators.required ]), - Categories: new FormControl(this.postData.Categories, [ + Categories: new FormControl(this.postData.Category, [ Validators.required ]), @@ -249,7 +249,7 @@ export class BookMeetingModalPage implements OnInit { AppointmentState: 0, TimeZone: 'UTC', Organizer: null, - Categories: 'Reunião', + Category: 'Reunião', HasAttachments: true, EventRecurrence: null, } diff --git a/src/app/pages/gabinete-digital/expediente/expediente.page.html b/src/app/pages/gabinete-digital/expediente/expediente.page.html index dbe2e0a48..0885c4c98 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente.page.html +++ b/src/app/pages/gabinete-digital/expediente/expediente.page.html @@ -3,7 +3,7 @@ - + diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 33bf31197..9c89f19f6 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -215,6 +215,8 @@ export class NewPublicationPage implements OnInit { } } else { + + this.publication = { DateIndex: new Date(), DocumentId:null, diff --git a/src/app/services/toast.service.ts b/src/app/services/toast.service.ts index 0b0c38c99..c36b45ae2 100644 --- a/src/app/services/toast.service.ts +++ b/src/app/services/toast.service.ts @@ -33,7 +33,7 @@ export class ToastService { notification.innerHTML = `
-

+

{{ message }}

@@ -65,7 +65,7 @@ export class ToastService { notification.innerHTML = `
-

+

{{ message }}

diff --git a/src/app/shared/agenda/edit-event/edit-event.page.html b/src/app/shared/agenda/edit-event/edit-event.page.html index 9829685c8..cc617dba5 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.html +++ b/src/app/shared/agenda/edit-event/edit-event.page.html @@ -87,7 +87,7 @@ - + Reunião diff --git a/src/app/shared/agenda/edit-event/edit-event.page.ts b/src/app/shared/agenda/edit-event/edit-event.page.ts index b4d7149c9..bf1774b8d 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -204,7 +204,7 @@ export class EditEventPage implements OnInit { Validators.required, ]), CalendarName: new FormControl(this.postEvent.CalendarName), - Categories: new FormControl(this.postEvent.Categories, [ + Categories: new FormControl(this.postEvent.Category, [ Validators.required ]), dateStart: new FormControl(this.dateStart, [ diff --git a/src/app/shared/agenda/new-event/new-event.page.html b/src/app/shared/agenda/new-event/new-event.page.html index 0102cd331..cb8fc62f5 100644 --- a/src/app/shared/agenda/new-event/new-event.page.html +++ b/src/app/shared/agenda/new-event/new-event.page.html @@ -74,7 +74,7 @@ - + Reunião diff --git a/src/app/shared/agenda/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index 46f4c6aed..0b96aaf7a 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -139,8 +139,6 @@ export class NewEventPage implements OnInit { this.getRecurrenceTypes(); if(!this.restoreTemporaryData()){ // clear - - this.eventBody = { BodyType : "1", Text : ""}; this.postEvent.Body = this.eventBody; @@ -169,7 +167,7 @@ export class NewEventPage implements OnInit { AppointmentState: 0, TimeZone: '', Organizer: '', - Categories: 'Reunião', + Category: 'Reunião', HasAttachments: false, EventRecurrence: {Type:'-1'}, }; @@ -191,7 +189,7 @@ export class NewEventPage implements OnInit { AppointmentState: 0, TimeZone: '', Organizer: '', - Categories: 'Reunião', + Category: 'Reunião', HasAttachments: false, EventRecurrence: {Type:'-1'}, }; @@ -238,7 +236,7 @@ export class NewEventPage implements OnInit { Validators.required, ]), CalendarName: new FormControl(this.postEvent.CalendarName), - Categories: new FormControl(this.postEvent.Categories, [ + Categories: new FormControl(this.postEvent.Category, [ Validators.required ]), dateStart: new FormControl(this.postEvent.StartDate, [ diff --git a/src/app/shared/publication/new-publication/new-publication.page.ts b/src/app/shared/publication/new-publication/new-publication.page.ts index af6fd2e55..2018cf1c7 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -147,7 +147,7 @@ export class NewPublicationPage implements OnInit { } - async save(){ + async save() { this.injectValidation() this.runValidation() @@ -188,8 +188,8 @@ export class NewPublicationPage implements OnInit { } } - else{ - + else if (!this.publication.OriginalFileName) { + this.publication = { DateIndex: this.publication.DateIndex, DocumentId:this.publication.DocumentId, @@ -197,9 +197,9 @@ export class NewPublicationPage implements OnInit { Title: this.pub.Title, Message: this.pub.Message, DatePublication: this.publication.DatePublication, - OriginalFileName: this.publication.OriginalFileName, - FileBase64: this.publication.FileBase64, - FileExtension: 'jpeg', + // OriginalFileName: this.publication.OriginalFileName, + // FileBase64: this.publication.FileBase64, + // FileExtension: 'jpeg', } const loader = this.toastService.loading() @@ -218,14 +218,16 @@ export class NewPublicationPage implements OnInit { } } else { - + + + let time = new Date() this.publication = { - DateIndex: new Date(), + DateIndex: time, DocumentId:null, ProcessId:this.folderId, Title: this.pub.Title, Message: this.pub.Message, - DatePublication: new Date(), + DatePublication: time, OriginalFileName: this.capturedImageTitle, FileBase64: this.capturedImage, FileExtension: 'jpeg', diff --git a/src/app/shared/publication/view-publications/view-publications.page.ts b/src/app/shared/publication/view-publications/view-publications.page.ts index f1f44a37c..9b3f241d7 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.ts +++ b/src/app/shared/publication/view-publications/view-publications.page.ts @@ -120,7 +120,7 @@ export class ViewPublicationsPage implements OnInit { publicationType: publicationType, folderId: folderId, }, - cssClass: 'new-publication', + cssClass: 'new-publication modal modal-desktop', backdropDismiss: false }); await modal.present(); diff --git a/test/Agenda.spec.ts b/test/Agenda.spec.ts index 18f0d9f42..2849d9a90 100644 --- a/test/Agenda.spec.ts +++ b/test/Agenda.spec.ts @@ -1,6 +1,8 @@ import { environment } from '../src/environments/environment' import { loginTest } from './login.spec' +import * as faker from 'faker'; +faker.locale = "pt_PT"; describe('Puppeteer tests', () => { @@ -44,7 +46,56 @@ describe('Puppeteer tests', () => { await page.click('ion-content ion-row .cy-add-event') // wait for component await page.waitForSelector('app-new-event') + + + // subject + await page.type('app-new-event .ion-item-container input', faker.commerce.productDescription() ) + // Location + await page.type('app-new-event .container-div:nth-child(2) input', faker.address.state()+" "+faker.address.city() ) + // Select Calendar + await page.click('app-new-event .container-div:nth-child(3) .mat-form-field-flex') + await page.waitForSelector('.cdk-overlay-connected-position-bounding-box') + await page.click('.cdk-overlay-connected-position-bounding-box mat-option') + // select event type + await page.click('app-new-event .container-div:nth-child(4) .mat-form-field-flex') + await page.waitForSelector('.cdk-overlay-connected-position-bounding-box') + await page.click('.cdk-overlay-connected-position-bounding-box mat-option') + + // select start day + await page.click('app-new-event .container-div:nth-child(5) button') + await page.waitForSelector('.cdk-overlay-connected-position-bounding-box') + await page.click('.mat-calendar-next-button') + + let selectedFDay = Math.floor(Math.random()*(25-1+1)+1); + let days = await page.$$(` .mat-calendar-body-cell `) + await days[selectedFDay].click() + await page.click('.cdk-overlay-connected-position-bounding-box .actions button') + + // select end day + await page.click('app-new-event .container-div:nth-child(6) button') + await page.waitForSelector('.cdk-overlay-connected-position-bounding-box') + await page.click('.mat-calendar-next-button') + days = await page.$$(` .mat-calendar-body-cell `) + await days[selectedFDay+1].click() + await page.click('.cdk-overlay-connected-position-bounding-box .actions button') + + // await page.click('app-new-event .container-div:nth-child(7) .mat-form-field-flex') + // await page.waitForSelector('.cdk-overlay-connected-position-bounding-box') + // await page.click('.cdk-overlay-connected-position-bounding-box mat-option') + + await page.click('app-new-event .container-div:nth-child(8) .add-people') + await page.waitForSelector('app-attendee-modal .ng-star-inserted:nth-child(2)') + await page.click('app-attendee-modal .ng-star-inserted:nth-child(2)') + // save + await page.click('app-attendee-modal ion-footer ion-buttons:nth-child(2)') + // save + let buttons = await page.$$('app-new-event ion-footer ion-buttons') + buttons[1].click() + + await page.waitForSelector('.notification .success') + + expect(3 + 2).toBe(5); },30000);