-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add e2e test for connection from legacy and agentconnect client
- Loading branch information
Showing
9 changed files
with
176 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const MONCOMPTEPRO_HOST = | ||
Cypress.env('MONCOMPTEPRO_HOST') || 'http://localhost:3000'; | ||
|
||
describe('sign-in from agentconnect client', () => { | ||
it('should sign-in', function () { | ||
cy.visit(`http://localhost:4001`); | ||
cy.get('button.moncomptepro-button').click(); | ||
|
||
cy.get('[name="login"]').type('[email protected]'); | ||
cy.get('[type="submit"]').click(); | ||
|
||
cy.get('[name="password"]').type('password123'); | ||
cy.get('[action="/users/sign-in"] [type="submit"]') | ||
.contains('Se connecter') | ||
.click(); | ||
|
||
cy.get('.fr-grid-row .fr-col-12:first-child .fr-tile__link').contains( | ||
'Commune de lamalou-les-bains - Mairie' | ||
); | ||
|
||
cy.get('.fr-grid-row .fr-col-12:first-child .fr-tile__link').click(); | ||
|
||
cy.contains('[email protected]'); | ||
cy.contains('21340126800130'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const MONCOMPTEPRO_HOST = | ||
Cypress.env('MONCOMPTEPRO_HOST') || 'http://localhost:3000'; | ||
|
||
describe('sign-in from legacy client', () => { | ||
it('should sign-in', function () { | ||
cy.visit(`http://localhost:4002`); | ||
cy.get('button.moncomptepro-button').click(); | ||
|
||
cy.get('[name="login"]').type('[email protected]'); | ||
cy.get('[type="submit"]').click(); | ||
|
||
cy.get('[name="password"]').type('password123'); | ||
cy.get('[action="/users/sign-in"] [type="submit"]') | ||
.contains('Se connecter') | ||
.click(); | ||
|
||
cy.contains('[email protected]'); | ||
cy.contains('Commune de lamalou-les-bains'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,28 @@ describe('sign-in from standard client', () => { | |
cy.get('.fr-grid-row .fr-col-12:first-child .fr-tile__link').click(); | ||
|
||
cy.contains('[email protected]'); | ||
cy.contains('Commune de lamalou-les-bains - Mairie'); | ||
}); | ||
|
||
it('should sign-in with org selection', function () { | ||
cy.visit(`http://localhost:4000`); | ||
cy.get('button.moncomptepro-button').click(); | ||
|
||
cy.get('[name="login"]').type('[email protected]'); | ||
cy.get('[type="submit"]').click(); | ||
|
||
cy.get('[name="password"]').type('password123'); | ||
cy.get('[action="/users/sign-in"] [type="submit"]') | ||
.contains('Se connecter') | ||
.click(); | ||
|
||
cy.get('.fr-grid-row .fr-col-12:last-child .fr-tile__link').contains( | ||
'Commune de clamart - Mairie' | ||
); | ||
|
||
cy.get('.fr-grid-row .fr-col-12:last-child .fr-tile__link').click(); | ||
|
||
cy.contains('[email protected]'); | ||
cy.contains('Commune de clamart - Mairie'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DO_NOT_SEND_MAIL="True" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DO_NOT_SEND_MAIL="True" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
INSERT INTO users | ||
(id, email, email_verified, email_verified_at, encrypted_password, created_at, updated_at, given_name, family_name, | ||
phone_number, job) | ||
VALUES | ||
(1, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'Jean', '0123456789', 'Sbire'); | ||
|
||
|
||
INSERT INTO organizations | ||
(id, siret, verified_email_domains, authorized_email_domains, created_at, updated_at) | ||
VALUES | ||
(1, '21340126800130', '{}', '{}', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); | ||
|
||
INSERT INTO users_organizations | ||
(user_id, organization_id, is_external, verification_type, authentication_by_peers_type, has_been_greeted) | ||
VALUES | ||
(1, 1, false, 'verified_email_domain', 'all_members_notified', true); | ||
|
||
INSERT INTO oidc_clients | ||
(client_name, client_id, client_secret, redirect_uris, | ||
post_logout_redirect_uris, scope, client_uri, client_description, | ||
userinfo_signed_response_alg, id_token_signed_response_alg, | ||
authorization_signed_response_alg, introspection_signed_response_alg) | ||
VALUES | ||
( | ||
'AgentConnect', | ||
'agentconnect_client_id', | ||
'agentconnect_client_secret', | ||
ARRAY [ | ||
'http://localhost:4001/login-callback' | ||
], | ||
ARRAY []::varchar[], | ||
'openid uid given_name usual_name email phone siret', | ||
'http://localhost:4001/', | ||
'Dispositif d’identification des agents de la fonction publique.', | ||
'ES256', 'ES256', 'ES256', 'ES256'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
INSERT INTO users | ||
(id, email, email_verified, email_verified_at, encrypted_password, created_at, updated_at, given_name, family_name, | ||
phone_number, job) | ||
VALUES | ||
(1, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'Jean', '0123456789', 'Sbire'); | ||
|
||
|
||
INSERT INTO organizations | ||
(id, siret, verified_email_domains, authorized_email_domains, created_at, updated_at) | ||
VALUES | ||
(1, '21340126800130', '{}', '{}', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); | ||
|
||
INSERT INTO users_organizations | ||
(user_id, organization_id, is_external, verification_type, authentication_by_peers_type, has_been_greeted) | ||
VALUES | ||
(1, 1, false, 'verified_email_domain', 'all_members_notified', true); | ||
|
||
INSERT INTO oidc_clients | ||
(client_name, client_id, client_secret, redirect_uris, | ||
post_logout_redirect_uris, scope, client_uri, client_description, | ||
userinfo_signed_response_alg, id_token_signed_response_alg, | ||
authorization_signed_response_alg, introspection_signed_response_alg) | ||
VALUES | ||
('Oidc Test Client', | ||
'legacy_client_id', | ||
'legacy_client_secret', | ||
ARRAY [ | ||
'http://localhost:4002/login-callback' | ||
], | ||
ARRAY []::varchar[], | ||
'openid email profile phone organizations', | ||
'http://localhost:4002/', | ||
'This is a small, golang-based OIDC Client, to be used in End-to-end or other testing. More info: https://hub.docker.com/r/beryju/oidc-test-client.', | ||
null, null, null, null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,22 @@ INSERT INTO users | |
(id, email, email_verified, email_verified_at, encrypted_password, created_at, updated_at, given_name, family_name, | ||
phone_number, job) | ||
VALUES | ||
(1, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'Jean', '0123456789', 'Sbire'); | ||
(1, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'Jean1', '0123456789', 'Sbire'), | ||
(2, '[email protected]', true, CURRENT_TIMESTAMP, '$2a$10$kzY3LINL6..50Fy9shWCcuNlRfYq0ft5lS.KCcJ5PzrhlWfKK4NIO', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Jean', 'Jean2', '0123456789', 'Sbire'); | ||
|
||
|
||
INSERT INTO organizations | ||
(id, siret, verified_email_domains, authorized_email_domains, created_at, updated_at) | ||
VALUES | ||
(1, '21340126800130', '{}', '{}', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); | ||
(1, '21340126800130', '{}', '{}', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), | ||
(2, '21920023500014', '{}', '{}', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); | ||
|
||
INSERT INTO users_organizations | ||
(user_id, organization_id, is_external, verification_type, authentication_by_peers_type, has_been_greeted) | ||
VALUES | ||
(1, 1, false, 'verified_email_domain', 'all_members_notified', true); | ||
(1, 1, false, 'verified_email_domain', 'all_members_notified', true), | ||
(2, 1, false, 'verified_email_domain', 'all_members_notified', true), | ||
(2, 2, false, 'verified_email_domain', 'all_members_notified', true); | ||
|
||
INSERT INTO oidc_clients | ||
(client_name, client_id, client_secret, redirect_uris, | ||
|
@@ -22,8 +26,8 @@ INSERT INTO oidc_clients | |
authorization_signed_response_alg, introspection_signed_response_alg) | ||
VALUES | ||
('Oidc Test Client', | ||
'client_id', | ||
'client_secret', | ||
'standard_client_id', | ||
'standard_client_secret', | ||
ARRAY [ | ||
'http://localhost:4000/login-callback' | ||
], | ||
|