Skip to content

Commit

Permalink
Adjust theUserOpensTheFileOrFolderUsingTheWebUI to take filename as a…
Browse files Browse the repository at this point in the history
…rray
  • Loading branch information
phil-davis committed Jan 25, 2019
1 parent af147fe commit d2a288b
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions tests/acceptance/features/bootstrap/WebUIFilesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1224,18 +1224,28 @@ public function theUserOpensTheFileOrFolderUsingTheWebUI(
$pageObject = $this->getCurrentPageObject();

if (\is_array($relativePath)) {
$relativePath = \implode($relativePath);
// Store the single full concatenated file or folder name.
$breadCrumbs[] = \implode($relativePath);
// The passed-in path is itself an array of pieces of a single file
// or folder name. That is done when the file or folder name contains
// both single and double quotes. The pieces of the file or folder
// name need to be passed through to openFile still in array form.
$breadCrumbsForOpenFile[] = $relativePath;
} else {
// The passed-in path is a single string representing the path to
// the item to be opened. Each folder along the way is delimited
// by "/". Explode it into an array of items to be opened.
$breadCrumbs = \explode('/', \ltrim($relativePath, '/'));
$breadCrumbsForOpenFile = $breadCrumbs;
}

$breadCrumbs = \explode('/', \ltrim($relativePath, '/'));

foreach ($breadCrumbs as $breadCrumb) {
foreach ($breadCrumbsForOpenFile as $breadCrumb) {
$pageObject->openFile($breadCrumb, $this->getSession());
$pageObject->waitTillPageIsLoaded($this->getSession());
}

if ($fileOrFolder !== "folder") {
// Pop the file name off the end of the breadcrumbs
// Pop the file name off the end of the array of breadcrumbs
\array_pop($breadCrumbs);
}

Expand Down

0 comments on commit d2a288b

Please sign in to comment.