@@ -7,20 +7,20 @@ function waitForElement(selector) {
77 browser . wait ( EC . presenceOf ( $ ( selector ) ) , 20000 ) ;
88}
99
10- describe ( 'routing inbox-app' , function ( ) {
10+ describe ( 'routing inbox-app' , ( ) => {
1111
1212 afterEach ( verifyNoBrowserErrors ) ;
1313
14- describe ( 'index view' , function ( ) {
14+ describe ( 'index view' , ( ) => {
1515 var URL = 'examples/src/routing/' ;
1616
17- it ( 'should list out the current collection of items' , function ( ) {
17+ it ( 'should list out the current collection of items' , ( ) => {
1818 browser . get ( URL ) ;
1919 waitForElement ( '.inbox-item-record' ) ;
2020 expect ( element . all ( by . css ( '.inbox-item-record' ) ) . count ( ) ) . toEqual ( 200 ) ;
2121 } ) ;
2222
23- it ( 'should build a link which points to the detail page' , function ( ) {
23+ it ( 'should build a link which points to the detail page' , ( ) => {
2424 browser . get ( URL ) ;
2525 waitForElement ( '#item-15' ) ;
2626 expect ( element ( by . css ( '#item-15' ) ) . getAttribute ( 'href' ) ) . toMatch ( / \/ d e t a i l \/ 1 5 $ / ) ;
@@ -31,18 +31,18 @@ describe('routing inbox-app', function() {
3131 } ) ;
3232
3333
34- describe ( 'drafts view' , function ( ) {
34+ describe ( 'drafts view' , ( ) => {
3535 var URL = 'examples/src/routing/#/drafts' ;
3636
37- it ( 'should navigate to the drafts view when the drafts link is clicked' , function ( ) {
37+ it ( 'should navigate to the drafts view when the drafts link is clicked' , ( ) => {
3838 browser . get ( URL ) ;
3939 waitForElement ( '.inbox-item-record' ) ;
4040 element ( by . linkText ( 'Drafts' ) ) . click ( ) ;
4141 waitForElement ( '.page-title' ) ;
4242 expect ( element ( by . css ( '.page-title' ) ) . getText ( ) ) . toEqual ( 'Drafts' ) ;
4343 } ) ;
4444
45- it ( 'should navigate to email details' , function ( ) {
45+ it ( 'should navigate to email details' , ( ) => {
4646 browser . get ( URL ) ;
4747 element ( by . linkText ( 'Drafts' ) ) . click ( ) ;
4848 waitForElement ( '.inbox-item-record' ) ;
@@ -55,10 +55,10 @@ describe('routing inbox-app', function() {
5555 } ) ;
5656
5757
58- describe ( 'detail view' , function ( ) {
58+ describe ( 'detail view' , ( ) => {
5959 var URL = 'examples/src/routing/' ;
6060
61- it ( 'should navigate to the detail view when an email is clicked' , function ( ) {
61+ it ( 'should navigate to the detail view when an email is clicked' , ( ) => {
6262 browser . get ( URL ) ;
6363 waitForElement ( '#item-10' ) ;
6464 element ( by . css ( '#item-10' ) ) . click ( ) ;
@@ -68,13 +68,25 @@ describe('routing inbox-app', function() {
6868 expect ( recordId . getText ( ) ) . toEqual ( 'ID: 10' ) ;
6969 } ) ;
7070
71- it ( 'should navigate back to the email inbox page when the back button is clicked' , function ( ) {
71+ it ( 'should navigate back to the email inbox page when the back button is clicked' , ( ) => {
7272 browser . get ( URL ) ;
7373 waitForElement ( '#item-10' ) ;
7474 element ( by . css ( '#item-10' ) ) . click ( ) ;
7575 waitForElement ( '.back-button' ) ;
7676 element ( by . css ( '.back-button' ) ) . click ( ) ;
77- expect ( browser . getCurrentUrl ( ) ) . toMatch ( '/#' ) ;
77+ expect ( browser . getCurrentUrl ( ) ) . toMatch ( / \/ $ / ) ;
7878 } ) ;
79+
80+ it ( 'should navigate back to index and sort the page items based on the provided querystring param' ,
81+ ( ) => {
82+ browser . get ( URL ) ;
83+ waitForElement ( '#item-10' ) ;
84+ element ( by . css ( '#item-10' ) ) . click ( ) ;
85+ waitForElement ( '.sort-button' ) ;
86+ element ( by . css ( '.sort-button' ) ) . click ( ) ;
87+ expect ( browser . getCurrentUrl ( ) ) . toMatch ( / \/ # \? s o r t = d a t e $ / ) ;
88+ waitForElement ( '.inbox-item-record' ) ;
89+ expect ( element ( by . css ( ".inbox-item-record > a" ) ) . getAttribute ( "id" ) ) . toEqual ( "item-137" ) ;
90+ } ) ;
7991 } )
8092} ) ;
0 commit comments