Upgrade Cypress and use intercepts to check key interactions with the OpenID Connect provider.

This commit is contained in:
Ximon Eighteen
2020-12-15 01:50:52 +01:00
parent fe3741e44e
commit 49d4db59fe
2 changed files with 12 additions and 2 deletions
@@ -16,7 +16,11 @@ let login_test_settings = [
describe('OpenID Connect users', () => {
it('The correct login form is shown', () => {
cy.intercept('GET', '/api/v1/authorized').as('isAuthorized')
cy.intercept('GET', '/auth/login').as('getLoginURL')
cy.intercept('GET', /^http:\/\/localhost:1818\/authorize.+/).as('oidcLoginForm')
cy.visit('/')
cy.wait(['@isAuthorized', '@getLoginURL', '@oidcLoginForm'])
// make sure we haven't been redirected away from Krill (as would be the
// case if an OpenID Connect login form were shown)
@@ -70,7 +74,9 @@ describe('OpenID Connect users', () => {
cy.get('#userinfo_table').contains(admin.u)
// logout
cy.intercept('GET', /^http:\/\/localhost:1818\/logout.+/).as('oidcLogout')
cy.get('.logout').click()
cy.wait('@oidcLogout').its('response.statusCode').should('eq', 302)
// verify that we are shown the OpenID Connect provider login page
cy.url().should('not.include', Cypress.config('baseUrl'))
@@ -78,7 +84,7 @@ describe('OpenID Connect users', () => {
cy.get('input[name="username"]')
})
it.skip('Login receives short-lived token that cannot be refreshed', () => {
it('Login receives short-lived token that cannot be refreshed', () => {
cy.visit('/')
cy.url().should('not.include', Cypress.config('baseUrl'))
cy.contains('Mock OpenID Connect login form')
+5 -1
View File
@@ -42,6 +42,8 @@ async fn do_run_krill_ui_test(test_name: &str) {
Command::new("docker")
.arg("run")
.arg("--name")
.arg("cypress")
.arg("--rm")
.arg("--net=host")
.arg("--ipc=host")
@@ -49,7 +51,9 @@ async fn do_run_krill_ui_test(test_name: &str) {
.arg(format!("{}:/e2e", env::current_dir().unwrap().display()))
.arg("-w")
.arg("/e2e")
.arg("cypress/included:5.5.0")
// .arg("-e")
// .arg("DEBUG=cypress:proxy:http:*")
.arg("cypress/included:6.1.0")
.arg("--browser")
.arg("chrome")
.arg("--spec")