increase login code coverage
parent
e895909392
commit
b1cc77ac53
|
|
@ -32,6 +32,11 @@ describe('Read Only User', () => {
|
||||||
cy.visit('/workOrders');
|
cy.visit('/workOrders');
|
||||||
cy.get("a[href*='/new']").should('not.exist');
|
cy.get("a[href*='/new']").should('not.exist');
|
||||||
});
|
});
|
||||||
|
it('Redirects to Dashboard when attempting to access the login page while authenticated', () => {
|
||||||
|
cy.visit('/login');
|
||||||
|
cy.wait(200);
|
||||||
|
cy.location('pathname').should('equal', '/dashboard/');
|
||||||
|
});
|
||||||
it('Redirects to Dashboard when attempting to create a work order', () => {
|
it('Redirects to Dashboard when attempting to create a work order', () => {
|
||||||
cy.visit('/workOrders/new');
|
cy.visit('/workOrders/new');
|
||||||
cy.wait(200);
|
cy.wait(200);
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,12 @@ describe('Read Only User', () => {
|
||||||
cy.get("a[href*='/new']").should('not.exist')
|
cy.get("a[href*='/new']").should('not.exist')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Redirects to Dashboard when attempting to access the login page while authenticated', () => {
|
||||||
|
cy.visit('/login')
|
||||||
|
cy.wait(200)
|
||||||
|
cy.location('pathname').should('equal', '/dashboard/')
|
||||||
|
})
|
||||||
|
|
||||||
it('Redirects to Dashboard when attempting to create a work order', () => {
|
it('Redirects to Dashboard when attempting to create a work order', () => {
|
||||||
cy.visit('/workOrders/new')
|
cy.visit('/workOrders/new')
|
||||||
cy.wait(200)
|
cy.wait(200)
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,13 @@ describe('Login Page', () => {
|
||||||
cy.wait(200);
|
cy.wait(200);
|
||||||
cy.location('pathname').should('contain', '/login');
|
cy.location('pathname').should('contain', '/login');
|
||||||
});
|
});
|
||||||
|
it('Redirects to login when invalid credentials are used', () => {
|
||||||
|
cy.get("form [name='userName']").type('*testUser');
|
||||||
|
cy.get("form [name='password']").type('b@dP@ssword');
|
||||||
|
cy.get('form').submit();
|
||||||
|
cy.location('pathname').should('contain', '/login');
|
||||||
|
cy.get('form').contains('Login Failed', {
|
||||||
|
matchCase: false
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,17 @@ describe('Login Page', () => {
|
||||||
cy.wait(200)
|
cy.wait(200)
|
||||||
cy.location('pathname').should('contain', '/login')
|
cy.location('pathname').should('contain', '/login')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Redirects to login when invalid credentials are used', () => {
|
||||||
|
cy.get("form [name='userName']").type('*testUser')
|
||||||
|
cy.get("form [name='password']").type('b@dP@ssword')
|
||||||
|
|
||||||
|
cy.get('form').submit()
|
||||||
|
|
||||||
|
cy.location('pathname').should('contain', '/login')
|
||||||
|
|
||||||
|
cy.get('form').contains('Login Failed', {
|
||||||
|
matchCase: false
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -58,5 +58,5 @@ export function getSafeRedirectURL(possibleRedirectURL = '') {
|
||||||
return urlPrefix + urlToCheck;
|
return urlPrefix + urlToCheck;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return urlPrefix + '/dashboard';
|
return urlPrefix + '/dashboard/';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,5 +81,5 @@ export function getSafeRedirectURL(possibleRedirectURL = ''): string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return urlPrefix + '/dashboard'
|
return urlPrefix + '/dashboard/'
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue