-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #952 from danskernesdigitalebibliotek/release/brah…
…ma-13 Merge Release/brahma 13 into develop
- Loading branch information
Showing
28 changed files
with
619 additions
and
80 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -59,8 +59,11 @@ describe("Adgangsplatformen", () => { | |
"The website encountered an unexpected error. Please try again later." | ||
); | ||
}); | ||
// TODO: The test should be re-added when the new user registration is implemented. | ||
it.skip("can register a new user and expose the right tokens for the react apps", () => { | ||
|
||
// When a user comes back from authentication with MitID, the user should | ||
// not be able to do anything else other than registering or cancelling. | ||
// Check that the header and footer sections is not vissible. | ||
it("does not show header and footer section for unregistered user", () => { | ||
cy.setupAdgangsplatformenRegisterMappinngs({ | ||
authorizationCode: "7c5e3213aea6ef42ec97dfeaa6f5b1d454d856dc", | ||
accessToken: "447131b0a03fe0421204c54e5c21a60-new-user", | ||
|
@@ -69,9 +72,14 @@ describe("Adgangsplatformen", () => { | |
|
||
cy.clearCookies(); | ||
cy.visit("/"); | ||
// Open user menu. | ||
cy.get(".header__menu-profile").click(); | ||
// Click create profile. | ||
cy.get(".modal-login__btn-create-profile").click(); | ||
cy.get("main#main-content").find("a").click(); | ||
cy.get("main#main-content") | ||
.get(".paragraphs__item--user_registration_section__link") | ||
.first() | ||
.click(); | ||
|
||
cy.request("/dpl-react/user-tokens").then((response) => { | ||
expect(response.status).to.eq(200); | ||
|
@@ -80,27 +88,49 @@ describe("Adgangsplatformen", () => { | |
); | ||
}); | ||
|
||
cy.get(".header").should("not.exist"); | ||
cy.get(".footer").should("not.exist"); | ||
}); | ||
|
||
it("can register a new user and expose the right tokens for the react apps", () => { | ||
cy.setupAdgangsplatformenRegisterMappinngs({ | ||
authorizationCode: "7c5e3213aea6ef42ec97dfeaa6f5b1d454d856dc", | ||
accessToken: "447131b0a03fe0421204c54e5c21a60-new-user", | ||
userCPR: 1412749999, | ||
}); | ||
|
||
cy.clearCookies(); | ||
cy.visit("/"); | ||
cy.get(".header__menu-profile").click(); | ||
cy.get(".modal-login__btn-create-profile").click(); | ||
cy.get("main#main-content") | ||
.get(".paragraphs__item--user_registration_section__link") | ||
.first() | ||
.click(); | ||
cy.request("/dpl-react/user-tokens").then((response) => { | ||
expect(response.status).to.eq(200); | ||
expect(response.body).contain( | ||
'window.dplReact = window.dplReact || {};\nwindow.dplReact.setToken("unregistered-user", "447131b0a03fe0421204c54e5c21a60-new-user")' | ||
); | ||
}); | ||
|
||
cy.get('[data-cy="phone-input"]').type("12345678"); | ||
cy.get('[data-cy="email-address-input"]').type("[email protected]"); | ||
cy.get('[data-cy="pincode-input"]').type("1234"); | ||
cy.get('[data-cy="pincode-confirm-input"]').type("1234"); | ||
cy.get("#branches-dropdown").select("DK-775100"); | ||
cy.get(".btn-primary").click(); | ||
cy.get('[data-cy="dashboard-header"]').contains("Your profile"); | ||
cy.get('[data-cy="complete-user-registration-button"]').click(); | ||
cy.request("/dpl-react/user-tokens").then((response) => { | ||
expect(response.body).contain( | ||
'window.dplReact = window.dplReact || {};\nwindow.dplReact.setToken("user", "447131b0a03fe0421204c54e5c21a60-new-user")' | ||
); | ||
expect(response.body).not.contain( | ||
'window.dplReact = window.dplReact || {};\nwindow.dplReact.setToken("unregistered-user", "447131b0a03fe0421204c54e5c21a60-new-user")' | ||
); | ||
}); | ||
}); | ||
|
||
// When a user comes back from authentication with MitID | ||
// the user should not be able to anything else than registering or logging out. | ||
// So when pressing the user icon after authentication the modal only contains | ||
// the logout button. | ||
|
||
// TODO: The test should be re-added when the new user registration is implemented. | ||
it.skip("only shows a logout button in the user menu for an uregistered user", () => { | ||
it("can cancel user registration from the user registration page", () => { | ||
cy.setupAdgangsplatformenRegisterMappinngs({ | ||
authorizationCode: "7c5e3213aea6ef42ec97dfeaa6f5b1d454d856dc", | ||
accessToken: "447131b0a03fe0421204c54e5c21a60-new-user", | ||
|
@@ -109,15 +139,29 @@ describe("Adgangsplatformen", () => { | |
|
||
cy.clearCookies(); | ||
cy.visit("/"); | ||
// Open user menu. | ||
cy.get(".header__menu-profile").click(); | ||
// Click create profile. | ||
cy.get(".modal-login__btn-create-profile").click(); | ||
cy.get("main#main-content").find("a").click(); | ||
cy.get("main#main-content") | ||
.get(".paragraphs__item--user_registration_section__link") | ||
.first() | ||
.click(); | ||
cy.request("/dpl-react/user-tokens").then((response) => { | ||
expect(response.status).to.eq(200); | ||
expect(response.body).contain( | ||
'window.dplReact = window.dplReact || {};\nwindow.dplReact.setToken("unregistered-user", "447131b0a03fe0421204c54e5c21a60-new-user")' | ||
); | ||
}); | ||
|
||
cy.get(".header__menu-profile").click(); | ||
cy.get(".modal-login").find(".btn-primary").should("have.length", 1); | ||
cy.get(".modal-login").find(".btn-primary").contains("Log out"); | ||
cy.get('[data-cy="cancel-user-registration-button"]').click(); | ||
|
||
cy.request("/dpl-react/user-tokens").then((response) => { | ||
expect(response.body).not.contain( | ||
'window.dplReact = window.dplReact || {};\nwindow.dplReact.setToken("user", "447131b0a03fe0421204c54e5c21a60-new-user")' | ||
); | ||
expect(response.body).not.contain( | ||
'window.dplReact = window.dplReact || {};\nwindow.dplReact.setToken("unregistered-user", "447131b0a03fe0421204c54e5c21a60-new-user")' | ||
); | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
|
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 @@ | ||
describe("Check static pages", () => { | ||
it("does 'Privatlivspolitik' page exist", () => { | ||
cy.visit("/privatlivspolitik"); | ||
cy.get("main#main-content").get(".article-header").should("exist"); | ||
}); | ||
it("does 'Velkommen' page exist", () => { | ||
cy.visit("/velkommen"); | ||
cy.get("main#main-content").get(".article-header").should("exist"); | ||
}); | ||
it("does 'Pausefunktion' page exist", () => { | ||
cy.visit("/pausefunktion"); | ||
cy.get("main#main-content").get(".article-header").should("exist"); | ||
}); | ||
it("does 'Takster' page exist", () => { | ||
cy.visit("/takster"); | ||
cy.get("main#main-content").get(".article-header").should("exist"); | ||
}); | ||
it("does 'Reglement' page exist", () => { | ||
cy.visit("/reglement"); | ||
cy.get("main#main-content").get(".article-header").should("exist"); | ||
}); | ||
it("does 'Opret bruger' page exist", () => { | ||
cy.visit("/opret-bruger"); | ||
cy.get("main#main-content").get(".article-header").should("exist"); | ||
}); | ||
}); |
78 changes: 78 additions & 0 deletions
78
docs/architecture/adr-011-configuration-translation-system.md
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,78 @@ | ||
# Architecture Decision Record: Configuration translation system | ||
|
||
## Context | ||
|
||
The translation system described in | ||
[adr-009-translation-system](./adr-009-translation-system.md) | ||
handles solely the translations added through Drupals traditional translation handling. | ||
|
||
But there was a wish for being able to translate configuration related strings | ||
as well. This includes titles, labels, descriptions, | ||
and other elements in the admin area. | ||
|
||
We needed to find a way to handle translation of that kind as well. | ||
|
||
## Decision | ||
|
||
We went for a solution where we activated the Configuration Translation | ||
Drupal core module and added the [Configuration Translation PO contrib module](https://www.drupal.org/project/config_translation_po). | ||
|
||
And we added a range of custom drush commands to handle the various | ||
configuration translation tasks. | ||
|
||
## Consequences | ||
|
||
By sticking to the handling of PO files in configuration handling that we are | ||
already using in our general translation handling, | ||
we can keep the current Github workflows with some alterations. | ||
|
||
Unfortunately handling translations of configuration on local sites | ||
is still as difficult as before. | ||
Translation of configuration texts cannot be found in the standard UI strings | ||
translation list. | ||
|
||
### Alterations to former translation workflow | ||
|
||
With the config translation PO files added we tried to uncover if POEditor was | ||
able to handle two PO files simultaneously in both import and export context. | ||
It could not. | ||
|
||
But we still needed, in Drupal, to be able to import two different files: | ||
One for general translations and one for configuration translations. | ||
|
||
We came up with the idea that we could merge the two files going when importing | ||
into POEditor and split it again when exporting from POEditor. | ||
|
||
We tried it out and it worked so that was the solution we ended up with. | ||
|
||
## Alternatives considered | ||
|
||
### Using the config_translate module | ||
|
||
We could activate only the config_translate module and add a danish translations | ||
in config/sync. | ||
But then: | ||
|
||
1. We would not be able to use POEditor | ||
2. We would need to translate the string on behalf of the administrators | ||
|
||
### A hack | ||
|
||
We could keep the machine names of the config in English but write the titles, | ||
labels, descriptions in Danish. | ||
|
||
But that would have the following bad consequences: | ||
|
||
1. The administrators would have to find all the texts in various, not obvious, | ||
places in the admin area. | ||
2. It would differ from the general translation routine which is confusing | ||
3. We would not be able to handle multiple languages for the configuration translations | ||
|
||
### Extending the Potion module | ||
|
||
Change the Potion module to be able to scan configuration translations as well. | ||
|
||
We did not have a clear view of the concept of localizing configuration | ||
translations in the same manner as the Potion module scans the codebase. | ||
It could either be cumbersome to get the two worlds to meet in the same Potion | ||
functionalities or simply incompatible. |
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
Oops, something went wrong.