From 659022444784c8c916f95877e443de6f59eb370c Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 14 Jul 2021 16:57:06 +0100 Subject: [PATCH 1/6] Fix editing publication --- src/app/models/publication.ts | 4 ++-- .../new-publication/new-publication.page.ts | 2 ++ .../new-publication/new-publication.page.ts | 20 +++++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) 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/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index 33bf31197..d2fed94e5 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 { + + alert('create !!! 312') this.publication = { DateIndex: new Date(), DocumentId:null, 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..8a38990ab 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -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,18 @@ export class NewPublicationPage implements OnInit { } } else { - + + alert('create !!! 123') + + let time = new Date() + alert(time) 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', From d9e5dd2722677891ef712065553a33db772645ad Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 14 Jul 2021 16:57:52 +0100 Subject: [PATCH 2/6] Fix editing publication --- .../pages/publications/new-publication/new-publication.page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d2fed94e5..9c89f19f6 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -216,7 +216,7 @@ export class NewPublicationPage implements OnInit { } else { - alert('create !!! 312') + this.publication = { DateIndex: new Date(), DocumentId:null, From abdb5bb3deb1ba2eb8fa58f3afcc557aac13a5c4 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 14 Jul 2021 17:02:18 +0100 Subject: [PATCH 3/6] Fix editing publication --- .../shared/publication/new-publication/new-publication.page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8a38990ab..7e6557d41 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -219,7 +219,7 @@ export class NewPublicationPage implements OnInit { } else { - alert('create !!! 123') + let time = new Date() alert(time) From 11b0c28301f364b7aa3c54078fa5360cf18af115 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 14 Jul 2021 19:04:33 +0100 Subject: [PATCH 4/6] Remove alert --- .../publication/new-publication/new-publication.page.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 7e6557d41..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() @@ -219,10 +219,8 @@ export class NewPublicationPage implements OnInit { } else { - - + let time = new Date() - alert(time) this.publication = { DateIndex: time, DocumentId:null, From 6d05f56d8bfe2c2360de085795cfa47b879f798c Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Wed, 14 Jul 2021 22:10:22 +0100 Subject: [PATCH 5/6] Add funcional test and fix build --- .gitignore | 2 +- jest-puppeteer.config.js | 6 +++ package-lock.json | 5 ++ package.json | 1 + .../expediente/expediente.page.html | 2 +- src/app/services/toast.service.ts | 4 +- .../shared/agenda/new-event/new-event.page.ts | 2 - test/Agenda.spec.ts | 51 +++++++++++++++++++ 8 files changed, 67 insertions(+), 6 deletions(-) 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/pages/gabinete-digital/expediente/expediente.page.html b/src/app/pages/gabinete-digital/expediente/expediente.page.html index 7346232a2..4f8e5f17f 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/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/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index 46f4c6aed..866d0fb8a 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; 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); From 5fb9f32f8ef609a6921b00c63d53490c613f2442 Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Thu, 15 Jul 2021 08:53:54 +0100 Subject: [PATCH 6/6] Change Type from categories to category --- src/app/models/event.model.ts | 2 +- src/app/pages/agenda/edit-event/edit-event.page.html | 8 ++++---- src/app/pages/agenda/edit-event/edit-event.page.ts | 2 +- src/app/pages/agenda/new-event/new-event.page.html | 4 ++-- src/app/pages/agenda/new-event/new-event.page.ts | 6 +++--- .../book-meeting-modal/book-meeting-modal.page.html | 4 ++-- .../book-meeting-modal/book-meeting-modal.page.ts | 6 +++--- src/app/shared/agenda/edit-event/edit-event.page.html | 2 +- src/app/shared/agenda/edit-event/edit-event.page.ts | 2 +- src/app/shared/agenda/new-event/new-event.page.html | 2 +- src/app/shared/agenda/new-event/new-event.page.ts | 6 +++--- .../view-publications/view-publications.page.ts | 2 +- 12 files changed, 23 insertions(+), 23 deletions(-) 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/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/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 866d0fb8a..0b96aaf7a 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -167,7 +167,7 @@ export class NewEventPage implements OnInit { AppointmentState: 0, TimeZone: '', Organizer: '', - Categories: 'Reunião', + Category: 'Reunião', HasAttachments: false, EventRecurrence: {Type:'-1'}, }; @@ -189,7 +189,7 @@ export class NewEventPage implements OnInit { AppointmentState: 0, TimeZone: '', Organizer: '', - Categories: 'Reunião', + Category: 'Reunião', HasAttachments: false, EventRecurrence: {Type:'-1'}, }; @@ -236,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/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();