diff --git a/.github/scripts/generate_ci_config.sh b/.github/scripts/generate_ci_config.sh index 86d960c..eafea0d 100755 --- a/.github/scripts/generate_ci_config.sh +++ b/.github/scripts/generate_ci_config.sh @@ -3,7 +3,7 @@ set -xeuo pipefail if [[ $# -lt 2 ]]; then cat >&2 <<'USAGE' -Usage: generate_ci_config.sh [--minio] [--jupyterhub] [--weko] [--flowable] [--s3compatsigv4] [--s3compatsigv4-inst] [--wiki] +Usage: generate_ci_config.sh [--minio] [--nextcloud] [--jupyterhub] [--weko] [--flowable] [--s3compatsigv4] [--s3compatsigv4-inst] [--wiki] USAGE exit 1 fi @@ -12,6 +12,7 @@ OUTPUT=$1 BASE_CONFIG=$2 shift 2 MINIO=false +NEXTCLOUD=false JUPYTERHUB=false WEKO=false FLOWABLE=false @@ -24,6 +25,9 @@ for arg in "$@"; do --minio) MINIO=true ;; + --nextcloud) + NEXTCLOUD=true + ;; --jupyterhub) JUPYTERHUB=true ;; @@ -85,6 +89,16 @@ storages_s3: [] EOF fi +if [[ "${NEXTCLOUD}" == "true" ]]; then + cat >> "${OUTPUT}" <&2 diff --git a/.github/scripts/setup_nextcloud.sh b/.github/scripts/setup_nextcloud.sh new file mode 100755 index 0000000..62dbc22 --- /dev/null +++ b/.github/scripts/setup_nextcloud.sh @@ -0,0 +1,69 @@ +#!/bin/bash +set -xeuo pipefail + +SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +FIXTURE_DIR=$(cd "${SCRIPT_DIR}/../../docker/nextcloud" && pwd) +COMMAND=${1:?Usage: setup_nextcloud.sh [RDM directory]} + +case "$COMMAND" in + prepare) + RDM_DIR=${2:?RDM directory is required} + mkdir -p "${FIXTURE_DIR}/.state" + openssl req -x509 -newkey rsa:2048 -nodes -days 3 \ + -keyout "${FIXTURE_DIR}/.state/server.key" \ + -out "${FIXTURE_DIR}/.state/server.crt" \ + -subj '/CN=192.168.168.167' \ + -addext 'subjectAltName=IP:192.168.168.167' \ + -addext 'basicConstraints=critical,CA:TRUE' + cat > "${RDM_DIR}/addons/nextcloud/settings/local.py" <&2 + exit 1 + fi + sleep 10 + done + curl --fail --cacert "${FIXTURE_DIR}/.state/server.crt" \ + --user "${NEXTCLOUD_USERNAME}:${NEXTCLOUD_PASSWORD}" -X MKCOL \ + "${NEXTCLOUD_URL}/remote.php/dav/files/${NEXTCLOUD_USERNAME}/e2e" + cd "$RDM_DIR" + for service in web api worker wb wb_worker; do + container=$(docker-compose ps -q "$service") + docker cp "${FIXTURE_DIR}/.state/server.crt" "${container}:/tmp/nextcloud-ca.crt" + docker-compose exec -T "$service" python3 - <<'PY' +import ssl +from pathlib import Path +import certifi + +certificate = Path('/tmp/nextcloud-ca.crt').read_bytes() +bundle = Path(certifi.where()) +if certificate not in bundle.read_bytes(): + with bundle.open('ab') as stream: + stream.write(b'\n' + certificate) +openssl_bundle = Path(ssl.get_default_verify_paths().openssl_cafile) +openssl_bundle.write_bytes(bundle.read_bytes()) +PY + done + docker-compose restart web api worker wb wb_worker + ;; + down) + docker compose -f "${FIXTURE_DIR}/compose.yaml" down -v + ;; + *) + echo "Unknown command: $COMMAND" >&2 + exit 1 + ;; +esac diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index bcf5dff..68a207d 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -315,6 +315,24 @@ jobs: flowable_enabled: false wiki_enabled: false mapcore_group_enabled: false + - name: user-nextcloud + display_name: "User Tests (Nextcloud)" + include_admin: false + skip_admin: true + skip_metadata: true + skip_autofill: true + skip_default_storage: true + skip_login: true + skip_130mb_upload: true + minio_enabled: false + s3compatsigv4_enabled: false + weko_enabled: false + mibyo_db_enabled: false + jupyterhub_enabled: false + flowable_enabled: false + wiki_enabled: false + mapcore_group_enabled: false + nextcloud_enabled: true - name: admin-minio display_name: "Admin Tests (MinIO)" include_admin: true @@ -475,6 +493,10 @@ jobs: mapcore_group_enabled: true name: E2E ${{ matrix.test-group.display_name }} env: + NEXTCLOUD_ENABLED: ${{ matrix.test-group.nextcloud_enabled == true && 'true' || 'false' }} + NEXTCLOUD_URL: https://192.168.168.167:18443 + NEXTCLOUD_USERNAME: e2eadmin + NEXTCLOUD_PASSWORD: e2epassword123 MINIO_ENABLED: ${{ matrix.test-group.minio_enabled == true && 'true' || 'false' }} S3COMPATSIGV4_ENABLED: ${{ matrix.test-group.s3compatsigv4_enabled == true && 'true' || 'false' }} S3COMPATSIGV4_INST_ENABLED: ${{ matrix.test-group.s3compatsigv4_institutional_storage == true && 'true' || 'false' }} @@ -888,6 +910,11 @@ jobs: export INCLUDE_ADMIN=${{ matrix.test-group.include_admin }} setup_config_files + - name: Prepare Nextcloud configuration + if: env.NEXTCLOUD_ENABLED == 'true' + working-directory: e2e-tests + run: .github/scripts/setup_nextcloud.sh prepare ../RDM-osf.io + - name: Parse PR body and workflow parameters run: | if [[ "${{ github.event_name }}" == "pull_request" ]]; then @@ -1103,6 +1130,15 @@ jobs: export INCLUDE_ADMIN=${{ matrix.test-group.include_admin }} start_rdm_services + - name: Start Nextcloud and trust its certificate + if: env.NEXTCLOUD_ENABLED == 'true' + working-directory: e2e-tests + run: | + .github/scripts/setup_nextcloud.sh install ../RDM-osf.io + cd ../RDM-osf.io + source ../e2e-tests/.github/scripts/setup_rdm.sh + test_rdm_endpoints + - name: Register OAuth scopes working-directory: RDM-osf.io run: | @@ -1484,6 +1520,9 @@ jobs: if [ "${MINIO_ENABLED}" = "true" ]; then args+=(--minio) fi + if [ "${NEXTCLOUD_ENABLED}" = "true" ]; then + args+=(--nextcloud) + fi if [ "${JUPYTERHUB_ENABLED}" = "true" ]; then args+=(--jupyterhub) fi @@ -1682,6 +1721,23 @@ jobs: path: e2e-tests/y-websocket-logs.txt if-no-files-found: ignore + - name: Collect Nextcloud logs + if: always() && env.NEXTCLOUD_ENABLED == 'true' + working-directory: e2e-tests + run: docker compose -f docker/nextcloud/compose.yaml logs > nextcloud-logs.txt 2>&1 + + - name: Upload Nextcloud logs + if: always() && env.NEXTCLOUD_ENABLED == 'true' + uses: actions/upload-artifact@v4 + with: + name: nextcloud-logs-${{ matrix.test-group.name }} + path: e2e-tests/nextcloud-logs.txt + + - name: Stop Nextcloud stack + if: always() && env.NEXTCLOUD_ENABLED == 'true' + working-directory: e2e-tests + run: .github/scripts/setup_nextcloud.sh down + - name: Stop WEKO stack if: always() && (env.WEKO_ENABLED == 'true' || env.MIBYO_DB_ENABLED == 'true') working-directory: e2e-tests diff --git a/docker/nextcloud/.gitignore b/docker/nextcloud/.gitignore new file mode 100644 index 0000000..95f7491 --- /dev/null +++ b/docker/nextcloud/.gitignore @@ -0,0 +1 @@ +.state/ diff --git a/docker/nextcloud/compose.yaml b/docker/nextcloud/compose.yaml new file mode 100644 index 0000000..6096b1d0 --- /dev/null +++ b/docker/nextcloud/compose.yaml @@ -0,0 +1,23 @@ +services: + nextcloud: + image: nextcloud:35.0.2-apache + entrypoint: ["/bin/bash", "-ec"] + command: + - | + a2enmod ssl + a2ensite default-ssl + exec /entrypoint.sh apache2-foreground + ports: + - '18443:443' + environment: + NEXTCLOUD_ADMIN_USER: ${NEXTCLOUD_USERNAME:?} + NEXTCLOUD_ADMIN_PASSWORD: ${NEXTCLOUD_PASSWORD:?} + SQLITE_DATABASE: nextcloud + NEXTCLOUD_TRUSTED_DOMAINS: 192.168.168.167 + OVERWRITEPROTOCOL: https + volumes: + - nextcloud_data:/var/www/html + - ./.state/server.crt:/etc/ssl/certs/ssl-cert-snakeoil.pem:ro + - ./.state/server.key:/etc/ssl/private/ssl-cert-snakeoil.key:ro +volumes: + nextcloud_data: diff --git a/run_tests.py b/run_tests.py index dd25b22..609b5fd 100644 --- a/run_tests.py +++ b/run_tests.py @@ -47,6 +47,7 @@ def __init__(self, config_path, show_disk_usage=False, failed_result_path=None): self.skip_login = False self.enable_1gb_file_upload = False self.skip_autofill = False + self.nextcloud_enabled = False self.jupyterhub_enabled = False self.tljh_url = None self.tljh_username = None @@ -315,6 +316,22 @@ def run_storage_tests(self): ) ) + if self.nextcloud_enabled: + self.result_notebooks.append( + self.run_notebook( + 'テスト手順-WebDAVストレージ-アカウント設定.ipynb', + webdav_host=self.nextcloud_url, + webdav_username=self.nextcloud_username, + webdav_password=self.nextcloud_password, + webdav_folder='e2e', + rdm_project_name='TEST-NEXTCLOUD-{}'.format( + datetime.now().strftime('%Y%m%d-%H%M%S') + ), + skip_130mb_upload=self.skip_130mb_upload, + skip_preview_check=self.skip_preview_check, + ) + ) + # OAuth storage tests (require manual setup, so skip in automated tests) print('\nSkipping OAuth storage tests (require manual setup)') diff --git "a/\343\203\206\343\202\271\343\203\210\346\211\213\351\240\206-WebDAV\343\202\271\343\203\210\343\203\254\343\203\274\343\202\270-\343\202\242\343\202\253\343\202\246\343\203\263\343\203\210\350\250\255\345\256\232.ipynb" "b/\343\203\206\343\202\271\343\203\210\346\211\213\351\240\206-WebDAV\343\202\271\343\203\210\343\203\254\343\203\274\343\202\270-\343\202\242\343\202\253\343\202\246\343\203\263\343\203\210\350\250\255\345\256\232.ipynb" new file mode 100644 index 0000000..dfabba5 --- /dev/null +++ "b/\343\203\206\343\202\271\343\203\210\346\211\213\351\240\206-WebDAV\343\202\271\343\203\210\343\203\254\343\203\274\343\202\270-\343\202\242\343\202\253\343\202\246\343\203\263\343\203\210\350\250\255\345\256\232.ipynb" @@ -0,0 +1,663 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "cf267c2a", + "metadata": { + "tags": [ + "parameters" + ] + }, + "outputs": [], + "source": [ + "from datetime import datetime\n", + "from getpass import getpass\n", + "\n", + "rdm_url = 'https://rdm.example.com/'\n", + "idp_name_1 = None\n", + "idp_username_1 = None\n", + "idp_password_1 = None\n", + "target_storage_id = 'nextcloud'\n", + "target_storage_name = 'Nextcloud'\n", + "webdav_host = None\n", + "webdav_username = None\n", + "webdav_password = None\n", + "webdav_folder = 'e2e'\n", + "rdm_project_name = 'TEST-WEBDAV-{}'.format(datetime.now().strftime('%Y%m%d-%H%M%S'))\n", + "target_file_view = 'file-tab'\n", + "skip_130mb_upload = False\n", + "skip_preview_check = True\n", + "close_on_fail = False\n", + "default_result_path = None\n", + "transition_timeout = 60000\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d9c34d5a", + "metadata": {}, + "outputs": [], + "source": [ + "import tempfile\n", + "assert target_storage_id in ('owncloud', 'nextcloud')\n", + "if idp_username_1 is None:\n", + " idp_username_1 = input(prompt='GRDM username: ')\n", + "if idp_password_1 is None:\n", + " idp_password_1 = getpass(prompt='GRDM password: ')\n", + "if webdav_host is None:\n", + " webdav_host = input(prompt='WebDAV server URL: ')\n", + "if webdav_username is None:\n", + " webdav_username = input(prompt='WebDAV username: ')\n", + "if webdav_password is None:\n", + " webdav_password = getpass(prompt='WebDAV password: ')\n", + "work_dir = tempfile.mkdtemp()\n", + "if default_result_path is None:\n", + " default_result_path = work_dir\n" + ] + }, + { + "cell_type": "markdown", + "id": "2b6cf321", + "metadata": {}, + "source": [ + "# GakuNinRDM 総合テスト [WebDAVストレージ-アカウント設定]\n", + "\n", + "- サブシステム名: アドオン\n", + "- ページ/アドオン: ownCloud / Nextcloud\n", + "- 機能分類: ストレージ制御確認\n", + "- シナリオ名: 接続先選択・アカウント登録・フォルダ選択・ファイル操作\n", + "- 用意するテストデータ: 対象ストレージのアカウントを未登録のGRDMユーザー、接続可能URLリストに掲載されたWebDAV接続先、空の試験用フォルダ\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8cf4fcc7", + "metadata": {}, + "outputs": [], + "source": [ + "import importlib\n", + "import os\n", + "import scripts.playwright\n", + "importlib.reload(scripts.playwright)\n", + "from scripts.playwright import *\n", + "from scripts import grdm\n", + "\n", + "await init_pw_context(close_on_fail=close_on_fail, last_path=default_result_path)\n" + ] + }, + { + "cell_type": "markdown", + "id": "a7c4925b", + "metadata": {}, + "source": [ + "## ウェブブラウザの新規プライベートウィンドウでGRDMトップページを表示する\n", + "\n", + "GRDMトップページが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f1af8a40", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.goto(rdm_url)\n", + " await page.get_by_role('button', name='同意する', exact=True).click()\n", + " await expect(page.get_by_role('button', name='同意する', exact=True)).to_have_count(0)\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "9b5105f6", + "metadata": {}, + "source": [ + "## ログイン情報を用いてGakuNin RDMにログインする\n", + "\n", + "ダッシュボードが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f4341fba", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await grdm.login(page, idp_name_1, idp_username_1, idp_password_1, transition_timeout=transition_timeout)\n", + " await grdm.expect_dashboard(page, transition_timeout=transition_timeout)\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "71f9c270", + "metadata": {}, + "source": [ + "## 指定された名前のプロジェクトを作成する\n", + "\n", + "プロジェクト一覧に作成したプロジェクトが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9c9c74db", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await grdm.ensure_project_exists(page, rdm_project_name, transition_timeout=transition_timeout)\n", + " await expect(page.locator('[data-test-dashboard-item-title]').filter(has_text=rdm_project_name)).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "1723c4b0", + "metadata": {}, + "source": [ + "## ダッシュボードのプロジェクト一覧から作成したプロジェクトをクリックする\n", + "\n", + "プロジェクトダッシュボードが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "191136fd", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator('[data-test-dashboard-item-title]').filter(has_text=rdm_project_name).click()\n", + " await expect(page.get_by_role('link', name='アドオン', exact=True)).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "cae2b2a9", + "metadata": {}, + "source": [ + "## プロジェクト上部メニューの「アドオン」をクリックする\n", + "\n", + "対象ストレージの「有効にする」が表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6ff5eb4a", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.get_by_role('link', name='アドオン', exact=True).click()\n", + " await expect(page.locator(f'div[full_name=\"{target_storage_name}\"]').get_by_text('有効にする', exact=True)).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "d62128ce", + "metadata": {}, + "source": [ + "## 対象ストレージの「有効にする」をクリックする\n", + "\n", + "確認ダイアログが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "40c8ab4c", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator(f'div[full_name=\"{target_storage_name}\"]').get_by_text('有効にする', exact=True).click()\n", + " await expect(page.locator('button[data-bb-handler=\"confirm\"]')).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "bcd13c9a", + "metadata": {}, + "source": [ + "## 確認ダイアログの「確認」をクリックする\n", + "\n", + "対象ストレージのアカウント接続リンクが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3d8a85a7", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator('button[data-bb-handler=\"confirm\"]').click()\n", + " await expect(page.locator(f'#{target_storage_id}Scope a[data-toggle=\"modal\"]')).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "46e75cb7", + "metadata": {}, + "source": [ + "## 対象ストレージのアカウント接続リンクをクリックする\n", + "\n", + "接続先選択と認証情報入力のダイアログが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ae9636e8", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator(f'#{target_storage_id}Scope a[data-toggle=\"modal\"]').click()\n", + " await expect(page.locator('.modal.in #hostSelect')).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "99eb6484", + "metadata": {}, + "source": [ + "## 接続先のドロップダウンから指定されたURLを選択する\n", + "\n", + "指定されたURLが選択されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a24cdb09", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator('.modal.in #hostSelect').select_option(label=webdav_host)\n", + " await expect(page.locator('.modal.in #hostSelect')).to_have_value(webdav_host)\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "d98375aa", + "metadata": {}, + "source": [ + "## 対象ストレージのユーザー名とパスワードを入力する\n", + "\n", + "認証情報が入力され、パスワードが伏せ字で表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "032b300c", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator('.modal.in input[name=\"username\"]').fill(webdav_username)\n", + " await page.locator('.modal.in input[name=\"password\"]').fill(webdav_password)\n", + " await expect(page.locator('.modal.in input[name=\"password\"]')).to_have_attribute('type', 'password')\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "5441470f", + "metadata": {}, + "source": [ + "## 接続ダイアログの「保存」をクリックする\n", + "\n", + "ダイアログが閉じ、試験用フォルダが選択可能になること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4bf1b95e", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator('.modal.in').get_by_role('button', name='保存', exact=True).click()\n", + " await expect(page.locator('.modal.in')).to_have_count(0)\n", + " await expect(page.locator(f'//span[text()=\"{webdav_folder}\"]/../../..//input[@type=\"radio\"]')).to_be_enabled()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "112b3062", + "metadata": {}, + "source": [ + "## 試験用フォルダのラジオボタンをクリックする\n", + "\n", + "接続するフォルダ名が確認欄に表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b40142e2", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator(f'//span[text()=\"{webdav_folder}\"]/../../..//input[@type=\"radio\"]').click()\n", + " await expect(page.locator(f'.{target_storage_id}-confirm-selection')).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "efdb7462", + "metadata": {}, + "source": [ + "## フォルダ選択の「保存」をクリックする\n", + "\n", + "フォルダが正常にリンクされたメッセージが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5bada791", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator(f'.{target_storage_id}-confirm-selection input[type=\"submit\"]').click()\n", + " await expect(page.locator(f'#{target_storage_id}Scope > .help-block').get_by_text('正常にリンクされました', exact=False)).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "02d5c1be", + "metadata": {}, + "source": [ + "## 「ファイルページ」リンクをクリックする\n", + "\n", + "対象ストレージのファイル一覧が表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f671e19", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.get_by_role('link', name='ファイルページ', exact=True).click()\n", + " await expect(grdm.get_select_expanded_storage_title_locator(page, target_storage_name)).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5dd3aa8f", + "metadata": {}, + "outputs": [], + "source": [ + "await finish_pw_context()\n" + ] + }, + { + "cell_type": "markdown", + "id": "1e07c9de", + "metadata": {}, + "source": [ + "## 対象ストレージでファイルの基本操作を行う\n", + "\n", + "ストレージ共通のファイル基本操作の各期待値を満たすこと。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5b91b267", + "metadata": {}, + "outputs": [], + "source": [ + "from scripts.papermillHelpers import run_notebook\n", + "\n", + "result_notebook = run_notebook(\n", + " os.path.join(default_result_path, 'notebooks'),\n", + " 'テスト手順-ストレージ共通-ファイル基本操作.ipynb',\n", + " transition_timeout,\n", + " shared_params=dict(rdm_url=rdm_url, idp_name_1=idp_name_1,\n", + " idp_username_1=idp_username_1, idp_password_1=idp_password_1),\n", + " extra_params=dict(target_storage_id=target_storage_id, target_storage_name=target_storage_name,\n", + " rdm_project_name=rdm_project_name, target_file_view=target_file_view,\n", + " enable_1gb_file_upload=False, skip_130mb_upload=skip_130mb_upload,\n", + " skip_preview_check=skip_preview_check),\n", + ")\n", + "result_notebook\n" + ] + }, + { + "cell_type": "markdown", + "id": "085e7ab0", + "metadata": {}, + "source": [ + "# GakuNinRDM 総合テスト [WebDAVストレージ-アカウント切断]\n", + "\n", + "- サブシステム名: アドオン\n", + "- ページ/アドオン: ownCloud / Nextcloud\n", + "- 機能分類: ストレージ制御確認\n", + "- シナリオ名: アカウント切断\n", + "- 用意するテストデータ: ファイル操作試験で登録したストレージアカウント\n" + ] + }, + { + "cell_type": "markdown", + "id": "15d54268", + "metadata": {}, + "source": [ + "## ウェブブラウザの新規プライベートウィンドウでGRDMトップページを表示する\n", + "\n", + "GRDMトップページが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "810bad90", + "metadata": {}, + "outputs": [], + "source": [ + "await init_pw_context(close_on_fail=close_on_fail, last_path=os.path.join(default_result_path, 'account-disconnection'))\n", + "\n", + "async def _step(page):\n", + " await page.goto(rdm_url)\n", + " await page.get_by_role('button', name='同意する', exact=True).click()\n", + " await expect(page.get_by_role('button', name='同意する', exact=True)).to_have_count(0)\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "fd246c94", + "metadata": {}, + "source": [ + "## ログイン情報を用いてGakuNin RDMにログインする\n", + "\n", + "ダッシュボードが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "08182e60", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await grdm.login(page, idp_name_1, idp_username_1, idp_password_1, transition_timeout=transition_timeout)\n", + " await grdm.expect_dashboard(page, transition_timeout=transition_timeout)\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "8d3f422b", + "metadata": {}, + "source": [ + "## ユーザーメニューから「設定」を選択する\n", + "\n", + "ユーザー設定ページが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5688a74d", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator('div.nav-profile-name').click()\n", + " await page.locator('[data-analytics-name=\"Settings\"]').click()\n", + " await expect(page.get_by_text('アドオンアカウント構成', exact=True)).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "25af23b8", + "metadata": {}, + "source": [ + "## 左メニューの「アドオンアカウント構成」をクリックする\n", + "\n", + "対象ストレージの登録済みアカウントが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "492ed346", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.get_by_text('アドオンアカウント構成', exact=True).click()\n", + " await expect(page.locator(f'#{target_storage_id}AddonScope').get_by_text('アカウントを切断', exact=True)).to_have_count(1)\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "8c8b8fc7", + "metadata": {}, + "source": [ + "## 対象ストレージの「アカウントを切断」をクリックする\n", + "\n", + "切断の確認ダイアログが表示されること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "06396984", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator(f'#{target_storage_id}AddonScope').get_by_text('アカウントを切断', exact=True).click()\n", + " await expect(page.locator('.bootbox-confirm .btn-danger')).to_be_visible()\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "3ed674fc", + "metadata": {}, + "source": [ + "## 確認ダイアログの「Disconnect」をクリックする\n", + "\n", + "対象ストレージの登録済みアカウントがなくなること。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "561428bc", + "metadata": {}, + "outputs": [], + "source": [ + "async def _step(page):\n", + " await page.locator('.bootbox-confirm .btn-danger').click()\n", + " await expect(page.locator(f'#{target_storage_id}AddonScope').get_by_text('アカウントを切断', exact=True)).to_have_count(0)\n", + "\n", + "await run_pw(_step)\n" + ] + }, + { + "cell_type": "markdown", + "id": "6c8e8330", + "metadata": {}, + "source": [ + "終了処理を実施。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b4d402a2", + "metadata": {}, + "outputs": [], + "source": [ + "await finish_pw_context()\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}