Publication

This commit is contained in:
Peter Maquiran
2021-07-14 15:38:58 +01:00
parent 8c859834aa
commit 81f10a377c
7 changed files with 47 additions and 26 deletions
-1
View File
@@ -9,7 +9,6 @@
"build": "ng build",
"lint": "ng lint",
"e2e": "ng e2e",
"nice": "node server.js",
"test": "jest --detectOpenHandles --runInBand",
"test:prof": "ionic build --prod && npm run test",
"dev": "lite-server --baseDir=www"
+3 -3
View File
@@ -7,7 +7,7 @@ export class Publication{
Title: string;
Message: string;
DatePublication: Date;
OriginalFileName: string;
FileBase64:string;
FileExtension: string;
OriginalFileName?: string;
FileBase64?:string;
FileExtension?: string;
}
@@ -148,6 +148,8 @@ export class NewPublicationPage implements OnInit {
if(this.Form.invalid) return false
if(this.publicationType == '3') {
console.log(this.navParams.get('publication'));
@@ -180,7 +182,8 @@ export class NewPublicationPage implements OnInit {
}
}
else {
else if (!this.publication.OriginalFileName) {
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
@@ -188,9 +191,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',
}
/* console.log('Edit - keep image');
console.log(this.publication); */
@@ -264,6 +267,8 @@ export class NewPublicationPage implements OnInit {
else if(this.publicationType == '3') {
this.publicationTitle = 'Editar Publicação';
this.pub = this.navParams.get('publication');
console.log(this.pub, 'pub')
}
}
@@ -4,7 +4,7 @@ import { EventPerson } from 'src/app/models/eventperson.model';
import { EventsService } from 'src/app/services/events.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { Event } from 'src/app/models/event.model';
import { AnimationController, ModalController } from '@ionic/angular';
import { ModalController } from '@ionic/angular';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchDocument } from "src/app/models/search-document";
@@ -154,7 +154,9 @@ export class NewPublicationPage implements OnInit {
if(this.Form.invalid) return false
if(this.publicationType == '3'){
if(this.publicationType == '3') {
if(this.capturedImage != '') {
this.publication = {
@@ -168,12 +170,12 @@ export class NewPublicationPage implements OnInit {
FileBase64: this.capturedImage,
FileExtension: 'jpeg',
}
console.log('Edit change image');
console.log(this.publication);
const loader = this.toastService.loading()
try {
console.log(this.publication);
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService.successMessage("Publicação criado")
@@ -187,6 +189,7 @@ export class NewPublicationPage implements OnInit {
}
else{
this.publication = {
DateIndex: this.publication.DateIndex,
DocumentId:this.publication.DocumentId,
@@ -259,7 +262,7 @@ export class NewPublicationPage implements OnInit {
else if(this.publicationType == '2'){
this.publicationTitle = 'Nova Publicação';
}
else if(this.publicationType == '3'){
else if(this.publicationType == '3') {
this.publicationTitle = 'Editar Publicação';
this.pub = this.publication;
}
+24 -2
View File
@@ -8,19 +8,41 @@ describe('Puppeteer tests', () => {
// await page.goto(process.env.PUPPETEER_HOST)
})
test('Login', async()=> {
await loginTest(page)
},30000)
test('[table] Open create event component', async () => {
await page.setViewport({width: 1200, height: 720});
await page.goto(process.env.PUPPETEER_HOST); // wait until page load
await page.waitForSelector('ion-app')
await loginTest(page)
// wait for footer button
await page.click('ion-tab-bar ion-tab-button:nth-child(2)')
await page.waitForSelector('app-agenda')
// click add event
await page.click('ion-content ion-row .cy-add-event')
// wait for component
await page.waitForSelector('app-new-event')
expect(3 + 2).toBe(5);
},30000);
test('[table] Create Event', async () => {
await page.setViewport({width: 1200, height: 720});
await page.goto(process.env.PUPPETEER_HOST); // wait until page load
await page.waitForSelector('ion-app')
// wait for footer button
await page.click('ion-tab-bar ion-tab-button:nth-child(2)')
await page.waitForSelector('app-agenda')
// click add event
await page.click('ion-content ion-row .cy-add-event')
//
// wait for component
await page.waitForSelector('app-new-event')
expect(3 + 2).toBe(5);
+4 -12
View File
@@ -45,16 +45,12 @@ export const loginTest = async (page) => {
}
}
describe('Puppeteer tests', () => {
beforeAll(async () => {
// await page.goto(process.env.PUPPETEER_HOST)
})
test('[table] Clear Code button and set pin', async () => {
const pathname = await page.evaluate( () => window.location.pathname)
@@ -67,11 +63,11 @@ describe('Puppeteer tests', () => {
await page.evaluate( () => {
let a: HTMLInputElement = document.querySelector('input[type="text"]')
a.value = ''
let a: HTMLInputElement = document.querySelector('input[type="text"]')
a.value = ''
let b: HTMLInputElement = document.querySelector('input[type="password"')
b.value = ''
let b: HTMLInputElement = document.querySelector('input[type="password"')
b.value = ''
})
await page.type('input[type="text"]', environment.defaultuser);
@@ -105,9 +101,5 @@ describe('Puppeteer tests', () => {
expect(3 + 2).toBe(5);
},30000);
});