Added new tests for desktop
Signed-off-by: Anton Danchenko <ant.danchenko@gmail.com>
|
@ -6,6 +6,17 @@ RUN update-alternatives --config java
|
|||
RUN apt-get install -y libopencv3.2-java
|
||||
RUN ln -s /usr/lib/jni/libopencv_java320.so /usr/lib/libopencv_java.so
|
||||
RUN apt-get install -y icewm wmctrl x11vnc
|
||||
RUN apt-get install -y autoconf automake libtool
|
||||
RUN apt-get install -y autoconf-archive
|
||||
RUN apt-get install -y pkg-config
|
||||
RUN apt-get install -y libpng-dev
|
||||
RUN apt-get install -y libjpeg8-dev
|
||||
RUN apt-get install -y libtiff5-dev
|
||||
RUN apt-get install -y zlib1g-dev
|
||||
RUN apt-get install -y libicu-dev
|
||||
RUN apt-get install -y libpango1.0-dev
|
||||
RUN apt-get install -y libcairo2-dev
|
||||
RUN apt-get install -y firefox
|
||||
RUN apt-get clean
|
||||
|
||||
RUN mkdir tools
|
||||
|
@ -14,6 +25,21 @@ RUN curl -L "http://search.maven.org/remotecontent?filepath=org/python/jython-in
|
|||
RUN java -jar /tools/jython_installer-2.7.1.jar -s -d jython-2.7.1 -i ensurepip
|
||||
RUN curl -L "https://raiman.github.io/SikuliX1/sikulixapi.jar" -o /tools/sikulixapi.jar
|
||||
|
||||
RUN curl -L 'http://www.leptonica.com/source/leptonica-1.74.4.tar.gz' -o /home/leptonica-1.74.4.tar.gz
|
||||
RUN tar -xzf /home/leptonica-1.74.4.tar.gz
|
||||
RUN ./leptonica-1.74.4/configure
|
||||
RUN make
|
||||
RUN make install
|
||||
RUN curl -L 'https://codeload.github.com/tesseract-ocr/tesseract/tar.gz/3.05.02' -o /home/tess
|
||||
RUN tar -xzf /home/tess
|
||||
WORKDIR "tesseract-3.05.02"
|
||||
RUN ./autogen.sh
|
||||
RUN ./configure --enable-debug
|
||||
RUN LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make
|
||||
RUN make install
|
||||
RUN make install-langs
|
||||
RUN ldconfig
|
||||
|
||||
ADD . /home
|
||||
WORKDIR "/home"
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
base_user = dict()
|
||||
base_user['passphrase'] = 'tree weekend ceiling awkward universe pyramid glimpse raven pair lounge grant grief'
|
||||
base_user['username'] = 'Little Weighty Iberianmole'
|
||||
base_user['public_key'] = '0x040d3400f0ba80b2f6017a9021a66e042abc33cf7051ddf98a24a815c93d6c052ce2b787' \
|
||||
'3d799f0963259f41c5a1bf08133dd4f3fe63ea1cceaa1e86ebc4bc42c9'
|
|
@ -0,0 +1,56 @@
|
|||
import org.sikuli.script.SikulixForJython
|
||||
from sikuli import *
|
||||
from tests.base_test_case import BaseTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
class TestCreateAccount(BaseTestCase):
|
||||
|
||||
def test_create_account(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.create_account_button.click()
|
||||
sign_in.create_password_input.input_value('123456')
|
||||
sign_in.next_button.click()
|
||||
sign_in.confirm_password_input.input_value('123456')
|
||||
sign_in.next_button.click()
|
||||
sign_in.username_input.input_value('test')
|
||||
sign_in.next_button.click()
|
||||
sign_in.home_button.find_element()
|
||||
|
||||
def test_create_account_proceed_with_enter(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.create_account_button.click()
|
||||
sign_in.create_password_input.input_value('123456' + Key.ENTER)
|
||||
sign_in.confirm_password_input.input_value('123456' + Key.ENTER)
|
||||
sign_in.username_input.input_value('test' + Key.ENTER)
|
||||
sign_in.home_button.find_element()
|
||||
|
||||
def test_create_account_go_back(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.create_account_button.click()
|
||||
sign_in.create_password_input.find_element()
|
||||
sign_in.back_button.click()
|
||||
sign_in.create_account_button.click()
|
||||
sign_in.create_password_input.input_value('123456' + Key.ENTER)
|
||||
sign_in.confirm_password_input.find_element()
|
||||
sign_in.back_button.click()
|
||||
sign_in.create_password_input.find_element()
|
||||
sign_in.create_password_input.input_value('123456' + Key.ENTER)
|
||||
sign_in.confirm_password_input.input_value('123456' + Key.ENTER)
|
||||
sign_in.username_input.find_element()
|
||||
sign_in.back_button.verify_element_is_not_present()
|
||||
|
||||
def test_switch_accounts(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.create_account(username='user_1')
|
||||
profile = sign_in.profile_button.click()
|
||||
profile.log_out_button.click()
|
||||
sign_in.other_accounts_button.click()
|
||||
sign_in.create_account(username='user_2')
|
||||
sign_in.profile_button.click()
|
||||
profile.log_out_button.click()
|
||||
sign_in.other_accounts_button.click()
|
||||
sign_in.element_by_text('user_2').click()
|
||||
sign_in.password_input.input_value('qwerty' + Key.ENTER)
|
||||
sign_in.profile_button.click()
|
||||
profile.find_text('user_2')
|
|
@ -0,0 +1,10 @@
|
|||
from tests.base_test_case import BaseTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
class TestPrivacyPolicy(BaseTestCase):
|
||||
|
||||
def test_privacy_policy(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.privacy_policy_button.click()
|
||||
sign_in.find_text('Privacy Policy of Status Mobile')
|
|
@ -0,0 +1,26 @@
|
|||
import pytest
|
||||
|
||||
from tests import base_user
|
||||
from tests.base_test_case import BaseTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
class TestProfile(BaseTestCase):
|
||||
|
||||
def test_copy_contact_code(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.recover_access(base_user['passphrase'])
|
||||
profile = sign_in.profile_button.click()
|
||||
profile.share_my_code_button.click()
|
||||
profile.copy_code_button.click()
|
||||
assert profile.get_clipboard() == base_user['public_key']
|
||||
|
||||
@pytest.mark.skip('Test cases is not ready yet')
|
||||
def test_change_mail_server(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.create_account()
|
||||
profile = sign_in.profile_button.click()
|
||||
profile.element_by_text('Advanced settings').click()
|
||||
s_names = profile.get_mail_servers_list()
|
||||
profile.aa(s_names[0]).is_active()
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import org.sikuli.script.SikulixForJython
|
||||
from sikuli import *
|
||||
|
||||
from tests import base_user
|
||||
from tests.base_test_case import BaseTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
class TestRecoverAccess(BaseTestCase):
|
||||
|
||||
def test_recover_access(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.i_have_account_button.click()
|
||||
sign_in.recovery_phrase_input.send_as_key_event(base_user['passphrase'])
|
||||
sign_in.recover_password_input.send_as_key_event('123456')
|
||||
sign_in.sign_in_button.click()
|
||||
sign_in.home_button.find_element()
|
||||
profile = sign_in.profile_button.click()
|
||||
profile.share_my_code_button.click()
|
||||
profile.find_text(base_user['public_key'])
|
||||
|
||||
def test_recover_access_proceed_with_enter(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.i_have_account_button.click()
|
||||
sign_in.recovery_phrase_input.send_as_key_event(base_user['passphrase'] + Key.TAB)
|
||||
type('123456' + Key.ENTER)
|
||||
sign_in.home_button.find_element()
|
||||
|
||||
def test_recover_access_go_back(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.i_have_account_button.click()
|
||||
sign_in.recovery_phrase_input.find_element()
|
||||
sign_in.back_button.click()
|
||||
sign_in.create_account_button.find_element()
|
|
@ -0,0 +1,14 @@
|
|||
from tests import base_user
|
||||
from tests.base_test_case import BaseTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
class TestChats(BaseTestCase):
|
||||
|
||||
def test_start_new_chat(self):
|
||||
sign_in = SignInView()
|
||||
home = sign_in.create_account()
|
||||
home.plus_button.click()
|
||||
home.contact_code_input.input_value(base_user['public_key'])
|
||||
home.start_chat_button.click()
|
||||
home.find_text(base_user['username'])
|
|
@ -1,18 +0,0 @@
|
|||
import pytest
|
||||
from views.sign_in_view import SignInView
|
||||
from tests.base_test_case import BaseTestCase
|
||||
|
||||
|
||||
class TestCreateAccount(BaseTestCase):
|
||||
|
||||
@pytest.mark.desktop
|
||||
def test_create_account(self):
|
||||
sign_in = SignInView()
|
||||
sign_in.create_account_button.click()
|
||||
sign_in.password_input.input_value('123456')
|
||||
sign_in.next_button.click()
|
||||
sign_in.confirm_password_input.input_value('123456')
|
||||
sign_in.next_button.click()
|
||||
sign_in.username_input.input_value('test')
|
||||
sign_in.next_button.click()
|
||||
sign_in.home_button.find_element()
|
|
@ -1,6 +1,8 @@
|
|||
import logging
|
||||
import org.sikuli.script.SikulixForJython
|
||||
import time
|
||||
import pytest
|
||||
|
||||
import org.sikuli.script.SikulixForJython
|
||||
from sikuli import *
|
||||
|
||||
|
||||
|
@ -19,9 +21,37 @@ class BaseElement(object):
|
|||
self.find_element()
|
||||
click(self.screenshot)
|
||||
|
||||
def verify_element_is_not_present(self):
|
||||
try:
|
||||
wait(self.screenshot, 10)
|
||||
pytest.fail('%s is displayed but not expected' % self.__class__.__name__)
|
||||
except FindFailed:
|
||||
pass
|
||||
|
||||
|
||||
class InputField(BaseElement):
|
||||
|
||||
def input_value(self, value):
|
||||
self.click()
|
||||
type(value)
|
||||
|
||||
def send_as_key_event(self, value):
|
||||
self.click()
|
||||
for i in str(value):
|
||||
type(i)
|
||||
time.sleep(0.5)
|
||||
|
||||
|
||||
class TextElement(object):
|
||||
def __init__(self, text):
|
||||
self.element_line = None
|
||||
for _ in range(3):
|
||||
lines = collectLines()
|
||||
for line in lines:
|
||||
if text in line.getText().encode('ascii', 'ignore'):
|
||||
self.element_line = line
|
||||
return
|
||||
time.sleep(3)
|
||||
|
||||
def click(self):
|
||||
self.element_line.click()
|
||||
|
|
|
@ -1,17 +1,40 @@
|
|||
import org.sikuli.script.SikulixForJython
|
||||
from sikuli import *
|
||||
import os
|
||||
import pytest
|
||||
|
||||
from views.base_element import BaseElement
|
||||
from views.base_element import BaseElement, TextElement
|
||||
|
||||
IMAGES_PATH = os.path.join(os.path.dirname(__file__), 'images/base_view')
|
||||
|
||||
|
||||
class HomeButton(BaseElement):
|
||||
class ProfileButton(BaseElement):
|
||||
def __init__(self):
|
||||
super(HomeButton, self).__init__(IMAGES_PATH + '/home_button.png')
|
||||
super(ProfileButton, self).__init__(IMAGES_PATH + '/profile_button.png')
|
||||
|
||||
def click(self):
|
||||
super(ProfileButton, self).click()
|
||||
from views.profile_view import ProfileView
|
||||
return ProfileView()
|
||||
|
||||
|
||||
class BaseView(object):
|
||||
|
||||
def __init__(self):
|
||||
super(BaseView, self).__init__()
|
||||
self.home_button = HomeButton()
|
||||
self.home_button = BaseElement(IMAGES_PATH + '/home_button.png')
|
||||
self.profile_button = ProfileButton()
|
||||
self.back_button = BaseElement(IMAGES_PATH + '/back_button.png')
|
||||
|
||||
def find_text(self, expected_text):
|
||||
for _ in range(3):
|
||||
current_text = text().encode('ascii', 'ignore').replace('\n', ' ')
|
||||
if expected_text in current_text:
|
||||
return
|
||||
pytest.fail("Could not find text '%s'" % expected_text)
|
||||
|
||||
def get_clipboard(self):
|
||||
return Env.getClipboard()
|
||||
|
||||
def element_by_text(self, text):
|
||||
return TextElement(text)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import os
|
||||
|
||||
from views.base_element import BaseElement, InputField
|
||||
from views.base_view import BaseView
|
||||
|
||||
IMAGES_PATH = os.path.join(os.path.dirname(__file__), 'images/home_view')
|
||||
|
||||
|
||||
class HomeView(BaseView):
|
||||
def __init__(self):
|
||||
super(HomeView, self).__init__()
|
||||
self.plus_button = BaseElement(IMAGES_PATH + '/plus_button.png')
|
||||
self.contact_code_input = InputField(IMAGES_PATH + '/contact_code_input.png')
|
||||
self.start_chat_button = BaseElement(IMAGES_PATH + '/start_chat_button.png')
|
After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 6.1 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 7.2 KiB |
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1,38 @@
|
|||
import org.sikuli.script.SikulixForJython
|
||||
from sikuli import *
|
||||
import os
|
||||
|
||||
from views.base_element import BaseElement, TextElement
|
||||
from views.base_view import BaseView
|
||||
|
||||
IMAGES_PATH = os.path.join(os.path.dirname(__file__), 'images/profile_view')
|
||||
|
||||
|
||||
class MailServerElement(TextElement):
|
||||
def __init__(self, server_name):
|
||||
super(MailServerElement, self).__init__(server_name)
|
||||
|
||||
class ActiveImage(BaseElement):
|
||||
def __init__(self):
|
||||
super(MailServerElement.ActiveImage, self).__init__(IMAGES_PATH + '/mail_server_active_image.png')
|
||||
|
||||
def is_active(self):
|
||||
print(self.element_line)
|
||||
|
||||
|
||||
class ProfileView(BaseView):
|
||||
def __init__(self):
|
||||
super(ProfileView, self).__init__()
|
||||
self.share_my_code_button = BaseElement(IMAGES_PATH + '/share_my_code_button.png')
|
||||
self.copy_code_button = BaseElement(IMAGES_PATH + '/copy_code_button.png')
|
||||
self.log_out_button = BaseElement(IMAGES_PATH + '/log_out_button.png')
|
||||
|
||||
def get_mail_servers_list(self):
|
||||
server_names = []
|
||||
for line in collectLines():
|
||||
line_text = line.getText().encode('ascii', 'ignore')
|
||||
if 'mail-0' in line_text:
|
||||
server_names.append(line_text)
|
||||
|
||||
def get_mail_server(self, name):
|
||||
return MailServerElement(name)
|
|
@ -1,7 +1,13 @@
|
|||
import org.sikuli.script.SikulixForJython
|
||||
import pytest
|
||||
from sikuli import *
|
||||
import os
|
||||
|
||||
from _pytest.runner import Failed
|
||||
|
||||
from views.base_element import BaseElement, InputField
|
||||
from views.base_view import BaseView
|
||||
from views.home_view import HomeView
|
||||
|
||||
IMAGES_PATH = os.path.join(os.path.dirname(__file__), 'images/sign_in_view')
|
||||
|
||||
|
@ -10,32 +16,45 @@ class CreateAccountButton(BaseElement):
|
|||
def __init__(self):
|
||||
super(CreateAccountButton, self).__init__(IMAGES_PATH + '/create_account.png')
|
||||
|
||||
|
||||
class PasswordInput(InputField):
|
||||
def __init__(self):
|
||||
super(PasswordInput, self).__init__(IMAGES_PATH + '/password_input.png')
|
||||
|
||||
|
||||
class ConfirmPasswordInput(InputField):
|
||||
def __init__(self):
|
||||
super(ConfirmPasswordInput, self).__init__(IMAGES_PATH + '/confirm_password_input.png')
|
||||
|
||||
|
||||
class UserNameInput(InputField):
|
||||
def __init__(self):
|
||||
super(UserNameInput, self).__init__(IMAGES_PATH + '/username_input.png')
|
||||
|
||||
|
||||
class NextButton(InputField):
|
||||
def __init__(self):
|
||||
super(NextButton, self).__init__(IMAGES_PATH + '/next_button.png')
|
||||
def find_element(self):
|
||||
try:
|
||||
super(CreateAccountButton, self).find_element()
|
||||
except Failed:
|
||||
self.screenshot = IMAGES_PATH + '/create_new_account.png'
|
||||
super(CreateAccountButton, self).find_element()
|
||||
|
||||
|
||||
class SignInView(BaseView):
|
||||
def __init__(self):
|
||||
super(SignInView, self).__init__()
|
||||
self.create_account_button = CreateAccountButton()
|
||||
self.password_input = PasswordInput()
|
||||
self.confirm_password_input = ConfirmPasswordInput()
|
||||
self.username_input = UserNameInput()
|
||||
self.next_button = NextButton()
|
||||
self.i_have_account_button = BaseElement(IMAGES_PATH + '/i_have_account.png')
|
||||
self.other_accounts_button = BaseElement(IMAGES_PATH + '/other_accounts.png')
|
||||
self.privacy_policy_button = BaseElement(IMAGES_PATH + 'privacy_policy_button.png')
|
||||
self.create_password_input = InputField(IMAGES_PATH + '/create_password_input.png')
|
||||
self.confirm_password_input = InputField(IMAGES_PATH + '/confirm_password_input.png')
|
||||
self.username_input = InputField(IMAGES_PATH + '/username_input.png')
|
||||
self.next_button = BaseElement(IMAGES_PATH + '/next_button.png')
|
||||
self.recovery_phrase_input = InputField(IMAGES_PATH + '/recovery_phrase_input.png')
|
||||
self.recover_password_input = InputField(IMAGES_PATH + '/recover_password_input.png')
|
||||
self.sign_in_button = BaseElement(IMAGES_PATH + '/sign_in_button.png')
|
||||
self.password_input = InputField(IMAGES_PATH + '/password_input.png')
|
||||
|
||||
def create_account(self, password='qwerty', username='test'):
|
||||
self.create_account_button.click()
|
||||
self.create_password_input.input_value(password)
|
||||
self.next_button.click()
|
||||
self.confirm_password_input.input_value(password)
|
||||
self.next_button.click()
|
||||
self.username_input.input_value(username)
|
||||
self.next_button.click()
|
||||
self.home_button.find_element()
|
||||
return HomeView()
|
||||
|
||||
def recover_access(self, passphrase):
|
||||
self.i_have_account_button.click()
|
||||
self.recovery_phrase_input.send_as_key_event(passphrase)
|
||||
self.recover_password_input.send_as_key_event('123456')
|
||||
self.sign_in_button.click()
|
||||
self.home_button.find_element()
|
||||
return HomeView()
|
||||
|
|