[4159] | 1 | 'use strict'; |
---|
| 2 | |
---|
| 3 | describe('SCHEMAcat', function() { |
---|
| 4 | describe('Routing scenario', function() { |
---|
| 5 | |
---|
| 6 | it('should jump to "/workspace/page/1/?schemaIndex=0" when loading <serverURL>/schemacat/site/', function() { |
---|
| 7 | browser().navigateTo('/schemacat/site/'); |
---|
| 8 | expect(browser().location().url()).toBe('/workspace/page/1/?schemaIndex=0'); |
---|
| 9 | }); |
---|
| 10 | |
---|
| 11 | it('should jump to "/workspace/page/1/?schemaIndex=0" when location path and hash are empty', function() { |
---|
| 12 | browser().navigateTo('/schemacat/site/index.html'); |
---|
| 13 | expect(browser().location().url()).toBe('/workspace/page/1/?schemaIndex=0'); |
---|
| 14 | }); |
---|
| 15 | |
---|
| 16 | it('should have a working /workspace/<page> route', function() { |
---|
| 17 | browser().navigateTo('#/workspace/page/1/'); |
---|
| 18 | expect(browser().location().path()).toBe('/workspace/page/1/'); |
---|
| 19 | }); |
---|
| 20 | |
---|
| 21 | it('should have a working /about route', function() { |
---|
| 22 | browser().navigateTo('#/about'); |
---|
| 23 | expect(browser().location().url()).toBe('/about'); |
---|
| 24 | }); |
---|
| 25 | |
---|
| 26 | it('should have a working /contact route', function() { |
---|
| 27 | browser().navigateTo('#/contact'); |
---|
| 28 | expect(browser().location().url()).toBe('/contact'); |
---|
| 29 | }); |
---|
| 30 | |
---|
| 31 | it('should have a working /accountDetails route', function() { |
---|
| 32 | browser().navigateTo('#/accountDetails'); |
---|
| 33 | expect(browser().location().url()).toBe('/accountDetails'); |
---|
| 34 | }); |
---|
| 35 | |
---|
| 36 | it('should jump to a different schema when schemaIndex changes', function() { |
---|
| 37 | browser().navigateTo('#/workspace/page/1/?schemaIndex=1'); |
---|
| 38 | expect(browser().location().search()).toEqual({schemaIndex: '1'}); |
---|
| 39 | browser().navigateTo('#/workspace/page/1/?schemaIndex=2'); |
---|
| 40 | expect(browser().location().search()).toEqual({schemaIndex: '2'}); |
---|
| 41 | }); |
---|
| 42 | |
---|
| 43 | it('Should login as administrator', function() { |
---|
| 44 | element('li[title="userMenu"] a:has(span[data-ng-bind="displayName"])').click(); |
---|
| 45 | element('li[title="userMenu"] span:contains("Login as a different user...")').click(); |
---|
| 46 | input('loginNameInput.text').enter('Menzo.Windhouwer_mpi.nl@clarin.eu'); |
---|
| 47 | alertOK(); |
---|
| 48 | element('#login').click(); |
---|
| 49 | sleep(0.25); |
---|
| 50 | expect(browser().location().url()).toBe('/workspace/page/1/?schemaIndex=0'); |
---|
| 51 | expect(element('li[title="userMenu"] span[data-ng-bind="displayName"]').text()).toBe('Menzo Windhouwer'); |
---|
| 52 | }); |
---|
| 53 | |
---|
| 54 | it('should jump to a different page when page path changes', function() { |
---|
| 55 | browser().navigateTo('#/workspace/page/2/'); |
---|
| 56 | expect(browser().location().path()).toBe('/workspace/page/2/'); |
---|
| 57 | }); |
---|
| 58 | |
---|
| 59 | it('Should login as guest', function() { |
---|
| 60 | element('li[title="userMenu"] a:has(span[data-ng-bind="displayName"])').click(); |
---|
| 61 | element('li[title="userMenu"] span:contains("Login as a different user...")').click(); |
---|
| 62 | input('loginNameInput.text').enter('guest'); |
---|
| 63 | alertOK(); |
---|
| 64 | element('#login').click(); |
---|
| 65 | sleep(0.25); |
---|
| 66 | expect(browser().location().url()).toBe('/workspace/page/1/?schemaIndex=0'); |
---|
| 67 | expect(element('li[title="userMenu"] span[data-ng-bind="displayName"]').text()).toBe('guest'); |
---|
| 68 | }); |
---|
| 69 | }); |
---|
| 70 | describe('Worspace scenarios', function() { |
---|
| 71 | describe('Routes scenario', function() { |
---|
| 72 | |
---|
| 73 | beforeEach(function() { |
---|
| 74 | //load the default initial page |
---|
| 75 | browser().navigateTo('/schemacat/site/index.html#/workspace/page/1/?schemaIndex=0'); |
---|
| 76 | }); |
---|
| 77 | it('should redirect to "/workspace/page/1/?schemaIndex=0" when page is invalid (page="a")', function() { |
---|
| 78 | browser().navigateTo('#/workspace/page/a/?schemaIndex=0'); |
---|
| 79 | expect(browser().location().url()).toBe('/workspace/page/1/?schemaIndex=0'); |
---|
| 80 | }); |
---|
| 81 | |
---|
| 82 | it('should redirect to "/workspace/page/1/?schemaIndex=0" when page is out of range (page=3)', function() { |
---|
| 83 | browser().navigateTo('#/workspace/page/3/?schemaIndex=0'); |
---|
| 84 | expect(browser().location().url()).toBe('/workspace/page/1/?schemaIndex=0'); |
---|
| 85 | }); |
---|
| 86 | |
---|
| 87 | it('should redirect to "/workspace/page/1/?schemaIndex=0" when page is out of range (page<1)', function() { |
---|
| 88 | browser().navigateTo('#/workspace/page/0/?schemaIndex=0'); |
---|
| 89 | expect(browser().location().url()).toBe('/workspace/page/1/?schemaIndex=0'); |
---|
| 90 | }); |
---|
| 91 | |
---|
| 92 | it('should redirect to "/workspace/page/1/?schemaIndex=0" when schemaIndex is invalid (schemaIndex="a")', function() { |
---|
| 93 | browser().navigateTo('#/workspace/page/1/?schemaIndex=a'); |
---|
| 94 | expect(browser().location().url()).toBe('/workspace/page/1/?schemaIndex=0'); |
---|
| 95 | }); |
---|
| 96 | |
---|
| 97 | it('should redirect to "/workspace/page/1/?schemaIndex=0" when schemaIndex is out of range (schemaIndex>9)', function() { |
---|
| 98 | browser().navigateTo('#/workspace/page/1/?schemaIndex=10'); |
---|
| 99 | expect(browser().location().url()).toBe('/workspace/page/1/?schemaIndex=0'); |
---|
| 100 | }); |
---|
| 101 | |
---|
| 102 | it('should redirect to "/workspace/page/1/?schemaIndex=0" when schemaIndex is out of range (schemaIndex=-1)', function() { |
---|
| 103 | browser().navigateTo('#/workspace/page/1/?schemaIndex=-1'); |
---|
| 104 | expect(browser().location().url()).toBe('/workspace/page/1/?schemaIndex=0'); |
---|
| 105 | }); |
---|
| 106 | |
---|
| 107 | it('should show the schema with index=0 if schemaIndex is not supplied on the route', function() { |
---|
| 108 | browser().navigateTo('#/workspace/page/1/'); |
---|
| 109 | expect(element('#schema-name').html()).not().toEqual(''); |
---|
| 110 | expect(element('#schema-name').css('visibility')).toBe('visible'); |
---|
| 111 | }); |
---|
| 112 | |
---|
| 113 | }); |
---|
| 114 | describe('Change schema scenario', function() { |
---|
| 115 | |
---|
| 116 | beforeEach(function() { |
---|
| 117 | //load the default initial page |
---|
| 118 | browser().navigateTo('/schemacat/site/index.html#/workspace/page/1/?schemaIndex=0'); |
---|
| 119 | }); |
---|
| 120 | |
---|
| 121 | it('should show the clicked schema and update route (animated)', function() { |
---|
| 122 | element('#workspace-main-row table tbody tr:eq(1)').click(); |
---|
| 123 | |
---|
| 124 | expect(browser().location().search()).toEqual({schemaIndex: '1'}); |
---|
| 125 | expect(element('#schema-name').html()).not().toEqual(''); |
---|
| 126 | expect(element('#schema-name').css('visibility')).toBe('visible'); |
---|
| 127 | expect(element('#schema-div').attr('class')).toContain('animated fadeInUp'); |
---|
| 128 | |
---|
| 129 | element('#workspace-main-row table tbody tr:eq(0)').click(); |
---|
| 130 | |
---|
| 131 | expect(browser().location().search()).toEqual({schemaIndex: '0'}); |
---|
| 132 | expect(element('#schema-name').html()).not().toEqual(''); |
---|
| 133 | expect(element('#schema-name').css('visibility')).toBe('visible'); |
---|
| 134 | expect(element('#schema-div').attr('class')).toContain('animated fadeInDown'); |
---|
| 135 | }); |
---|
| 136 | |
---|
| 137 | it('should show the clicked schema and update route (not animated)', function() { |
---|
| 138 | browser().navigateTo('/schemacat/site/index.html#/workspace/page/1/?schemaIndex=0&animationsDisabled'); |
---|
| 139 | element('#workspace-main-row table tbody tr:eq(1)').click(); |
---|
| 140 | |
---|
| 141 | expect(browser().location().search()).toEqual({schemaIndex: '1', animationsDisabled: true}); |
---|
| 142 | expect(element('#schema-name').html()).not().toEqual(''); |
---|
| 143 | expect(element('#schema-name').css('visibility')).toBe('visible'); |
---|
| 144 | expect(element('#schema-div').attr('class')).not().toContain('animated'); |
---|
| 145 | |
---|
| 146 | element('#workspace-main-row table tbody tr:eq(0)').click(); |
---|
| 147 | |
---|
| 148 | expect(browser().location().search()).toEqual({schemaIndex: '0', animationsDisabled: true}); |
---|
| 149 | expect(element('#schema-name').html()).not().toEqual(''); |
---|
| 150 | expect(element('#schema-name').css('visibility')).toBe('visible'); |
---|
| 151 | expect(element('#schema-div').attr('class')).not().toContain('animated'); |
---|
| 152 | }); |
---|
| 153 | |
---|
| 154 | }); |
---|
| 155 | describe('Open schema file scenario', function() { |
---|
| 156 | beforeEach(function() { |
---|
| 157 | //load the default initial page |
---|
| 158 | browser().navigateTo('/schemacat/site/index.html#/workspace/page/1/?schemaIndex=0'); |
---|
| 159 | }); |
---|
| 160 | it('should navigate to the schema file url', function() { |
---|
| 161 | element('#files-list a:contains("Open"):eq(0)').click(); |
---|
[4164] | 162 | expect(browser().window().href()).toContain('/schemacat/schemas/'); |
---|
| 163 | expect(browser().window().href()).toContain('/files/'); |
---|
[4159] | 164 | }); |
---|
| 165 | }); |
---|
| 166 | }); |
---|
| 167 | describe('Contact page scenarios', function() { |
---|
| 168 | describe('Load page scenario (animated)', function() { |
---|
| 169 | beforeEach(function() { |
---|
| 170 | browser().navigateTo('/schemacat/site/index.html#/workspace/page/1/?schemaIndex=0'); |
---|
| 171 | }); |
---|
| 172 | |
---|
| 173 | it('should load the contact page and slide it from the right when url changes from the workspace page', function() { |
---|
| 174 | browser().navigateTo('#/contact'); |
---|
| 175 | expect(browser().location().url()).toBe('/contact'); |
---|
| 176 | expect(element('#contact').html()).not().toEqual(''); |
---|
| 177 | expect(element('#contact').attr('class')).toContain('animated slideInRight'); |
---|
| 178 | }); |
---|
| 179 | |
---|
| 180 | it('should load the contact page and slide it from the right when url changes from the about page', function() { |
---|
| 181 | browser().navigateTo('#/about'); |
---|
| 182 | browser().navigateTo('#/contact'); |
---|
| 183 | expect(browser().location().url()).toBe('/contact'); |
---|
| 184 | expect(element('#contact').html()).not().toEqual(''); |
---|
| 185 | expect(element('#contact').attr('class')).toContain('animated slideInRight'); |
---|
| 186 | }); |
---|
| 187 | |
---|
| 188 | it('should load the contact page and fade it down when url changes from the accountDetails page', function() { |
---|
| 189 | browser().navigateTo('#/accountDetails'); |
---|
| 190 | browser().navigateTo('#/contact'); |
---|
| 191 | expect(browser().location().url()).toBe('/contact'); |
---|
| 192 | expect(element('#contact').html()).not().toEqual(''); |
---|
| 193 | expect(element('#contact').attr('class')).toContain('animated fadeInDown'); |
---|
| 194 | }); |
---|
| 195 | |
---|
| 196 | it('should load the contact page and fade it down when reload is clicked', function() { |
---|
| 197 | browser().navigateTo('#/contact'); |
---|
| 198 | browser().reload(); |
---|
| 199 | expect(browser().location().url()).toBe('/contact'); |
---|
| 200 | expect(element('#contact').html()).not().toEqual(''); |
---|
| 201 | expect(element('#contact').attr('class')).toContain('animated fadeInDown'); |
---|
| 202 | }); |
---|
| 203 | |
---|
| 204 | it('should load the contact page and fade it down when landing on this page from an external location', function() { |
---|
| 205 | browser().navigateTo('/'); |
---|
| 206 | browser().navigateTo('/schemacat/site/index.html#/contact'); |
---|
| 207 | expect(browser().location().url()).toBe('/contact'); |
---|
| 208 | expect(element('#contact').html()).not().toEqual(''); |
---|
| 209 | expect(element('#contact').attr('class')).toContain('animated fadeInDown'); |
---|
| 210 | }); |
---|
| 211 | }); |
---|
| 212 | describe('Load page scenario (not animated)', function() { |
---|
| 213 | beforeEach(function() { |
---|
| 214 | browser().navigateTo('/schemacat/site/index.html#/workspace/page/1/?schemaIndex=0&animationsDisabled'); |
---|
| 215 | }); |
---|
| 216 | |
---|
| 217 | it('should load the contact page without animations when url changes from the workspace page', function() { |
---|
| 218 | browser().navigateTo('#/contact?animationsDisabled'); |
---|
| 219 | expect(browser().location().url()).toBe('/contact?animationsDisabled'); |
---|
| 220 | expect(element('#contact').html()).not().toEqual(''); |
---|
| 221 | expect(element('#contact').attr('class')).not().toContain('animated'); |
---|
| 222 | }); |
---|
| 223 | |
---|
| 224 | it('should load the contact page without animations when url changes from the about page', function() { |
---|
| 225 | browser().navigateTo('#/about?animationsDisabled'); |
---|
| 226 | browser().navigateTo('#/contact?animationsDisabled'); |
---|
| 227 | expect(browser().location().url()).toBe('/contact?animationsDisabled'); |
---|
| 228 | expect(element('#contact').html()).not().toEqual(''); |
---|
| 229 | expect(element('#contact').attr('class')).not().toContain('animated'); |
---|
| 230 | }); |
---|
| 231 | |
---|
| 232 | it('should load the contact page without animations when url changes from the accountDetails page', function() { |
---|
| 233 | browser().navigateTo('#/accountDetails?animationsDisabled'); |
---|
| 234 | browser().navigateTo('#/contact?animationsDisabled'); |
---|
| 235 | expect(browser().location().url()).toBe('/contact?animationsDisabled'); |
---|
| 236 | expect(element('#contact').html()).not().toEqual(''); |
---|
| 237 | expect(element('#contact').attr('class')).not().toContain('animated'); |
---|
| 238 | }); |
---|
| 239 | |
---|
| 240 | it('should load the contact page without animations when reload is clicked', function() { |
---|
| 241 | browser().navigateTo('#/contact?animationsDisabled'); |
---|
| 242 | browser().reload(); |
---|
| 243 | expect(browser().location().url()).toBe('/contact?animationsDisabled'); |
---|
| 244 | expect(element('#contact').html()).not().toEqual(''); |
---|
| 245 | expect(element('#contact').attr('class')).not().toContain('animated'); |
---|
| 246 | }); |
---|
| 247 | |
---|
| 248 | it('should load the contact page without animations when landing on this page from an external location', function() { |
---|
| 249 | browser().navigateTo('/'); |
---|
| 250 | browser().navigateTo('/schemacat/site/index.html#/contact?animationsDisabled'); |
---|
| 251 | expect(browser().location().url()).toBe('/contact?animationsDisabled'); |
---|
| 252 | expect(element('#contact').html()).not().toEqual(''); |
---|
| 253 | expect(element('#contact').attr('class')).not().toContain('animated'); |
---|
| 254 | }); |
---|
| 255 | }); |
---|
| 256 | }); |
---|
| 257 | }); |
---|