diff --git a/.github/workflows/browser-tests.yaml b/.github/workflows/browser-tests.yaml index 5444b8dc1a..5ed9b960b2 100644 --- a/.github/workflows/browser-tests.yaml +++ b/.github/workflows/browser-tests.yaml @@ -8,12 +8,24 @@ on: pull_request: ~ jobs: - admin-ui-oss-headless: - name: "AdminUI-OSS/Headless" + admin-ui-oss: + name: "AdminUI-OSS" uses: ibexa/gh-workflows/.github/workflows/browser-tests.yml@main with: project-edition: 'oss' - test-suite: '--profile=browser --suite=admin-ui-full --tags=@IbexaOSS,@IbexaHeadless' + test-suite: '--profile=browser --suite=admin-ui-full --tags=@IbexaOSS' + test-setup-phase-1: '--profile=setup --suite=personas --mode=standard' + test-setup-phase-2: '--profile=setup --suite=content-translation --mode=standard' + job-count: 2 + timeout: 40 + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + admin-ui-headless: + name: "AdminUI-Headless" + uses: ibexa/gh-workflows/.github/workflows/browser-tests.yml@main + with: + project-edition: 'headless' + test-suite: '--profile=browser --suite=admin-ui-full --tags=@IbexaHeadless' test-setup-phase-1: '--profile=setup --suite=personas --mode=standard' test-setup-phase-2: '--profile=setup --suite=content-translation --mode=standard' job-count: 2 diff --git a/behat_suites.yml b/behat_suites.yml index 1507b72a29..6ea1d692be 100644 --- a/behat_suites.yml +++ b/behat_suites.yml @@ -43,6 +43,7 @@ browser: - Ibexa\Behat\Browser\Context\AuthenticationContext - Ibexa\Behat\Browser\Context\DebuggingContext - Ibexa\User\Behat\Context\UserSettingsContext + - Ibexa\AdminUi\Behat\BrowserContext\UserProfileContext personas: paths: @@ -93,3 +94,4 @@ browser: - Ibexa\Behat\Browser\Context\AuthenticationContext - Ibexa\Behat\Browser\Context\DebuggingContext - Ibexa\User\Behat\Context\UserSettingsContext + - Ibexa\AdminUi\Behat\BrowserContext\UserProfileContext diff --git a/features/standard/UserProfile.feature b/features/standard/UserProfile.feature new file mode 100644 index 0000000000..aa8b864a79 --- /dev/null +++ b/features/standard/UserProfile.feature @@ -0,0 +1,50 @@ +@IbexaHeadless @IbexaExperience @IbexaCommerce +Feature: User profile management + + @javascript + Scenario: Create a new editor + Given I am logged as admin + And I'm on Content view Page for "Users/Editors" + When I start creating a new User using "Editor" content type + And I set content fields for user + | label | value | + | First name | EditorFirstName | + | Last name | EditorLastName | + | Image | image1.png | + And I set content fields for user + | label | Username | Password | Confirm password | Email | Enabled | + | User account | testeditor | Test1234pw | Test1234pw | test@test.com | Yes | + And I perform the "Create" action + Then I should be on Content view Page for "/Users/Editors/EditorFirstName EditorLastName" + And content attributes equal + | label | value | + | First name | EditorFirstName | + | Last name | EditorLastName | + | Image | image1.png | + And content attributes equal + | label | Username | Email | Enabled | + | User account | testeditor | test@test.com | Yes | + + @javascript + Scenario: User profile is accessible and can be edited + Given I open Login page in admin SiteAccess + And I log in as "testeditor" with password "Test1234pw" + And I should be on "Dashboard" page + And I go to user profile + And I should be on "User profile" page + When I edit user profile summary + And I set content fields for user + | label | value | + | First name | EditorFirstName2 | + | Last name | EditorLastName2 | + And I switch to "About" field group + And I set content fields for user + | label | value | + | Job Title | TestJobTitle | + | Department | TestDepartment | + | Location | TestLocation | + And I perform the "Update" action + Then I should be on "User profile" page + And I should see a user profile summary with values + | Full name | Email | Job Title | Department | Location | + | EditorFirstName2 EditorLastName2 | test@test.com | TestJobTitle | TestDepartment | TestLocation | diff --git a/src/bundle/Resources/config/services/test/feature_contexts.yaml b/src/bundle/Resources/config/services/test/feature_contexts.yaml index 64aee64542..82ee1eaeb5 100644 --- a/src/bundle/Resources/config/services/test/feature_contexts.yaml +++ b/src/bundle/Resources/config/services/test/feature_contexts.yaml @@ -47,3 +47,5 @@ services: Ibexa\AdminUi\Behat\BrowserContext\BookmarkContext: ~ Ibexa\AdminUi\Behat\BrowserContext\MyDraftsContext: ~ + + Ibexa\AdminUi\Behat\BrowserContext\UserProfileContext: ~ diff --git a/src/bundle/Resources/config/services/test/pages.yaml b/src/bundle/Resources/config/services/test/pages.yaml index 01cc3fe713..9dbff56e96 100644 --- a/src/bundle/Resources/config/services/test/pages.yaml +++ b/src/bundle/Resources/config/services/test/pages.yaml @@ -61,3 +61,5 @@ services: Ibexa\AdminUi\Behat\Page\BookmarksPage: ~ Ibexa\AdminUi\Behat\Page\UserSettingsPage: ~ + + Ibexa\AdminUi\Behat\Page\UserProfilePage: ~ diff --git a/src/lib/Behat/BrowserContext/NavigationContext.php b/src/lib/Behat/BrowserContext/NavigationContext.php index 70a31fe16c..287782c354 100644 --- a/src/lib/Behat/BrowserContext/NavigationContext.php +++ b/src/lib/Behat/BrowserContext/NavigationContext.php @@ -85,6 +85,14 @@ public function iGoToUserSettings() $this->upperMenu->chooseFromUserDropdown('User settings'); } + /** + * @Given I go to user profile + */ + public function iGoToUserProfile(): void + { + $this->upperMenu->chooseFromUserDropdown('Profile'); + } + /** * @Then /^I should be on "?([^\"]*)"? page$/ */ diff --git a/src/lib/Behat/BrowserContext/UserProfileContext.php b/src/lib/Behat/BrowserContext/UserProfileContext.php new file mode 100644 index 0000000000..a1852269c4 --- /dev/null +++ b/src/lib/Behat/BrowserContext/UserProfileContext.php @@ -0,0 +1,42 @@ +userProfilePage = $userProfilePage; + } + + /** + * @Given I edit user profile summary + */ + public function editUserProfileSummary(): void + { + $this->userProfilePage->editSummary(); + } + + /** + * @Then I should see a user profile summary with values + */ + public function iVerifyUserProfileSummary(TableNode $table): void + { + $this->userProfilePage->verifyIsLoaded(); + foreach ($table->getHash() as $row) { + $this->userProfilePage->verifyUserProfileSummary($row['Full name'], $row['Email'], $row['Job Title'], $row['Department'], $row['Location']); + } + } +} diff --git a/src/lib/Behat/Page/UserProfilePage.php b/src/lib/Behat/Page/UserProfilePage.php new file mode 100644 index 0000000000..b2c7d742b4 --- /dev/null +++ b/src/lib/Behat/Page/UserProfilePage.php @@ -0,0 +1,81 @@ +contentFacade = $contentFacade; + } + + public function verifyIsLoaded(): void + { + Assert::assertEquals( + 'User profile', + $this->getHTMLPage()->find($this->getLocator('pageTitle'))->getText() + ); + } + + public function editSummary(): void + { + $this->getHTMLPage()->find($this->getLocator('editButton'))->click(); + } + + public function verifyUserProfileSummary(string $fullName, string $email, string $jobTitle, string $department, string $location): void + { + $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('fullName'))->assert()->textContains($fullName); + $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('email'))->assert()->textEquals($email); + $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('jobTitle'))->assert()->textEquals($jobTitle); + $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('department'))->assert()->textEquals($department); + $this->getHTMLPage()->setTimeout(5)->find($this->getLocator('location'))->assert()->textEquals($location); + } + + protected function specifyLocators(): array + { + return [ + new VisibleCSSLocator('pageTitle', '.ibexa-edit-header__title,.ibexa-page-title__content'), + new VisibleCSSLocator('editButton', '.ibexa-user-profile-summary__header .ibexa-btn'), + new VisibleCSSLocator('fullName', 'div.ibexa-details__item:nth-of-type(2) .ibexa-details__item-content'), + new VisibleCSSLocator('email', 'div.ibexa-details__item:nth-of-type(3) .ibexa-details__item-content'), + new VisibleCSSLocator('jobTitle', 'div.ibexa-details__item:nth-of-type(4) .ibexa-details__item-content'), + new VisibleCSSLocator('department', 'div.ibexa-details__item:nth-of-type(5) .ibexa-details__item-content'), + new VisibleCSSLocator('location', 'div.ibexa-details__item:nth-of-type(6) .ibexa-details__item-content'), + ]; + } + + protected function getRoute(): string + { + return sprintf( + '/user/profile/%d/view', + $this->contentFacade->getLocationByLocationURL($this->locationPath)->getId() + ); + } + + public function setExpectedUserData(string $locationPath): void + { + $this->locationPath = $locationPath; + } + + public function getName(): string + { + return 'User profile'; + } +}