Skip to content

Commit

Permalink
Expand test scenarios for emojis and Unicode in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed Feb 8, 2019
1 parent 8e8fc9e commit 9e1133c
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 16 deletions.
9 changes: 7 additions & 2 deletions tests/acceptance/features/apiComments/deleteComments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,17 @@ Feature: Comments
And as user "user0"

@smokeTest
Scenario: Deleting my own comments on a file belonging to myself
Scenario Outline: Deleting my own comments on a file belonging to myself
Given the user has uploaded file "filesForUpload/textfile.txt" to "/myFileToComment.txt"
And the user has commented with content "My first comment" on file "/myFileToComment.txt"
And the user has commented with content "<comment>" on file "/myFileToComment.txt"
When the user deletes the last created comment using the WebDAV API
Then the HTTP status code should be "204"
And user "user0" should have 0 comments on file "/myFileToComment.txt"
Examples:
| comment |
| My first comment |
| 😀 🤖 |
| नेपालि |

Scenario: Deleting a comment on a file belonging to myself having several comments
Given the user has uploaded file "filesForUpload/textfile.txt" to "/myFileToComment.txt"
Expand Down
11 changes: 8 additions & 3 deletions tests/acceptance/features/apiComments/editComments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ Feature: Comments
And as user "user0"

@smokeTest
Scenario: Edit my own comments on a file belonging to myself
Scenario Outline: Edit my own comments on a file belonging to myself
Given the user has uploaded file "filesForUpload/textfile.txt" to "/myFileToComment.txt"
And the user has commented with content "File owner comment" on file "/myFileToComment.txt"
When the user edits the last created comment with content "My edited comment" using the WebDAV API
When the user edits the last created comment with content "<comment>" using the WebDAV API
Then the HTTP status code should be "207"
And the user should have the following comments on file "/myFileToComment.txt"
| user0 | My edited comment |
| user0 | <comment> |
Examples:
| comment |
| My edited comment |
| 😀 🤖 |
| नेपालि |

Scenario: Edit my own comments on a file shared by someone with me
Given the user has uploaded file "filesForUpload/textfile.txt" to "/myFileToComment.txt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ Feature: create folder
| old | /नेपाली |
| old | /folder #2 |
| old | /folder ?2 |
| old | /😀 🤖 |
| new | /upload |
| new | /strängé folder |
| new | /C++ folder.cpp |
| new | /नेपाली |
| new | /folder #2 |
| new | /folder ?2 |
| new | /folder ?2 |
| new | /😀 🤖 |

@smokeTest
Scenario Outline: Creating a folder
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/WebUIFilesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,7 @@ public function theUserSwitchesToTabInDetailsPanelUsingTheWebui($tabName) {
*/
public function theUserCommentsWithContentUsingTheWebui($content) {
$detailsDialog = $this->filesPage->getDetailsDialog();
$detailsDialog->addComment($content);
$detailsDialog->addComment($this->getSession(), $content);
$this->filesPage->waitForAjaxCallsToStartAndFinish($this->getSession());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,12 @@ public function isCommentOnUI($text) {
/**
* add a comment in a file whose details dialog is shown in the webUI
*
* @param Session $session
* @param string $content
*
* @return void
*/
public function addComment($content) {
public function addComment(Session $session, $content) {
$commentInput = $this->detailsDialogElement->find(
"xpath", $this->commentInputXpath
);
Expand All @@ -270,7 +271,10 @@ public function addComment($content) {
" xpath: $this->commentInputXpath" .
"could not find comment input field"
);
$commentInput->setValue($content);
$this->fillFieldWithCharacters(
$session, $this->commentInputXpath, $content
);

$postButton = $this->detailsDialogElement->find(
"xpath", $this->commentPostXpath
);
Expand Down
23 changes: 23 additions & 0 deletions tests/acceptance/features/lib/OwncloudPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,29 @@ public function fillFieldAndKeepFocus(NodeElement $element, $value, $session) {
$element->postValue(['value' => [$value]]);
}

/**
* Fill the field at the specified xpath with the given string
*
* If you want to put non-BMP characters, like emoji, into a text field in
* the browser using "ordinary" methods like setValue or fillField,
* then chromedriver complains:
* "ChromeDriver only supports characters in the BMP"
* This method provides a way to set the text field value via JavaScript.
*
* @param Session $session
* @param string $xpath
* @param string $string
*
* @return void
*/
public function fillFieldWithCharacters(
Session $session, $xpath, $string
) {
$session->executeScript(
"document.evaluate(`" . $xpath . "`, document).iterateNext().value = \"" . $string . "\";"
);
}

/**
* Edge often returns whitespace before or after element text.
* This is a convenient wrapper to ensure that text is trimmed
Expand Down
26 changes: 18 additions & 8 deletions tests/acceptance/features/webUIComments/comments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,28 @@ Feature: Add, delete and edit comments in files and folders
And user "user1" has logged in using the webUI
And the user has browsed to the files page

Scenario: user adds and deletes comment for a file/folder
Scenario Outline: user adds and deletes comment for a file/folder
When the user browses directly to display the "comments" details of file "lorem.txt" in folder "/"
And the user comments with content "lorem ipsum" using the webUI
Then the comment "lorem ipsum" should be listed in the comments tab in details dialog
When the user deletes the comment "lorem ipsum" using the webUI
Then the comment "lorem ipsum" should not be listed in the comments tab in details dialog
And the user comments with content "<comment>" using the webUI
Then the comment "<comment>" should be listed in the comments tab in details dialog
When the user deletes the comment "<comment>" using the webUI
Then the comment "<comment>" should not be listed in the comments tab in details dialog
Examples:
| comment |
| lorem ipsum |
| 😀 🤖 |
| नेपालि |

Scenario: Add comment on a shared file and check it is shown in other user's UI
Scenario Outline: Add comment on a shared file and check it is shown in other user's UI
When the user renames file "lorem.txt" to "new-lorem.txt" using the webUI
And the user browses directly to display the "comments" details of file "new-lorem.txt" in folder "/"
And the user comments with content "lorem ipsum" using the webUI
And the user comments with content "<comment>" using the webUI
And the user shares file "new-lorem.txt" with user "User Two" using the webUI
And the user re-logs in as "user2" using the webUI
And the user browses directly to display the "comments" details of file "new-lorem.txt" in folder "/"
Then the comment "lorem ipsum" should be listed in the comments tab in details dialog
Then the comment "<comment>" should be listed in the comments tab in details dialog
Examples:
| comment |
| lorem ipsum |
| 😀 🤖 |
| नेपालि |
10 changes: 10 additions & 0 deletions tests/acceptance/features/webUICreateDelete/createFolders.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ Feature: create folders
And user "user1" has logged in using the webUI
And the user has browsed to the files page

Scenario Outline: Create a folder
When the user creates a folder with the name "<folder-name>" using the webUI
Then folder "<folder-name>" should be listed on the webUI
When the user reloads the current page of the webUI
Then folder "<folder-name>" should be listed on the webUI
Examples:
| folder-name |
| folder-!@#$%^&* ! |
| नेपालि |

@smokeTest
Scenario: Create a folder inside another folder
When the user creates a folder with the name "top-folder" using the webUI
Expand Down

0 comments on commit 9e1133c

Please sign in to comment.