Skip to content

Commit

Permalink
Selenium を Playwright に置き換え
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Dec 23, 2021
1 parent 826d983 commit 86584b5
Show file tree
Hide file tree
Showing 12 changed files with 1,015 additions and 2,063 deletions.
3 changes: 1 addition & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"useBuiltIns": "usage",
"corejs": 2
}
],
"@babel/preset-typescript"
]
]
}
66 changes: 45 additions & 21 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,26 @@ jobs:
docker-compose exec -T postgres psql --user=eccube_db_user eccube_db -c "UPDATE dtb_customer SET email = 'zap_user@example.com' WHERE customer_id = (SELECT MAX(customer_id) FROM dtb_customer WHERE status = 2 AND del_flg = 0);"
- run: sleep 1
- run: yarn install
- run: |
yarn install
yarn run playwright install --with-deps chromium
yarn playwright install-deps chromium
- name: Run to E2E testing
env:
GROUP: ${{ matrix.group }}
HTTPS_PROXY: 'localhost:8090'
ZAP_PROXY_HOST: 'localhost:8090'
# Use runner's chromedriver to run on the latest version of google-chrome
CI: 1
FORCE_COLOR: 1
run: yarn test:e2e e2e-tests/${GROUP}

# - name: Upload evidence
# if: failure()
# uses: actions/upload-artifact@v2
# with:
# name: linux-php${{ matrix.php }}-${{ matrix.db }}-evidence
# path: ctests/_output/
- name: Upload evidence
if: failure()
uses: actions/upload-artifact@v2
with:
name: linux-php${{ matrix.tag }}-${{ matrix.db }}-evidence
path: 'test-results/'
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -102,9 +107,6 @@ jobs:
env:
DB_TYPE: ${{ matrix.db }}
run: echo "COMPOSE_FILE=docker-compose.yml:docker-compose.${DB_TYPE}.yml:docker-compose.dev.yml:docker-compose.owaspzap.yml:docker-compose.owaspzap.daemon.yml" >> $GITHUB_ENV
- run: |
ls -al data/config
ls -al html/upload/save_image
- name: Setup to EC-CUBE
env:
HTTP_URL: https://127.0.0.1:8085/
Expand All @@ -113,34 +115,56 @@ jobs:
run: |
sudo chown -R 1001:1000 zap
sudo chmod -R g+w zap
touch data/config/config.php
ls -al data/config
ls -al html/upload/save_image
sh -c 'echo "<?php" >> data/config/config.php'
docker-compose build --build-arg TAG=${TAG} ec-cube
docker-compose up -d
rm data/config/config.php
- run: sleep 1
- run: yarn install
- run: |
ls -al data/config
ls -al html/upload/save_image
docker-compose exec -T ec-cube ls -al /var/www/app/data/config
docker-compose exec -T ec-cube ls -al /var/www/app/html/upload/save_image
yarn install
yarn run playwright install --with-deps chromium
yarn playwright install-deps chromium
- run: |
rm data/config/config.php
chmod -R o+w html
chmod o+w data
chmod -R o+w data/Smarty
chmod -R o+w data/cache
chmod -R o+w data/class
chmod -R o+w data/class_extends
chmod o+w data/config
chmod -R o+w data/download
chmod -R o+w data/downloads
chmod o+w data/fonts
chmod o+w data/include
chmod o+w data/logs
chmod -R o+w data/module
chmod o+w data/smarty_extends
chmod o+w data/upload
chmod o+w data/upload/csv
- name: Run to E2E testing
env:
ZAP_PROXY_HOST: 'localhost:8090'
HTTPS_PROXY: 'localhost:8090'
CI: 1
FORCE_COLOR: 1
DB_TYPE: ${{ matrix.db }}
DB_USER: ${{ matrix.dbuser }}
DB_PASSWORD: ${{ matrix.dbpass }}
DB_NAME: ${{ matrix.dbname }}
DB_PORT: ${{ matrix.dbport }}
DB_SERVER: ${{ matrix.dbhost }}
# Use runner's chromedriver to run on the latest version of google-chrome
run: yarn test:e2e e2e-tests/test/installer/installer.test.ts
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v2
with:
name: linux-php${{ matrix.tag }}-${{ matrix.db }}-logs
path: html/install/temp/install.log*
- name: Upload evidence
if: failure()
uses: actions/upload-artifact@v2
with:
name: linux-php${{ matrix.tag }}-${{ matrix.db }}-evidence
path: 'test-results/'
9 changes: 7 additions & 2 deletions .github/workflows/penetration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,18 @@ jobs:
docker-compose exec -T postgres psql --user=eccube_db_user eccube_db -c "UPDATE dtb_customer SET email = 'zap_user@example.com' WHERE customer_id = (SELECT MAX(customer_id) FROM dtb_customer WHERE status = 2 AND del_flg = 0);"
- run: sleep 1
- run: yarn install
- run: |
yarn install
yarn run playwright install --with-deps chromium
yarn playwright install-deps chromium
- name: Penetration testing
env:
GROUP: ${{ matrix.group }}
HTTPS_PROXY: 'localhost:8090'
ZAP_PROXY_HOST: 'localhost:8090'
# Use runner's chromedriver to run on the latest version of google-chrome
CI: 1
FORCE_COLOR: 1
run: yarn test:attack e2e-tests/${GROUP}

# - name: Upload evidence
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ FROM eccube2/php:${TAG}

ENV APACHE_DOCUMENT_ROOT /var/www/app/html
ENV ECCUBE_PREFIX /var/www/app

# See https://github.com/debuerreotype/debuerreotype/issues/10
RUN mkdir /usr/share/man/man1
RUN mkdir /usr/share/man/man7
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ssl-cert \
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ services:
- POSTGRES_DB=eccube_db
- POSTGRES_USER=eccube_db_user
- POSTGRES_PASSWORD=password
- POSTGRES_HOST_AUTH_METHOD=md5
- POSTGRES_INITDB_ARGS=--auth-host=md5
ports:
- 15432:5432
volumes:
Expand Down
Loading

0 comments on commit 86584b5

Please sign in to comment.