File tree 1 file changed +19
-2
lines changed
1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 3
3
// using function declaration instead of arrow functions
4
4
// so Safari browser understands
5
5
6
+ function random ( ) {
7
+ return Math . random ( ) . toString ( 16 ) . substr ( 2 )
8
+ }
9
+
6
10
describe ( 'a cy unit test' , function ( ) {
7
11
it ( 'is ok' , function ( ) {
8
12
expect ( true ) . to . be . true
@@ -63,8 +67,8 @@ describe('todomvc app', function () {
63
67
} )
64
68
65
69
it ( 'can clear all completed todos' , function ( ) {
66
- const random = Math . random ( ) . toString ( 16 ) . substr ( 2 )
67
- const label = `an example ${ random } `
70
+ const id = random ( )
71
+ const label = `an example ${ id } `
68
72
addTodo ( label )
69
73
cy
70
74
. get ( 'ul.todo-list' )
@@ -79,4 +83,17 @@ describe('todomvc app', function () {
79
83
. contains ( 'li' , label )
80
84
. should ( 'not.exist' )
81
85
} )
86
+
87
+ it ( 'can show individual TODO item' , function ( ) {
88
+ const id = random ( )
89
+ const label = `one todo ${ id } `
90
+ addTodo ( label )
91
+ cy . get ( 'ul.todo-list' )
92
+ . contains ( 'li' , label )
93
+ . should ( 'be.visible' )
94
+ . click ( )
95
+ cy . url ( ) . should ( 'contain' , `/todo/` )
96
+ cy . get ( 'ul.todo-list li' )
97
+ . should ( 'have.length' , 1 )
98
+ } )
82
99
} )
You can’t perform that action at this time.
0 commit comments