Skip to content

Commit 5d69d0a

Browse files
committed
update test code
1 parent 7378d0d commit 5d69d0a

File tree

11 files changed

+82
-5
lines changed

11 files changed

+82
-5
lines changed

test/gui/config.sample.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ TEMP_FOLDER_PATH=
1010
CLIENT_CONFIG_DIR=
1111
GUI_TEST_REPORT_DIR=
1212
OCIS=false
13-
RECORD_VIDEO_ON_FAILURE=false
13+
RECORD_VIDEO_ON_FAILURE=false
14+
PREDEFINED_USERS=
15+
AUT_NAME=

test/gui/shared/scripts/helpers/ConfigHelper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def get_default_home_dir():
7575
'clientConfigDir': 'CLIENT_CONFIG_DIR',
7676
'guiTestReportDir': 'GUI_TEST_REPORT_DIR',
7777
'predefined_users': 'PREDEFINED_USERS',
78+
'aut_name': 'AUT_NAME',
7879
'ocis': 'OCIS',
7980
'record_video_on_failure': 'RECORD_VIDEO_ON_FAILURE',
8081
}
@@ -99,6 +100,7 @@ def get_default_home_dir():
99100
'clientConfigDir': get_config_home(),
100101
'guiTestReportDir': os.path.abspath('../reports'),
101102
'predefined_users': False,
103+
'aut_name': 'owncloud',
102104
'ocis': False,
103105
'record_video_on_failure': False,
104106
'files_for_upload': os.path.join(CURRENT_DIR.parent.parent, 'files-for-upload'),

test/gui/shared/scripts/helpers/SetupClientHelper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def start_client():
9999
check_keyring()
100100

101101
squish.startApplication(
102-
'owncloud -s'
102+
f'{get_config("aut_name")} -s'
103103
+ f' --logfile {get_config("clientLogFile")}'
104104
+ ' --logdebug'
105105
+ ' --logflush'

test/gui/shared/steps/account_context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,13 +313,15 @@ def step(context, displayname):
313313
)
314314
def step(context, sync_path, wizard):
315315
sync_path = substitute_inline_codes(sync_path)
316+
print('sync_path', sync_path)
316317

317318
actual_sync_path = ''
318319
if wizard == 'configuration':
319320
actual_sync_path = AccountConnectionWizard.get_local_sync_path()
320321
else:
321322
actual_sync_path = SyncConnectionWizard.get_local_sync_path()
322323

324+
print('actual_sync_path', actual_sync_path)
323325
test.compare(
324326
actual_sync_path,
325327
sync_path,

test/gui/shared/steps/file_context.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
prefix_path_namespace,
2121
remember_path,
2222
)
23+
from helpers.UserHelper import get_username_for_user
2324

2425

2526
def folder_exists(folder_path, timeout=1000):
@@ -103,6 +104,20 @@ def add_copy_suffix(resource_path, resource_type):
103104
'user "|any|" creates a file "|any|" with the following content inside the sync folder'
104105
)
105106
def step(context, username, filename):
107+
if get_config('predefined_users'):
108+
username = get_username_for_user(username)
109+
file_content = '\n'.join(context.multiLineText)
110+
file = get_resource_path(filename, username)
111+
wait_and_write_file(file, file_content)
112+
113+
114+
@Given(
115+
'user "|any|" has created a file "|any|" with the following content inside the sync folder of branded client'
116+
)
117+
def step(context, username, filename):
118+
if not get_config('predefined_users'):
119+
return
120+
username = get_username_for_user(username)
106121
file_content = '\n'.join(context.multiLineText)
107122
file = get_resource_path(filename, username)
108123
wait_and_write_file(file, file_content)
@@ -116,6 +131,18 @@ def step(context, username, foldername):
116131

117132
@Given('user "|any|" has created a folder "|any|" inside the sync folder')
118133
def step(context, username, foldername):
134+
if get_config('predefined_users'):
135+
username = get_username_for_user(username)
136+
create_folder(foldername, username)
137+
138+
139+
@Given(
140+
'user "|any|" has created a folder "|any|" inside the sync folder of branded client'
141+
)
142+
def step(context, username, foldername):
143+
if not get_config('predefined_users'):
144+
return
145+
username = get_username_for_user(username)
119146
create_folder(foldername, username)
120147

