-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-6330: [Behat] Cover "My Drafts" Page #878
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
15e4db1
Initial implementation
mnocon a101525
FInished the task of testing draft deletion
jwibexa ce02d33
Added the test for the edition of draft, splited the tests into 2 ver…
jwibexa ce60cf9
cleanup
jwibexa d18ed29
Improvemtn of the edit table selector
jwibexa 46ff77d
Fixes regarding editing draft selectors
jwibexa 7598d52
code style check fix
jwibexa 0564386
Fixes regarding veryfiing deletion, style fixes, veryfiisloaded added
jwibexa ed4d919
Added fix regarding not finding delete confirmation, naming fix
jwibexa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ | ||
@IbexaOSS @IbexaHeadless @IbexaExperience @IbexaCommerce @javascript | ||
Feature: My Drafts | ||
|
||
Scenario: It is possible to delete a draft | ||
Given I create "article" Content drafts | ||
| title | short_title | parentPath | language | | ||
| TestMyDraft | TestMyDraft | root | eng-GB | | ||
And I am logged as admin | ||
And I open "MyDrafts" page in admin SiteAccess | ||
When I delete the draft "TestMyDraft" from my draft lists | ||
Then I see the draft "TestMyDraft" is deleted | ||
|
||
Scenario: It is possible to edit a draft | ||
Given I create "article" Content drafts | ||
| title | short_title | parentPath | language | | ||
| TestMyDraft | TestMyDraft | root | eng-GB | | ||
And I am logged as admin | ||
And I open "MyDrafts" page in admin SiteAccess | ||
When I edit "TestMyDraft" on MyDrafts page | ||
And I set content fields | ||
| label | value | | ||
| Title | TestMyDraftSavePublish | | ||
| Short title | TestMyDraftSavePublish | | ||
| Intro | TestMyDraftIntro | | ||
And I click on the edit action bar button "Save" | ||
Then I should be on Content update page for "TestMyDraftSavePublish" |
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
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,45 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace Ibexa\AdminUi\Behat\BrowserContext; | ||
|
||
use Behat\Behat\Context\Context; | ||
use Ibexa\AdminUi\Behat\Page\MyDraftsPage; | ||
use PHPUnit\Framework\Assert; | ||
|
||
final class MyDraftsContext implements Context | ||
{ | ||
private MyDraftsPage $myDraftsPage; | ||
|
||
public function __construct(MyDraftsPage $myDraftsPage) | ||
{ | ||
$this->myDraftsPage = $myDraftsPage; | ||
} | ||
|
||
/** | ||
* @Given I delete the draft :draftName from my draft lists | ||
*/ | ||
public function iDeleteADraftFromTheList(string $draftName): void | ||
{ | ||
$this->myDraftsPage->deleteDraft($draftName); | ||
} | ||
|
||
/** | ||
* @Given I see the draft :draftName is deleted | ||
*/ | ||
public function iSeeTheDraftIsDeleted(string $draftName): void | ||
{ | ||
Assert::assertFalse($this->myDraftsPage->isDraftOnTheList($draftName)); | ||
} | ||
|
||
/** | ||
* @Given I edit :draftName on MyDrafts page | ||
*/ | ||
public function iEditDraft(string $draftName): void | ||
{ | ||
$this->myDraftsPage->edit($draftName); | ||
} | ||
} |
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,72 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace Ibexa\AdminUi\Behat\Page; | ||
|
||
use Behat\Mink\Session; | ||
use Ibexa\AdminUi\Behat\Component\Dialog; | ||
use Ibexa\AdminUi\Behat\Component\Table\TableBuilder; | ||
use Ibexa\AdminUi\Behat\Component\Table\TableInterface; | ||
use Ibexa\Behat\Browser\Locator\VisibleCSSLocator; | ||
use Ibexa\Behat\Browser\Page\Page; | ||
use Ibexa\Behat\Browser\Routing\Router; | ||
|
||
final class MyDraftsPage extends Page | ||
{ | ||
private TableInterface $table; | ||
|
||
private Dialog $dialog; | ||
|
||
public function __construct(Session $session, Router $router, TableBuilder $tableBuilder, Dialog $dialog) | ||
{ | ||
parent::__construct($session, $router); | ||
$this->table = $tableBuilder->newTable()->build(); | ||
$this->dialog = $dialog; | ||
} | ||
|
||
public function verifyIsLoaded(): void | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please fill in this method - we can make sure that the correct page title (header) is displayed. |
||
$this->getHTMLPage() | ||
->find($this->getLocator('pageTitle')) | ||
->assert()->textEquals('Drafts'); | ||
} | ||
|
||
public function deleteDraft(string $draftName): void | ||
{ | ||
$this->table->getTableRow(['Name' => $draftName])->select(); | ||
$this->getHTMLPage()->find($this->getLocator('deleteButton'))->click(); | ||
$this->dialog->verifyIsLoaded(); | ||
$this->dialog->confirm(); | ||
} | ||
|
||
public function isDraftOnTheList(string $draftName): bool | ||
{ | ||
return $this->table->hasElement(['Name' => $draftName]); | ||
} | ||
|
||
public function edit(string $draftName): void | ||
{ | ||
$this->table->getTableRow(['Name' => $draftName])->edit(); | ||
} | ||
|
||
protected function specifyLocators(): array | ||
{ | ||
return [ | ||
new VisibleCSSLocator('deleteButton', '#confirm-content_remove_remove'), | ||
new VisibleCSSLocator('pageTitle', '.ibexa-page-title h1'), | ||
]; | ||
} | ||
|
||
public function getName(): string | ||
{ | ||
return 'MyDrafts'; | ||
} | ||
|
||
protected function getRoute(): string | ||
{ | ||
return 'contentdraft/list'; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch finding that the
UserSettingPage
service definition is doubled 💪