16029: Completes the basic set of login tests.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 16 Mar 2020 19:09:00 +0000 (16:09 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 16 Mar 2020 19:09:00 +0000 (16:09 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

cypress/integration/login.spec.js

index 16ef915bdbea5ecbb4a197acbed79bcd6df73f9a..246055ae38d324a5150b6a8ca173806743f51560 100644 (file)
@@ -14,7 +14,7 @@ describe('Login tests', function() {
         cy.clearLocalStorage()
     })
 
         cy.clearLocalStorage()
     })
 
-    it('logs in successfully', function() {
+    it('logs in successfully with correct token', function() {
         const active_user = this.users['active']
         const active_token = this.client_auth['active']['api_token']
         cy.visit('/token/?api_token='+active_token)
         const active_user = this.users['active']
         const active_token = this.client_auth['active']['api_token']
         cy.visit('/token/?api_token='+active_token)
@@ -29,4 +29,16 @@ describe('Login tests', function() {
         cy.contains('Please log in')
         cy.url().should('not.contain', '/projects/')
     })
         cy.contains('Please log in')
         cy.url().should('not.contain', '/projects/')
     })
+
+    it('fails to log in with no token', function() {
+        cy.visit('/token/?api_token=')
+        cy.contains('Please log in')
+        cy.url().should('not.contain', '/projects/')
+    })
+
+    it('shows login page on first visit', function() {
+        cy.visit('/')
+        cy.contains('Please log in')
+        cy.url().should('not.contain', '/projects/')
+    })
 })
\ No newline at end of file
 })
\ No newline at end of file