File tree Expand file tree Collapse file tree 5 files changed +46
-29
lines changed
src/apps/backoffice/frontend/controllers Expand file tree Collapse file tree 5 files changed +46
-29
lines changed Original file line number Diff line number Diff line change 1+ import faker from 'faker' ;
2+
13describe ( 'Courses' , ( ) => {
24
3- it ( 'can create a course' , ( ) => {
4- const courseName = 'New course' ;
5+ beforeEach ( ( ) => {
6+ cy . task ( 'reset:db' ) ;
7+ } ) ;
8+
9+ it ( 'can create courses' , ( ) => {
510 cy . visit ( 'http://localhost:8032/courses' ) ;
611
7- cy . get ( 'input[name="name"]' ) . type ( courseName ) ;
8- cy . get ( 'input[name="duration"]' ) . type ( '8 days' ) ;
9- cy . get ( 'form' ) . submit ( ) ;
12+ cy . contains ( 'Actualmente CodelyTV Pro cuenta con 0 cursos.' ) ;
13+
14+ let i = 0 ;
15+ while ( i <= 5 ) {
16+ i ++ ;
17+ const courseName = faker . lorem . sentence ( 2 ) ;
18+ cy . get ( 'input[name="name"]' ) . type ( courseName ) ;
19+ cy . get ( 'input[name="duration"]' ) . type ( '8 days' ) ;
20+ cy . get ( 'form' ) . submit ( ) ;
1021
11- cy . get ( 'div[role="alert"]' ) . contains ( `Felicidades, el curso ${ courseName } ha sido creado!` ) ;
12- // cy.contains('Actualmente CodelyTV Pro cuenta con 10 curso');
22+ cy . get ( 'div[role="alert"]' ) . contains ( `Felicidades, el curso ${ courseName } ha sido creado!` ) ;
23+ cy . contains ( `Actualmente CodelyTV Pro cuenta con ${ i } cursos.` ) ;
24+ }
1325 } ) ;
1426} ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import container from '../../src/apps/mooc_backend/config/dependency-injection' ;
2+ import { EnvironmentArranger } from '../../tests/Contexts/Shared/infrastructure/arranger/EnvironmentArranger' ;
3+ import { seed } from '../../src/apps/backoffice/frontend/seed' ;
4+
5+ const environmentArranger : Promise < EnvironmentArranger > = container . get ( 'Mooc.EnvironmentArranger' ) ;
6+
7+ export default ( on : Cypress . PluginEvents , config : Cypress . PluginConfig ) => {
8+ on ( 'task' , {
9+ async 'reset:db' ( ) {
10+ await ( await environmentArranger ) . arrange ( ) ;
11+ await seed ( ) ;
12+ return null ;
13+ }
14+ } ) ;
15+ } ;
Original file line number Diff line number Diff line change 1+ {
2+ "extends" : " ../tsconfig.json" ,
3+ "compilerOptions" : {
4+ "lib" : [" es2015" , " dom" ],
5+ "types" : [" cypress" ]
6+ },
7+ "include" : [
8+ " **/*.ts"
9+ ]
10+ }
11+
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export class CoursesPostController extends WebController {
1212 static validator ( ) : ValidationChain [ ] {
1313 return [
1414 body ( 'id' ) . isUUID ( ) ,
15- body ( 'name' ) . isLength ( { min : 1 , max : 255 } ) ,
15+ body ( 'name' ) . isLength ( { min : 1 , max : 30 } ) ,
1616 body ( 'duration' ) . isLength ( { min : 4 , max : 100 } )
1717 ] ;
1818 }
You can’t perform that action at this time.
0 commit comments