diff --git a/src/e2e_tests/pages/peoplefinder/profile.py b/src/e2e_tests/pages/peoplefinder/profile.py index 09c668909..59168e45d 100644 --- a/src/e2e_tests/pages/peoplefinder/profile.py +++ b/src/e2e_tests/pages/peoplefinder/profile.py @@ -28,6 +28,10 @@ def goto_profile_view_page(self): self.page.get_by_text("Back to profile").click() return ProfileViewPage(self.page) + def goto_profile_edit_team_page(self): + self.page.get_by_text("Team and role").click() + return ProfileEditPage(self.page) + @property def first_name(self): return self.page.get_attribute("input[name=first_name]", "value") @@ -56,16 +60,14 @@ def add_role(self, job_title: str, head_of_team: bool): self.page.get_by_test_id("add-role").click() # The new role form should be the last one. - form = self.page.get_by_test_id("role-form").last + formset = self.page.get_by_test_id("role-formset").last # Lets fill out the form. - form.get_by_label("Job title").fill(job_title) + formset.get_by_test_id("job-title").fill(job_title) # The head_of_team input should default to false, so we only need to click it if # we need to set it to true. if head_of_team: - form.get_by_label("Head of team").click() - - self.page.get_by_test_id("save-role").click() + formset.get_by_label("Head of team").click() def save_profile(self): self.page.get_by_test_id("save-profile").click() diff --git a/src/e2e_tests/test_peoplefinder.py b/src/e2e_tests/test_peoplefinder.py index be0399dc0..d439a3a0f 100644 --- a/src/e2e_tests/test_peoplefinder.py +++ b/src/e2e_tests/test_peoplefinder.py @@ -25,9 +25,10 @@ def test_profile(superuser, user, page: Page): # Profile edit page profile_edit_page = profile_view_page.goto_profile_edit_page() assert profile_edit_page.first_name == "John" - assert profile_edit_page.manager == "Super User" - profile_edit_page.add_role(job_title="CEO", head_of_team=True) - profile_edit_page.save_profile() + profile_edit_team_page = profile_edit_page.goto_profile_edit_team_page() + assert profile_edit_team_page.manager == "Super User" + profile_edit_team_page.add_role(job_title="CEO", head_of_team=True) + profile_edit_team_page.save_profile() # Updated profile page profile_view_page = profile_edit_page.goto_profile_view_page() diff --git a/src/peoplefinder/forms/crispy_helper.py b/src/peoplefinder/forms/crispy_helper.py index 96b4de0ec..7574c3fba 100644 --- a/src/peoplefinder/forms/crispy_helper.py +++ b/src/peoplefinder/forms/crispy_helper.py @@ -16,7 +16,10 @@ def __init__(self, *args, **kwargs): legend="Team", ), Fieldset( - "job_title", + Field( + "job_title", + data_testid="job-title", + ), "head_of_team", legend_size=Size.SMALL, legend="Job title", @@ -46,5 +49,6 @@ def __init__(self, *args, **kwargs): """ ), data_formset_form="", + data_testid="role-formset", ), ) diff --git a/src/peoplefinder/services/person.py b/src/peoplefinder/services/person.py index e3d21f66f..6d62549ae 100644 --- a/src/peoplefinder/services/person.py +++ b/src/peoplefinder/services/person.py @@ -486,7 +486,7 @@ def get_profile_section_mapping( def get_profile_section_values( self, person: "Person", profile_section: ProfileSections - ) -> List[Tuple[str, str]]: + ) -> List[Tuple[str, str, str]]: profile_section_fields = self.get_profile_section_mapping( profile_section, ).get("fields", []) @@ -506,6 +506,7 @@ def get_profile_section_values( if field_value not in [None, ""]: values.append( ( + field_name, field_label, field_value, ) diff --git a/src/peoplefinder/templates/peoplefinder/components/profile-link.html b/src/peoplefinder/templates/peoplefinder/components/profile-link.html index 1945c30f8..fef22ed1c 100644 --- a/src/peoplefinder/templates/peoplefinder/components/profile-link.html +++ b/src/peoplefinder/templates/peoplefinder/components/profile-link.html @@ -1,3 +1,3 @@ {{ profile.full_name }} + {% if data_testid %}data-testid="{{ data_testid }}"{% endif %}>{{ profile.full_name }} diff --git a/src/peoplefinder/templates/peoplefinder/profile-edit.html b/src/peoplefinder/templates/peoplefinder/profile-edit.html index 3fe0f2a7f..c37a359dd 100644 --- a/src/peoplefinder/templates/peoplefinder/profile-edit.html +++ b/src/peoplefinder/templates/peoplefinder/profile-edit.html @@ -57,11 +57,12 @@
All the information on your profile will be visible to DBT staff and contractors on diff --git a/src/peoplefinder/templates/peoplefinder/profile.html b/src/peoplefinder/templates/peoplefinder/profile.html index 527b9b55b..a255ffd94 100644 --- a/src/peoplefinder/templates/peoplefinder/profile.html +++ b/src/peoplefinder/templates/peoplefinder/profile.html @@ -64,11 +64,15 @@