diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 27a4ed15a..83a63b36a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -105,7 +105,7 @@ Sprint retrospective ## Philosophy -We practise [collective code ownership](http://www.extremeprogramming.org/rules/collective.html) rather than strong code ownership, which means that: +We practice [collective code ownership](http://www.extremeprogramming.org/rules/collective.html) rather than strong code ownership, which means that: * developers can make contributions to other people's PRs (after checking in with them) * we avoid blocking because someone else isn't working, so we sometimes take over PRs from other developers @@ -115,7 +115,7 @@ We believe in open source contributions as a learning experience – everyone is We use pair programming sessions as a tool for knowledge sharing. We can learn a lot from each other and only by sharing what we know and overcoming challenges together can we grow as a team and truly own this project collectively. -As a volunteeer you have no commitment except your own self development and your awesomeness by contributing to this free and open-source software project. Cheers to you! +As a volunteer you have no commitment except your own self development and your awesomeness by contributing to this free and open-source software project. Cheers to you! + +## Programming + +### Localization + +#### Quotation Marks + +The following characters are different from the programming quotation mark: + +`"` or `\"` + +Please copy and paste the following quotes for the languages: + +* de: „Dies ist ein Beispielsatz.“ +* en: “This is a sample sentence.” + * See + +## Docker – More Closely + +### Apple M1 Platform + +***Attention:** For using Docker commands in Apple M1 environments!* + +#### Environment Variable For Apple M1 Platform + +To set the Docker platform environment variable in your terminal tab, run: + +```bash +# set env variable for your shell +$ export DOCKER_DEFAULT_PLATFORM=linux/amd64 +``` + +#### Docker Compose Override File For Apple M1 Platform + +For Docker compose `up` or `build` commands, you can use our Apple M1 override file that specifies the M1 platform: + +```bash +# in main folder + +# for development +$ docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.apple-m1.override.yml up +# only once: init admin user and create indexes and contraints in Neo4j database +$ docker compose exec backend yarn prod:migrate init +# clean db +$ docker compose exec backend yarn db:reset +# seed db +$ docker compose exec backend yarn db:seed + +# for production +$ docker compose -f docker-compose.yml -f docker-compose.apple-m1.override.yml up +# only once: init admin user and create indexes and contraints in Neo4j database +$ docker compose exec backend /bin/sh -c "yarn prod:migrate init" +``` + +### Analyzing Docker Builds + +To analyze a Docker build, there is a wonderful tool called [dive](https://github.com/wagoodman/dive). Please sponsor if you're using it! + +The `dive build` command is exactly the right one to fulfill what we are looking for. +We can use it just like the `docker build` command and get an analysis afterwards. + +So, in our main folder, we use it in the following way: + +```bash +# in main folder +$ dive build --target -t "ocelotsocialnetwork/:local-" --build-arg BBUILD_DATE="" --build-arg BBUILD_VERSION="" --build-arg BBUILD_COMMIT="" / +``` + +The build arguments are optional. + +For the specific applications, we use them as follows. + +#### Backend + +##### Production For Backend + +```bash +# in main folder +$ dive build --target production -t "ocelotsocialnetwork/backend:local-production" backend/ +``` + +##### Development For Backend + +```bash +# in main folder +$ dive build --target development -t "ocelotsocialnetwork/backend:local-development" backend/ +``` + +#### Webapp + +##### Production For Webapp + +```bash +# in main folder +$ dive build --target production -t "ocelotsocialnetwork/webapp:local-production" webapp/ +``` + +##### Development For Webapp + +```bash +# in main folder +$ dive build --target development -t "ocelotsocialnetwork/webapp:local-development" webapp/ +``` diff --git a/DOCKER_MORE_CLOSELY.md b/DOCKER_MORE_CLOSELY.md deleted file mode 100644 index 03e6417ec..000000000 --- a/DOCKER_MORE_CLOSELY.md +++ /dev/null @@ -1,86 +0,0 @@ -# Docker More Closely - -## Apple M1 Platform - -***Attention:** For using Docker commands in Apple M1 environments!* - -### Enviroment Variable For Apple M1 Platform - -To set the Docker platform environment variable in your terminal tab, run: - -```bash -# set env variable for your shell -$ export DOCKER_DEFAULT_PLATFORM=linux/amd64 -``` - -### Docker Compose Override File For Apple M1 Platform - -For Docker compose `up` or `build` commands, you can use our Apple M1 override file that specifies the M1 platform: - -```bash -# in main folder - -# for development -$ docker compose -f docker-compose.yml -f docker-compose.override.yml -f docker-compose.apple-m1.override.yml up -# only once: init admin user and create indexes and contraints in Neo4j database -$ docker compose exec backend yarn prod:migrate init -# clean db -$ docker compose exec backend yarn db:reset -# seed db -$ docker compose exec backend yarn db:seed - -# for production -$ docker compose -f docker-compose.yml -f docker-compose.apple-m1.override.yml up -# only once: init admin user and create indexes and contraints in Neo4j database -$ docker compose exec backend /bin/sh -c "yarn prod:migrate init" -``` - -## Analysing Docker Builds - -To analyze a Docker build, there is a wonderful tool called [dive](https://github.com/wagoodman/dive). Please sponsor if you're using it! - -The `dive build` command is exactly the right one to fulfill what we are looking for. -We can use it just like the `docker build` command and get an analysis afterwards. - -So, in our main folder, we use it in the following way: - -```bash -# in main folder -$ dive build --target -t "ocelotsocialnetwork/:local-" --build-arg BBUILD_DATE="" --build-arg BBUILD_VERSION="" --build-arg BBUILD_COMMIT="" / -``` - -The build arguments are optional. - -For the specific applications, we use them as follows. - -### Backend - -#### Production For Backend - -```bash -# in main folder -$ dive build --target production -t "ocelotsocialnetwork/backend:local-production" backend/ -``` - -#### Development For Backend - -```bash -# in main folder -$ dive build --target development -t "ocelotsocialnetwork/backend:local-development" backend/ -``` - -### Webapp - -#### Production For Webapp - -```bash -# in main folder -$ dive build --target production -t "ocelotsocialnetwork/webapp:local-production" webapp/ -``` - -#### Development For Webapp - -```bash -# in main folder -$ dive build --target development -t "ocelotsocialnetwork/webapp:local-development" webapp/ -``` diff --git a/cypress/cypress.json b/cypress/cypress.json index 3f41ca3e5..dbe8691fa 100644 --- a/cypress/cypress.json +++ b/cypress/cypress.json @@ -1,5 +1,6 @@ { "projectId": "qa7fe2", + "defaultCommandTimeout": 10000, "ignoreTestFiles": "*.js", "chromeWebSecurity": false, "baseUrl": "http://localhost:3000", diff --git a/cypress/integration/UserProfile.SocialMedia.feature b/cypress/integration/UserProfile.SocialMedia.feature index 5ab1feb25..04c227661 100644 --- a/cypress/integration/UserProfile.SocialMedia.feature +++ b/cypress/integration/UserProfile.SocialMedia.feature @@ -13,29 +13,29 @@ Feature: User profile - list social media accounts When I navigate to page "/settings/my-social-media" Then I am on page "/settings/my-social-media" When I add a social media link - Then I see a toaster with "Added social media" + Then I see a toaster with status "success" And the new social media link shows up on the page Scenario: Other users viewing my Social Media - Given I have added a social media link + Given I have added the social media link "https://freeradical.zone/peter-pan" When I navigate to page "/profile/peter-pan" Then they should be able to see my social media links Scenario: Deleting Social Media When I navigate to page "/settings/my-social-media" Then I am on page "/settings/my-social-media" - Given I have added a social media link - When I delete a social media link - Then I see a toaster with "Deleted social media" + Given I have added the social media link "https://freeradical.zone/peter-pan" + When I delete the social media link "https://freeradical.zone/peter-pan" + Then I see a toaster with status "success" Scenario: Editing Social Media When I navigate to page "/settings/my-social-media" Then I am on page "/settings/my-social-media" - Given I have added a social media link + Given I have added the social media link "https://freeradical.zone/peter-pan" When I start editing a social media link Then I can cancel editing When I start editing a social media link And I edit and save the link - Then I see a toaster with "Added social media" + Then I see a toaster with status "success" And the new url is displayed But the old url is not displayed diff --git a/cypress/integration/UserProfile.SocialMedia/I_add_a_social_media_link.js b/cypress/integration/UserProfile.SocialMedia/I_add_a_social_media_link.js index ca2e36818..07c80b30c 100644 --- a/cypress/integration/UserProfile.SocialMedia/I_add_a_social_media_link.js +++ b/cypress/integration/UserProfile.SocialMedia/I_add_a_social_media_link.js @@ -1,12 +1,10 @@ import { When } from "cypress-cucumber-preprocessor/steps"; When('I add a social media link', () => { - cy.get('button') - .contains('Add link') + cy.get('[data-test="add-save-button"]') .click() .get('#editSocialMedia') .type('https://freeradical.zone/peter-pan') - .get('button') - .contains('Save') + .get('[data-test="add-save-button"]') .click() }) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_delete_a_social_media_link.js b/cypress/integration/UserProfile.SocialMedia/I_delete_a_social_media_link.js deleted file mode 100644 index 10daffca1..000000000 --- a/cypress/integration/UserProfile.SocialMedia/I_delete_a_social_media_link.js +++ /dev/null @@ -1,6 +0,0 @@ -import { When } from "cypress-cucumber-preprocessor/steps"; - -When('I delete a social media link', () => { - cy.get(".base-button[title='Delete']") - .click() -}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_delete_the_social_media_link_{string}.js b/cypress/integration/UserProfile.SocialMedia/I_delete_the_social_media_link_{string}.js new file mode 100644 index 000000000..6b65e361b --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/I_delete_the_social_media_link_{string}.js @@ -0,0 +1,12 @@ +import { When } from "cypress-cucumber-preprocessor/steps"; + +When('I delete the social media link {string}', (link) => { + cy.get('[data-test="delete-button"]') + .click() + cy.get('[data-test="confirm-modal"]') + .should("be.visible") + cy.get('[data-test="confirm-button"]') + .click() + cy.get('.ds-list-item-content > a') + .contains(link).should('not.exist') +}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_edit_and_save_the_link.js b/cypress/integration/UserProfile.SocialMedia/I_edit_and_save_the_link.js index 714e6b701..54712920d 100644 --- a/cypress/integration/UserProfile.SocialMedia/I_edit_and_save_the_link.js +++ b/cypress/integration/UserProfile.SocialMedia/I_edit_and_save_the_link.js @@ -4,7 +4,6 @@ When('I edit and save the link', () => { cy.get('input#editSocialMedia') .clear() .type('https://freeradical.zone/tinkerbell') - .get('button') - .contains('Save') + .get('[data-test="add-save-button"]') .click() }) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_have_added_a_social_media_link.js b/cypress/integration/UserProfile.SocialMedia/I_have_added_a_social_media_link.js deleted file mode 100644 index 93e35bf28..000000000 --- a/cypress/integration/UserProfile.SocialMedia/I_have_added_a_social_media_link.js +++ /dev/null @@ -1,13 +0,0 @@ -import { Given } from "cypress-cucumber-preprocessor/steps"; - -Given('I have added a social media link', () => { - cy.visit('/settings/my-social-media') - .get('button') - .contains('Add link') - .click() - .get('#editSocialMedia') - .type('https://freeradical.zone/peter-pan') - .get('button') - .contains('Save') - .click() -}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_have_added_the_social_media_link_{string}.js b/cypress/integration/UserProfile.SocialMedia/I_have_added_the_social_media_link_{string}.js new file mode 100644 index 000000000..78a0191d2 --- /dev/null +++ b/cypress/integration/UserProfile.SocialMedia/I_have_added_the_social_media_link_{string}.js @@ -0,0 +1,13 @@ +import { Given } from "cypress-cucumber-preprocessor/steps"; + +Given('I have added the social media link {string}', (link) => { + cy.visit('/settings/my-social-media') + .get('[data-test="add-save-button"]') + .click() + .get('#editSocialMedia') + .type(link) + .get('[data-test="add-save-button"]') + .click() + cy.get('.ds-list-item-content > a') + .contains(link) +}) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/I_start_editing_a_social_media_link.js b/cypress/integration/UserProfile.SocialMedia/I_start_editing_a_social_media_link.js index 1da05cfa5..e3e5c2a22 100644 --- a/cypress/integration/UserProfile.SocialMedia/I_start_editing_a_social_media_link.js +++ b/cypress/integration/UserProfile.SocialMedia/I_start_editing_a_social_media_link.js @@ -1,6 +1,6 @@ import { When } from "cypress-cucumber-preprocessor/steps"; When('I start editing a social media link', () => { - cy.get(".base-button[title='Edit']") + cy.get('[data-test="edit-button"]') .click() }) \ No newline at end of file diff --git a/cypress/integration/UserProfile.SocialMedia/they_should_be_able_to_see_my_social_media_links.js b/cypress/integration/UserProfile.SocialMedia/they_should_be_able_to_see_my_social_media_links.js index 249e4f420..89db2bd77 100644 --- a/cypress/integration/UserProfile.SocialMedia/they_should_be_able_to_see_my_social_media_links.js +++ b/cypress/integration/UserProfile.SocialMedia/they_should_be_able_to_see_my_social_media_links.js @@ -1,8 +1,8 @@ import { Then } from "cypress-cucumber-preprocessor/steps"; Then('they should be able to see my social media links', () => { - cy.get('.base-card') - .contains('Where else can I find Peter Pan?') + cy.get('[data-test="social-media-list-headline"]') + .contains('Peter Pan') .get('a[href="https://freeradical.zone/peter-pan"]') .should('have.length', 1) }) \ No newline at end of file diff --git a/cypress/integration/common/I_see_a_toaster_with_status_{string}.js b/cypress/integration/common/I_see_a_toaster_with_status_{string}.js new file mode 100644 index 000000000..aa07d787c --- /dev/null +++ b/cypress/integration/common/I_see_a_toaster_with_status_{string}.js @@ -0,0 +1,9 @@ +import { Then } from "cypress-cucumber-preprocessor/steps"; + +Then("I see a toaster with status {string}", (status) => { + switch (status) { + case "success": + cy.get(".iziToast.iziToast-color-green").should("be.visible"); + break; + } +}) \ No newline at end of file diff --git a/webapp/components/Modal.vue b/webapp/components/Modal.vue index a76adac3f..9195ad179 100644 --- a/webapp/components/Modal.vue +++ b/webapp/components/Modal.vue @@ -22,6 +22,7 @@ :name="name" @close="close" /> + - + @@ -15,6 +15,7 @@ :danger="!modalData.buttons.confirm.danger" :icon="modalData.buttons.cancel.icon" @click="cancel" + data-test="cancel-button" > {{ $t(modalData.buttons.cancel.textIdent) }} @@ -25,6 +26,7 @@ :icon="modalData.buttons.confirm.icon" :loading="loading" @click="confirm" + data-test="confirm-button" > {{ $t(modalData.buttons.confirm.textIdent) }} @@ -41,10 +43,10 @@ export default { SweetalertIcon, }, props: { - name: { type: String, default: '' }, - type: { type: String, required: true }, + name: { type: String, default: '' }, // only used for compatibility with the other modals in 'Modal.vue' + type: { type: String, required: true }, // only used for compatibility with the other modals in 'Modal.vue' modalData: { type: Object, required: true }, - id: { type: String, required: true }, + id: { type: String, required: true }, // only used for compatibility with the other modals in 'Modal.vue' }, data() { return { diff --git a/webapp/components/SocialMedia/SocialMedia.vue b/webapp/components/SocialMedia/SocialMedia.vue index e7f2b6a3b..c34bc54c0 100644 --- a/webapp/components/SocialMedia/SocialMedia.vue +++ b/webapp/components/SocialMedia/SocialMedia.vue @@ -2,7 +2,7 @@