121148

@@ -251,6 +278,8 @@ def step(context, item_type, resource):
251278

252279
@When('user "|any|" creates the following files inside the sync folder:')
253280
def step(context, username):
281+
if get_config('predefined_users'):
282+
username = get_username_for_user(username)
254283
wait_for_client_to_be_ready()
255284

256285
for row in context.table[1:]:

test/gui/shared/steps/server_context.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from helpers.api import provisioning, sharing_helper, webdav_helper as webdav
22
import helpers.api.oc10 as oc
3+
from helpers.ConfigHelper import get_config
34

45
from pageObjects.Toolbar import Toolbar
56

@@ -14,6 +15,8 @@ def step(context, app_name, action):
1415
regexp=True,
1516
)
1617
def step(context, user_name, resource_name):
18+
if get_config('predefined_users'):
19+
return
1720
test.compare(
1821
webdav.resource_exists(user_name, resource_name),
1922
False,
@@ -25,6 +28,8 @@ def step(context, user_name, resource_name):
2528
r'^as "([^"].*)" (?:file|folder) "([^"].*)" should exist in the server', regexp=True
2629
)
2730
def step(context, user_name, resource_name):
31+
if get_config('predefined_users'):
32+
return
2833
test.compare(
2934
webdav.resource_exists(user_name, resource_name),
3035
True,
@@ -34,6 +39,8 @@ def step(context, user_name, resource_name):
3439

3540
@Then('as "|any|" the file "|any|" should have the content "|any|" in the server')
3641
def step(context, user_name, file_name, content):
42+
if get_config('predefined_users'):
43+
return
3744
text_content = webdav.get_file_content(user_name, file_name)
3845
test.compare(
3946
text_content,
@@ -115,11 +122,15 @@ def step(context, user_name, folder_name, items_number):
115122

116123
@Given('user "|any|" has created folder "|any|" in the server')
117124
def step(context, user, folder_name):
125+
if get_config('predefined_users'):
126+
return
118127
webdav.create_folder(user, folder_name)
119128

120129

121130
@Given('user "|any|" has uploaded file with content "|any|" to "|any|" in the server')
122131
def step(context, user, file_content, file_name):
132+
if get_config('predefined_users'):
133+
return
123134
webdav.create_file(user, file_name, file_content)
124135

125136

test/gui/shared/steps/sync_context.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
import squish
23

34
from pageObjects.SyncConnectionWizard import SyncConnectionWizard
@@ -17,6 +18,7 @@
1718
substitute_inline_codes,
1819
get_resource_path,
1920
)
21+
from helpers.UserHelper import get_displayname_for_user
2022

2123

2224
@When('using sync connection folder "|any|"')
@@ -205,6 +207,8 @@ def step(context, folder_name):
205207

206208
@When('the user syncs the "|any|" space')
207209
def step(context, space_name):
210+
if get_config('predefined_users'):
211+
space_name = 'My Folder'
208212
SyncConnectionWizard.sync_space(space_name)
209213

210214

@@ -354,6 +358,9 @@ def step(context):
354358
resource = row[0]
355359
status = row[1]
356360
account = substitute_inline_codes(row[2])
361+
if get_config('predefined_users'):
362+
displayname = get_displayname_for_user(row[2].split()[0].strip())
363+
account = re.sub(r'^[^@]+', displayname, account)
357364
test.compare(
358365
Activity.check_not_synced_table(resource, status, account),
359366
True,

test/gui/suite.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ HOOK_SUB_PROCESSES=false
44
IMPLICITAUTSTART=false
55
LANGUAGE=Python
66
OBJECTMAPSTYLE=script
7+
TEST_CASES=
78
VERSION=3
89
WRAPPERS=Qt

test/gui/tst_addAccount/test.feature

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ Feature: adding accounts
6767
When the user selects download everything option in advanced section
6868
Then the "Enable virtual file support" button should be available
6969

70-
@skipOnOC10
70+
@skipOnOC10 @predefined_users
7171
Scenario: Add space manually from sync connection window
7272
Given user "Alice" has created folder "simple-folder" in the server
7373
And the user has started the client
74+
And user "Alice" has created a folder "simple-folder" inside the sync folder of branded client
7475
And the user has entered the following account information:
7576
| server | %local_server% |
7677
| user | Alice |

test/gui/tst_deletFilesFolders/test.feature

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@predefined_users
12
Feature: deleting files and folders
23
As a user
34
I want to delete files and folders
@@ -10,6 +11,10 @@ Feature: deleting files and folders
1011
Scenario Outline: Delete a file
1112
Given user "Alice" has uploaded file with content "ownCloud test text file 0" to "<fileName>" in the server
1213
And user "Alice" has set up a client with default settings
14+
And user "Alice" has created a file "<fileName>" with the following content inside the sync folder of branded client
15+
"""
16+
ownCloud test text file 0
17+
"""
1318
When the user deletes the file "<fileName>"
1419
And the user waits for the files to sync
1520
Then as "Alice" file "<fileName>" should not exist in the server
@@ -23,6 +28,7 @@ Feature: deleting files and folders
2328
Scenario Outline: Delete a folder
2429
Given user "Alice" has created folder "<folderName>" in the server
2530
And user "Alice" has set up a client with default settings
31+
And user "Alice" has created a folder "<folderName>" inside the sync folder of branded client
2632
When the user deletes the folder "<folderName>"
2733
And the user waits for the files to sync
2834
Then as "Alice" file "<folderName>" should not exist in the server
@@ -38,6 +44,16 @@ Feature: deleting files and folders
3844
And user "Alice" has created folder "test-folder1" in the server
3945
And user "Alice" has created folder "test-folder2" in the server
4046
And user "Alice" has set up a client with default settings
47+
And user "Alice" has created a file "textfile1.txt" with the following content inside the sync folder of branded client
48+
"""
49+
test file 1
50+
"""
51+
And user "Alice" has created a file "textfile2.txt" with the following content inside the sync folder of branded client
52+
"""
53+
test file 2
54+
"""
55+
And user "Alice" has created a folder "test-folder1" inside the sync folder of branded client
56+
And user "Alice" has created a folder "test-folder2" inside the sync folder of branded client
4157
When the user deletes the file "textfile1.txt"
4258
And the user deletes the folder "test-folder1"
4359
And the user waits for the files to sync

test/gui/tst_syncing/test.feature

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Feature: Syncing files
66
Background:
77
Given user "Alice" has been created in the server with default attributes
88

9-
@smokeTest @issue-9281
9+
@smokeTest @issue-9281 @predefined_users
1010
Scenario: Syncing a file to the server
1111
Given user "Alice" has set up a client with default settings
1212
When user "Alice" creates a file "lorem-for-upload.txt" with the following content inside the sync folder
@@ -19,12 +19,18 @@ Feature: Syncing files
1919
Then the file "lorem-for-upload.txt" should have status "Uploaded" in the activity tab
2020
And as "Alice" the file "lorem-for-upload.txt" should have the content "test content" in the server
2121

22-
22+
@predefined_users
2323
Scenario: Syncing all files and folders from the server
2424
Given user "Alice" has created folder "simple-folder" in the server
2525
And user "Alice" has created folder "large-folder" in the server
2626
And user "Alice" has uploaded file with content "test content" to "uploaded-lorem.txt" in the server
2727
And user "Alice" has set up a client with default settings
28+
And user "Alice" has created a folder "simple-folder" inside the sync folder of branded client
29+
And user "Alice" has created a folder "large-folder" inside the sync folder of branded client
30+
And user "Alice" has created a file "uploaded-lorem.txt" with the following content inside the sync folder of branded client
31+
"""
32+
test content
33+
"""
2834
Then the file "uploaded-lorem.txt" should exist on the file system
2935
And the file "uploaded-lorem.txt" should exist on the file system with the following content
3036
"""

0 commit comments

Comments
 (0)