Skip to content
Draft
16 changes: 16 additions & 0 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,21 @@ def run_wiki_tests(self):
)


def run_mapcore_group_tests(self):
"""Run Mapcore group tests."""
print('\n=== Mapcore group Tests ===')

self.result_notebooks.append(
self.run_notebook(
'取りまとめ-グループ.ipynb',
admin_rdm_url=self.admin_rdm_url,
admin_idp_username_1 = self.idp_username_institutional_admin,
admin_idp_password_1 = self.idp_password_institutional_admin,
skip_failed_test=self.skip_failed_test,
exclude_notebooks=self.exclude_notebooks,
)
)

def check_notebook_errors(self, notebook_path):
"""Check a notebook and all its sub-notebooks recursively for execution errors."""
all_errors = []
Expand Down Expand Up @@ -701,6 +716,7 @@ def run_all_tests(self):
self.run_weko_tests()
self.run_mibyo_db_tests()
self.run_workflow_tests()
self.run_mapcore_group_tests()
self.run_wiki_tests()

result_notebooks = [result_notebook for result_notebook in self.result_notebooks if result_notebook is not None]
Expand Down
46 changes: 44 additions & 2 deletions scripts/grdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,13 @@ async def ensure_project_exists(page, project_name, transition_timeout=30000):
await expect(page.locator(f'//*[@data-test-dashboard-item-title and text()="{project_name}"]')).to_be_visible(timeout=transition_timeout)
return True

async def delete_project(page, transition_timeout=30000):
async def delete_project(page, transition_timeout=30000, is_component=False):
await page.locator(f'//ul[contains(@class, "navbar-nav")]//a[text() = "設定"]').click()
await asyncio.sleep(3)
await page.locator('//button[text() = "プロジェクトを削除" and @data-target = "#nodesDelete"]').click()
if is_component:
await page.locator('//button[text() = "コンポーネントを削除" and @data-target = "#nodesDelete"]').click()
else:
await page.locator('//button[text() = "プロジェクトを削除" and @data-target = "#nodesDelete"]').click()

confirmation_label = page.locator('//strong[@data-bind = "text: confirmationString"]')
await expect(confirmation_label).to_have_count(1, timeout=transition_timeout)
Expand Down Expand Up @@ -471,6 +474,45 @@ async def verify_property_folder_info(
await expect(locator_path).to_have_text(folderpath)

time.sleep(1)

async def login_after_logout(page, idp_name, idp_username, idp_password, transition_timeout=30000):
if idp_name is None:
# CASでログイン
if '/login' not in page.url:
# 現在CAS以外→一旦ログインボタンを押す
await page.locator('//button[text() = "ログイン"]').click()
await login_cas(page, idp_username, idp_password)
return
# FakeCASの場合の処理
if idp_name == 'FakeCAS':
# FakeCAS(port 8080)でない場合のみサインインボタンをクリック
if ':8080' not in page.url:
await page.locator('//button[@data-test-sign-in-button]').click()
await login_fakecas(page, idp_username)
return
# 通常のIdP選択フロー(GakuNin RDM IdP, Orthrosなど)
try:
await page.locator('//*[@id = "clear_a"]').click()
# IdPが要素として作成されることを確認
# locator = page.locator(f'//*[@class = "list_idp" and text() = "{idp_name}"]')
locator = page.locator(f'//*[contains(@class, "list_idp") and normalize-space(text())="{idp_name}"]')
# locator = page.locator('//*[contains(@class, "list_idp") and normalize-space(text())="GakuNin RDM IdP"]').first
await expect(locator).to_be_visible(timeout=transition_timeout)
time.sleep(5)
await locator.click()

# 選択ボタンが有効になったことを確認
locator_wayf_submit = page.locator('//input[@id = "wayf_submit_button"]')
await expect(locator_wayf_submit).to_be_enabled(timeout=transition_timeout)
await locator_wayf_submit.click()
# アカウント入力欄が編集可能になったことを確認
await expect_idp_login(page, idp_name, timeout=transition_timeout)
await _login_idp_pw(page, idp_name, idp_username, idp_password, transition_timeout=transition_timeout)
except:
traceback.print_exc()
print('ユーザー名とパスワードによるログインを試みます...')
# すでにIdP選択済みとみなし、ユーザー名とパスワード入力を試みる
await _login_idp_pw(page, idp_name, idp_username, idp_password, transition_timeout=transition_timeout)

async def open_wiki(page, wikiname, text, transition_timeout=60000):
await page.locator(f'//*[contains(@class, "title-text")]//a[text()="{wikiname}"]').click()
Expand Down
Loading
Loading