@@ -3,21 +3,16 @@ import {Organization} from '../../../src/types'
33describe ( 'Pinned Items' , ( ) => {
44 let orgID : string
55 beforeEach ( ( ) => {
6- cy . flush ( ) . then ( ( ) =>
7- cy . signin ( ) . then ( ( ) =>
8- cy . fixture ( 'routes' ) . then ( ( ) => {
9- cy . get ( '@org' ) . then ( ( { id} : any ) => {
10- orgID = id
11- cy . setFeatureFlags ( {
12- pinnedItems : true ,
13- docSearchWidget : true ,
14- } ) . then ( ( ) => {
15- cy . getByTestID ( 'tree-nav' )
16- } )
17- } )
18- } )
19- )
20- )
6+ cy . flush ( )
7+ cy . signin ( )
8+ cy . get ( '@org' ) . then ( ( { id} : any ) => {
9+ orgID = id
10+ cy . setFeatureFlags ( {
11+ pinnedItems : true ,
12+ docSearchWidget : true ,
13+ } )
14+ cy . getByTestID ( 'tree-nav' )
15+ } )
2116 } )
2217
2318 it ( 'renders a pinned items modal in the homepage with initial empty state' , ( ) => {
@@ -29,15 +24,13 @@ describe('Pinned Items', () => {
2924
3025 describe ( 'Pin dashboard tests' , ( ) => {
3126 beforeEach ( ( ) => {
32- cy . createDashboard ( orgID ) . then ( ( ) => {
33- cy . setFeatureFlags ( {
34- pinnedItems : true ,
35- docSearchWidget : true ,
36- } ) . then ( ( ) => {
37- cy . getByTestID ( 'nav-item-dashboards' ) . should ( 'be.visible' )
38- cy . getByTestID ( 'nav-item-dashboards' ) . click ( )
39- } )
27+ cy . createDashboard ( orgID )
28+ cy . setFeatureFlags ( {
29+ pinnedItems : true ,
30+ docSearchWidget : true ,
4031 } )
32+ cy . getByTestID ( 'nav-item-dashboards' ) . should ( 'be.visible' )
33+ cy . getByTestID ( 'nav-item-dashboards' ) . click ( )
4134 } )
4235 it ( 'pins a dashboard to the homepage for easy access as a pinned item' , ( ) => {
4336 cy . getByTestID ( 'dashboard-card' )
@@ -131,23 +124,21 @@ describe('Pinned Items', () => {
131124 describe ( 'Pin task tests' , ( ) => {
132125 let taskName : string
133126 beforeEach ( ( ) => {
134- cy . flush ( ) . then ( ( ) =>
135- cy . signin ( ) . then ( ( ) => {
136- cy . get ( '@org' ) . then ( ( { id : orgID } : Organization ) =>
137- cy
138- . createToken ( orgID , 'test token' , 'active' , [
139- { action : 'write' , resource : { type : 'views' , orgID} } ,
140- { action : 'write' , resource : { type : 'documents' , orgID} } ,
141- { action : 'write' , resource : { type : 'tasks' , orgID} } ,
142- ] )
143- . then ( ( { body} ) => {
144- cy . wrap ( body . token ) . as ( 'token' )
145- cy . getByTestID ( 'tree-nav' )
146- cy . visit ( `/orgs/${ orgID } /tasks` )
147- cy . getByTestID ( 'tree-nav' )
148- } )
149- )
150- } )
127+ cy . flush ( )
128+ cy . signin ( )
129+ cy . get ( '@org' ) . then ( ( { id : orgID } : Organization ) =>
130+ cy
131+ . createToken ( orgID , 'test token' , 'active' , [
132+ { action : 'write' , resource : { type : 'views' , orgID} } ,
133+ { action : 'write' , resource : { type : 'documents' , orgID} } ,
134+ { action : 'write' , resource : { type : 'tasks' , orgID} } ,
135+ ] )
136+ . then ( ( { body} ) => {
137+ cy . wrap ( body . token ) . as ( 'token' )
138+ cy . getByTestID ( 'tree-nav' )
139+ cy . visit ( `/orgs/${ orgID } /tasks` )
140+ cy . getByTestID ( 'tree-nav' )
141+ } )
151142 )
152143
153144 taskName = 'Task'
@@ -165,10 +156,8 @@ from(bucket: "${name}"{rightarrow}
165156 cy . getByTestID ( 'task-card' )
166157 . first ( )
167158 . trigger ( 'mouseover' )
168- . then ( ( ) => {
169- cy . getByTestID ( 'context-menu-task' ) . click ( )
170- cy . getByTestID ( 'context-pin-task' ) . click ( )
171- } )
159+ cy . getByTestID ( 'context-menu-task' ) . click ( )
160+ cy . getByTestID ( 'context-pin-task' ) . click ( )
172161 } )
173162
174163 it ( 'can pin a task to the homepage' , ( ) => {
@@ -206,17 +195,9 @@ from(bucket: "${name}"{rightarrow}
206195 } )
207196
208197 it ( 'unpins when the underlying resource is removed' , ( ) => {
209- cy . getByTestID ( 'task-card' )
210- . first ( )
211- . then ( ( ) => {
212- cy . getByTestID ( `context-delete-menu ${ taskName } --button` )
213- . click ( )
214- . then ( ( ) => {
215- cy . getByTestID (
216- `context-delete-menu ${ taskName } --confirm-button`
217- ) . click ( )
218- } )
219- } )
198+ cy . getByTestID ( 'task-card' ) . first ( )
199+ cy . getByTestID ( `context-delete-menu ${ taskName } --button` ) . click ( )
200+ cy . getByTestID ( `context-delete-menu ${ taskName } --confirm-button` ) . click ( )
220201
221202 cy . visit ( '/' )
222203 cy . getByTestID ( 'tree-nav' )
@@ -231,31 +212,30 @@ from(bucket: "${name}"{rightarrow}
231212 beforeEach ( ( ) => {
232213 cy . setFeatureFlags ( {
233214 pinnedItems : true ,
234- } ) . then ( ( ) => {
235- cy . getByTestID ( 'nav-item-flows' ) . should ( 'be.visible' )
236- cy . clickNavBarItem ( 'nav-item-flows' )
237- const now = Date . now ( )
238- cy . writeData (
239- [
240- `test,container_name=cool dopeness=12 ${ now - 1000 } 000000` ,
241- `test,container_name=beans dopeness=18 ${ now - 1200 } 000000` ,
242- `test,container_name=cool dopeness=14 ${ now - 1400 } 000000` ,
243- `test,container_name=beans dopeness=10 ${ now - 1600 } 000000` ,
244- ] ,
245- 'defbuck'
246- )
247- cy . getByTestID ( 'preset-new' )
248- . first ( )
249- . click ( )
250-
251- cy . getByTestID ( 'time-machine-submit-button' ) . should ( 'be.visible' )
252- cy . getByTestID ( 'page-title' ) . click ( )
253- cy . getByTestID ( 'renamable-page-title--input' )
254- . clear ( )
255- . type ( 'Flow' )
256- . type ( '{enter}' )
257- cy . visit ( `/orgs/${ orgID } /notebooks` )
258215 } )
216+ cy . getByTestID ( 'nav-item-flows' ) . should ( 'be.visible' )
217+ cy . clickNavBarItem ( 'nav-item-flows' )
218+ const now = Date . now ( )
219+ cy . writeData (
220+ [
221+ `test,container_name=cool dopeness=12 ${ now - 1000 } 000000` ,
222+ `test,container_name=beans dopeness=18 ${ now - 1200 } 000000` ,
223+ `test,container_name=cool dopeness=14 ${ now - 1400 } 000000` ,
224+ `test,container_name=beans dopeness=10 ${ now - 1600 } 000000` ,
225+ ] ,
226+ 'defbuck'
227+ )
228+ cy . getByTestID ( 'preset-new' )
229+ . first ( )
230+ . click ( )
231+
232+ cy . getByTestID ( 'time-machine-submit-button' ) . should ( 'be.visible' )
233+ cy . getByTestID ( 'page-title' ) . click ( )
234+ cy . getByTestID ( 'renamable-page-title--input' )
235+ . clear ( )
236+ . type ( 'Flow' )
237+ . type ( '{enter}' )
238+ cy . visit ( `/orgs/${ orgID } /notebooks` )
259239 } )
260240
261241 it ( 'pins a notebook to the homepage' , ( ) => {
0 commit comments