Skip to content

Commit

Permalink
Merge pull request #222 from nodlesh/feature/bcw-showcase-test-dev
Browse files Browse the repository at this point in the history
Update Showcase tests expecting Goal Codes plus debugging code
  • Loading branch information
nodlesh authored Dec 6, 2023
2 parents 9cd893b + c838328 commit 33fc070
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: test-screenshots_from_main
path: ./aries-mobile-test-harness/aries-mobile-tests/*.png
path: aries-mobile-test-harness/aries-mobile-tests/*.png
retention-days: 7


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-test-harness/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ runs:
uses: actions/upload-artifact@v3
with:
name: test-screenshots_from_run_action
path: ./aries-mobile-test-harness/aries-mobile-tests/*.png
path: aries-mobile-test-harness/aries-mobile-tests/*.png
retention-days: 7

branding:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def connected(self):
def send_credential(self, actor:str, credential_offer=None, version=1, schema=None, revokable=False):
"""send a credential to the holder, returns a qr code for holder to connect to"""
self._who_do_you_want_to_be_page = self._bc_wallet_showcase_main_page.select_get_started()
self.driver.minimize_window()
#self.driver.minimize_window()
self.driver.maximize_window()
self.driver.save_screenshot('who_do_you_want_to_be_page.png')
if actor == "Student":
Expand All @@ -89,15 +89,15 @@ def send_credential(self, actor:str, credential_offer=None, version=1, schema=No
self._who_do_you_want_to_be_page.select_lawyer()
else:
raise Exception(f"Unknown actor type {actor}")
self.driver.minimize_window()
#self.driver.minimize_window()
self.driver.maximize_window()
self.driver.save_screenshot('who_do_you_want_to_be_page_actor_select.png')
self._lets_get_started_page = self._who_do_you_want_to_be_page.select_next()
self.driver.save_screenshot('lets_get_started_page.png')
self._install_bc_wallet_page = self._lets_get_started_page.select_next()
self.driver.save_screenshot('install_bc_wallet_page.png')
self._connect_with_best_bc_college_page = self._install_bc_wallet_page.select_skip()
self.driver.minimize_window()
#self.driver.minimize_window()
self.driver.maximize_window()
self.driver.save_screenshot('connect_with_best_bc_college_page.png')
qrcode = self._connect_with_best_bc_college_page.get_qr_code()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,43 +89,53 @@ def connected(self):
def send_proof_request(self, actor:str, proof:str, version=1, request_for_proof=None, connectionless=False):
"""create a proof request """
self._who_do_you_want_to_be_page = self._bc_wallet_showcase_main_page.select_get_started()
self.driver.minimize_window()
self.driver.save_screenshot('Verifier_who_do_you_want_to_be_page.png')
#self.driver.minimize_window()
self.driver.maximize_window()
if actor == "Student":
self._who_do_you_want_to_be_page.select_student()
elif actor == "Lawyer":
self._who_do_you_want_to_be_page.select_lawyer()
else:
raise Exception(f"Unknown actor type {actor}")
self.driver.minimize_window()
#self.driver.minimize_window()
self.driver.maximize_window()
self._lets_get_started_page = self._who_do_you_want_to_be_page.select_next()
self.driver.save_screenshot('Verifier_lets_get_started_page.png')
self._install_bc_wallet_page = self._lets_get_started_page.select_next()
self.driver.save_screenshot('Verifier_install_bc_wallet_page.png')
self._connect_with_best_bc_college_page = self._install_bc_wallet_page.select_skip()
self.driver.minimize_window()
self.driver.save_screenshot('Verifier_connect_with_best_bc_college_page.png')
#self.driver.minimize_window()
self.driver.maximize_window()
self._youre_all_set_page = self._connect_with_best_bc_college_page.select_i_already_have_my_credential()
self.driver.save_screenshot('Verifier_youre_all_set_page.png')
self._using_your_credentials_page = self._youre_all_set_page.select_finish()
self.driver.save_screenshot('Verifier_using_your_credentials_page.png')

if proof == "Cool Clothes Online":
self._getting_a_student_discount_page = self._using_your_credentials_page.select_cool_clothes_online_start()
self.driver.minimize_window()
self.driver.save_screenshot('Verifier_getting_a_student_discount_page.png')
#self.driver.minimize_window()
self.driver.maximize_window()
self._start_proving_youre_a_student_page = self._getting_a_student_discount_page.select_start()
self.driver.minimize_window()
self.driver.save_screenshot('Verifier_start_proving_youre_a_student_page.png')
#self.driver.minimize_window()
self.driver.maximize_window()
qrcode = self._start_proving_youre_a_student_page.get_qr_code()
elif proof == "BestBC College":
self._book_a_study_room_page = self._using_your_credentials_page.select_bestbc_college_start()
self.driver.minimize_window()
self.driver.save_screenshot('Verifier_book_a_study_room_page.png')
#self.driver.minimize_window()
self.driver.maximize_window()
self._start_booking_the_room_page = self._book_a_study_room_page.select_start()
self.driver.minimize_window()
self.driver.save_screenshot('Verifier_start_booking_the_room_page.png')
#self.driver.minimize_window()
self.driver.maximize_window()
qrcode = self._start_booking_the_room_page.get_qr_code()


return add_border_to_qr_code(qrcode)
return add_border_to_qr_code(qrcode, border_size=50)


def proof_success(self, proof_result):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class ConnectWithBestBCCollegePage(WebBasePage):


def on_this_page(self):
self.wait_for_page_load_complete()
return super().on_this_page(self.on_this_page_text_locator)

def get_qr_code(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ class WebBasePage(object):

def on_this_page(self, locator, timeout=10):
if type(locator) is tuple:
if self.find_by(locator, timeout):
# if self.find_by(locator, timeout):
# return True
# else:
# return False
try:
self.find_by(locator, timeout)
return True
else:
except Exception as e:
# print the exception
print(e)
return False

else:
found_locator = False
i = 0
Expand Down Expand Up @@ -57,4 +65,7 @@ def find_multiple_by(self, locator_tpl: tuple, timeout=20):
f"Could not find elements {locator_tpl[0]} with Locator {locator_tpl[1]}")

def get_page_source(self):
return self.driver.page_source
return self.driver.page_source

def wait_for_page_load_complete(self, timeout=10):
WebDriverWait(self.driver, timeout).until(lambda driver: driver.execute_script('return document.readyState') == 'complete')
5 changes: 4 additions & 1 deletion aries-mobile-tests/features/steps/bc_wallet/proof.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,11 @@ def step_impl(context):

@then('holder is brought to the proof request')
def step_impl(context):
# Sometimes the proof request comes in a goal code and the user never goes to the Contact Page.
# In this case check that the ProofRequestPage is in context and if not, create it.
if hasattr(context, 'thisProofRequestPage') == False:
context.thisProofRequestPage = ProofRequestPage(context.driver)

#context.thisProofRequestPage = ProofRequestPage(context.driver)
assert context.thisProofRequestPage.on_this_page()


Expand Down

0 comments on commit 33fc070

Please sign in to comment.