Skip to content

Commit

Permalink
add step to verify the presence of dehydrated file after vfs is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Salipa-Gurung committed Jan 1, 2024
1 parent fc921b2 commit 6801236
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
8 changes: 8 additions & 0 deletions test/gui/shared/scripts/helpers/FilesHelper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import re
import ctypes


def buildConflictedRegex(filename):
Expand Down Expand Up @@ -78,3 +79,10 @@ def get_size_in_bytes(size):
return size_num * (multiplier**3)

raise Exception("Invalid size: " + size)


def get_file_size_on_disk(resource_path):
file_size_high = ctypes.c_ulonglong(0)
return ctypes.windll.kernel32.GetCompressedFileSizeW(
ctypes.c_wchar_p(resource_path), ctypes.pointer(file_size_high)
)
24 changes: 24 additions & 0 deletions test/gui/shared/steps/file_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
read_file_content,
is_empty_sync_folder,
get_size_in_bytes,
get_file_size_on_disk,
)
from helpers.SetupClientHelper import (
getTempResourcePath,
Expand Down Expand Up @@ -347,3 +348,26 @@ def step(context, username, zip_file_name):
destination_dir = getResourcePath('/', username)
zip_file_path = join(destination_dir, zip_file_name)
extractZip(zip_file_path, destination_dir)


@Then('the placeholder of file "|any|" should exist on the file system')
def step(context, file_name):
resource_path = getResourcePath(file_name)
size_on_disk = get_file_size_on_disk(resource_path)
if isWindows():
test.compare(
size_on_disk, 0, f"Size of the placeholder on the disk is: '{size_on_disk}'"
)


@Then('the file "|any|" should be downloaded')
def step(context, file_name):
resource_path = getResourcePath(file_name)
size_on_disk = get_file_size_on_disk(resource_path)
file_size = os.stat(resource_path).st_size
if isWindows():
test.compare(
size_on_disk,
file_size,
f"Size of original file: '{file_size}' is not equal to it's size on disk '{size_on_disk}'",
)
17 changes: 16 additions & 1 deletion test/gui/tst_vfs/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,23 @@ Feature: Enable/disable virtual file support

Scenario: Disable/Enable VFS
Given user "Alice" has been created on the server with default attributes and without skeleton files
And user "Alice" has uploaded file with content "ownCloud" to "testFile.txt" in the server
And user "Alice" has created folder "folder1" in the server
And user "Alice" has uploaded file with content "some contents" to "folder1/lorem.txt" in the server
And user "Alice" has set up a client with default settings
Then the placeholder of file "testFile.txt" should exist on the file system
And the placeholder of file "folder1/lorem.txt" should exist on the file system
When the user disables virtual file support
Then the "Enable virtual file support..." button should be available
And the file "testFile.txt" should exist on the file system with the following content
"""
ownCloud
"""
And the file "folder1/lorem.txt" should exist on the file system with the following content
"""
some contents
"""
And the file "testFile.txt" should be downloaded
And the file "folder1/lorem.txt" should be downloaded
When the user enables virtual file support
Then the "Disable virtual file support..." button should be available
Then the "Disable virtual file support..." button should be available

0 comments on commit 6801236

Please sign in to comment.