Skip to content

Commit

Permalink
UI tests for upload feature
Browse files Browse the repository at this point in the history
  • Loading branch information
individual-it committed Nov 15, 2017
1 parent 75e6bd7 commit 754035c
Show file tree
Hide file tree
Showing 37 changed files with 755 additions and 32 deletions.
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ matrix:
apt: *common_apt
hosts: *common_hosts
sauce_connect: true
- php: 5.6
env: DB=pgsql TC=selenium BROWSER="chrome" BROWSER_VERSION="latest" BEHAT_SUITE="upload" PLATFORM="Windows 10" TEST_DAV=0
addons:
apt: *common_apt
hosts: *common_hosts
sauce_connect: true
- php: 5.6
if: type = cron
env: DB=pgsql TC=selenium BROWSER="firefox" BROWSER_VERSION="47.0" BEHAT_SUITE="other" PLATFORM="Windows 10" TEST_DAV=0
Expand Down Expand Up @@ -159,6 +165,13 @@ matrix:
apt: *common_apt
hosts: *common_hosts
sauce_connect: true
- php: 5.6
if: type = cron
env: DB=pgsql TC=selenium BROWSER="firefox" BROWSER_VERSION="47.0" BEHAT_SUITE="upload" PLATFORM="Windows 10" TEST_DAV=0
addons:
apt: *common_apt
hosts: *common_hosts
sauce_connect: true
- php: 5.6
env: DB=pgsql TC=litmus-v1
- php: 5.6
Expand Down Expand Up @@ -229,6 +242,13 @@ matrix:
apt: *common_apt
hosts: *common_hosts
sauce_connect: true
- php: 5.6
if: type = cron
env: DB=pgsql TC=selenium BROWSER="chrome" BROWSER_VERSION="latest-1" BEHAT_SUITE="upload" PLATFORM="Windows 10" TEST_DAV=0
addons:
apt: *common_apt
hosts: *common_hosts
sauce_connect: true
- php: 5.6
if: type = cron
env: DB=pgsql TC=selenium BROWSER="MicrosoftEdge" BROWSER_VERSION="latest" BEHAT_SUITE="other" PLATFORM="Windows 10" TEST_DAV=0
Expand Down Expand Up @@ -285,6 +305,13 @@ matrix:
apt: *common_apt
hosts: *common_hosts
sauce_connect: true
- php: 5.6
if: type = cron
env: DB=pgsql TC=selenium BROWSER="MicrosoftEdge" BROWSER_VERSION="latest" BEHAT_SUITE="upload" PLATFORM="Windows 10" TEST_DAV=0
addons:
apt: *common_apt
hosts: *common_hosts
sauce_connect: true
- php: 5.6
if: type = cron
env: DB=pgsql TC=selenium BROWSER="internet explorer" BROWSER_VERSION="11.0" BEHAT_SUITE="other" PLATFORM="Windows 7" TEST_DAV=0
Expand Down Expand Up @@ -341,4 +368,11 @@ matrix:
apt: *common_apt
hosts: *common_hosts
sauce_connect: true
- php: 5.6
if: type = cron
env: DB=pgsql TC=selenium BROWSER="internet explorer" BROWSER_VERSION="11.0" BEHAT_SUITE="upload" PLATFORM="Windows 7" TEST_DAV=0
addons:
apt: *common_apt
hosts: *common_hosts
sauce_connect: true
fast_finish: true
5 changes: 4 additions & 1 deletion tests/TestHelpers/WebDavHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public static function makeDavRequest(
) {
$baseUrl = self::sanitizeUrl($baseUrl, true);
$davPath = self::getDavPath($user, $davPathVersionToUse, $type);
//replace # and ? in the path, Guzzle will not encode them
$path = str_replace("#", "%23", $path);
$path = str_replace("?", "%3F", $path);
$fullUrl = self::sanitizeUrl($baseUrl . $davPath . $path);
$client = new GClient();

Expand All @@ -116,7 +119,7 @@ public static function makeDavRequest(
$options['config']
= [ 'curl' => [ CURLOPT_INTERFACE => $sourceIpAddress ]];
}

$request = $client->createRequest($method, $fullUrl, $options);
if (!is_null($headers)) {
foreach ($headers as $key => $value) {
Expand Down
4 changes: 3 additions & 1 deletion tests/travis/start_ui_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ EXTRA_CAPABILITIES=$EXTRA_CAPABILITIES'"maxDuration":"3600"'

#Set up personalized skeleton
PREVIOUS_SKELETON_DIR=$($OCC --no-warnings config:system:get skeletondirectory)
$OCC config:system:set skeletondirectory --value="$(pwd)/tests/ui/skeleton" >/dev/null
export SKELETON_DIR=$(pwd)/tests/ui/skeleton
$OCC config:system:set skeletondirectory --value="$SKELETON_DIR" >/dev/null

TEST_LOG_FILE=$(mktemp)

Expand All @@ -204,6 +205,7 @@ export BEHAT_PARAMS='{"extensions" : {"Behat\\MinkExtension" : {"browser_name":
export IPV4_URL
export IPV6_URL
export REMOTE_FED_BASE_URL
export FILES_FOR_UPLOAD="$(pwd)/tests/ui/filesForUpload/"

lib/composer/bin/behat -c $BEHAT_YML $BEHAT_SUITE_OPTION $BEHAT_TAG_OPTION $BEHAT_TAGS $BEHAT_FEATURE -v 2>&1 | tee -a $TEST_LOG_FILE

Expand Down
10 changes: 10 additions & 0 deletions tests/ui/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ default:
- FilesContext:
- SharingContext:

upload:
paths:
- %paths.base%/../features/upload
context: *common_suite_context
contexts:
- FeatureContext:
- LoginContext:
- UsersContext:
- FilesContext:

restrictSharing:
paths:
- %paths.base%/../features/restrictSharing
Expand Down
18 changes: 17 additions & 1 deletion tests/ui/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class FeatureContext extends RawMinkContext implements Context {
private $owncloudPage;
private $loginPage;
private $oldCSRFSetting = null;

private $currentUser = null;

/**
*
* @var Page\OwncloudPage
Expand Down Expand Up @@ -101,6 +102,21 @@ class FeatureContext extends RawMinkContext implements Context {
]
];

/**
* @return string
*/
public function getCurrentUser() {
return $this->currentUser;
}

/**
* @param string $currentUser
* @return void
*/
public function setCurrentUser($currentUser) {
$this->currentUser = $currentUser;
}

/**
* FeatureContext constructor.
*
Expand Down
Loading

0 comments on commit 754035c

Please sign in to comment.