-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding playwright test termns and condition creation and checkout * Fix #1018 adding CAD support * separating CAD and GBP currency tests * changing concurrency group * restructuring CAD tests * changing email queue mounted folder
- Loading branch information
1 parent
679979c
commit 0980f47
Showing
42 changed files
with
653 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
--- | ||
# When a push is made to a branch, deploy an instance of the app using | ||
# that branch. | ||
# The deployed url will be <branchname>.<domain> | ||
|
||
name: GBP Deploy pr preview | ||
on: | ||
pull_request: | ||
# (pull_request_target get fired on external contributer pull requests) | ||
#pull_request_target | ||
paths-ignore: | ||
- '**/README.md' | ||
- '**/TESTING.md' | ||
- 'docs/**' | ||
jobs: | ||
GBP-deploy-pr: | ||
runs-on: ubuntu-20.04 | ||
timeout-minutes: 60 | ||
environment: testing | ||
concurrency: | ||
group: 'GBP-${{ github.ref }}' | ||
cancel-in-progress: true | ||
steps: | ||
- name: Dump context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJSON(github) }} | ||
run: | | ||
echo $GITHUB_CONTEXT | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: psf/black@stable # Fail early if fails Black code style | ||
- name: Prepare runner with ssh keys | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
DOKKU_HOST: ${{ secrets.DOKKU_HOST }} | ||
run: | | ||
set -x | ||
mkdir -p ~/.ssh | ||
eval `ssh-agent -s` | ||
ssh-add - <<< "$SSH_PRIVATE_KEY" | ||
ssh-keyscan $DOKKU_HOST >> ~/.ssh/known_hosts | ||
- name: Set subdomain (ensure is lowercase for dokku) | ||
run: | | ||
set -x | ||
echo SUBDOMAIN=`echo "GBP-${{ github.head_ref }}" | tr '[:upper:]' '[:lower:]' | cut -c -60` >> $GITHUB_ENV | ||
echo $GITHUB_ENV | ||
- name: Create dokku app for pr branch if dosent already exist using dokku apps:create | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
DOKKU_HOST: ${{ secrets.DOKKU_HOST }} | ||
run: | | ||
set -x | ||
echo The PR was raised by: ${{ github.event.pull_request.user.login }} | ||
eval `ssh-agent -s` | ||
ssh-add - <<< "$SSH_PRIVATE_KEY" | ||
echo Creating dokku app ${{ github.head_ref }} | ||
ssh dokku@$DOKKU_HOST -C "dokku apps:create ${{ env.SUBDOMAIN }}" | true | ||
echo The url will be ${{ github.head_ref }}.pcpink.co.uk | ||
ssh dokku@$DOKKU_HOST -C "dokku git:initialize ${{ env.SUBDOMAIN }}" | ||
ssh dokku@$DOKKU_HOST -C "dokku git:set ${{ env.SUBDOMAIN }} deploy-branch ${{ github.head_ref }}" | ||
# set Stripe test keys as env vars dor dokku/docker | ||
ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} STRIPE_TEST_SECRET_KEY=${{ secrets.STRIPE_TEST_SECRET_KEY }}" | ||
ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} STRIPE_TEST_PUBLISHABLE_KEY=${{ secrets.STRIPE_TEST_PUBLISHABLE_KEY }}" | ||
ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} STRIPE_CONNECT_ACCOUNT_ANNOUNCER_HOST=${{ secrets.STRIPE_CONNECT_ACCOUNT_ANNOUNCER_HOST }}" | ||
ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} FLASK_ENV=development" | ||
ssh dokku@$DOKKU_HOST -C "dokku config:set --no-restart ${{ env.SUBDOMAIN }} EMAIL_QUEUE_FOLDER=${{ secrets.DOKKU_EMAIL_QUEUE_FOLDER }}" | ||
# mount email-queue folder | ||
ssh dokku@$DOKKU_HOST -C "dokku storage:mount ${{ env.SUBDOMAIN }} ${{ secrets.HOST_EMAIL_QUEUE_PATH }}:${{ secrets.DOKKU_EMAIL_QUEUE_FOLDER }} && dokku ps:restart ${{ env.SUBDOMAIN }} || true" | ||
- name: Deploy branch ${{ github.head_ref }} to dokku | ||
uses: idoberko2/dokku-deploy-github-action@v1 | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
dokku-host: ${{ secrets.DOKKU_HOST }} | ||
app-name: ${{ env.SUBDOMAIN }} | ||
git-push-flags: '--force' | ||
remote-branch: ${{ github.head_ref }} | ||
- name: Click to see your PR web address | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
DOKKU_HOST: ${{ secrets.DOKKU_HOST }} | ||
run: | | ||
echo Visit your pr here: http://GBP-${{ github.head_ref }}.pcpink.co.uk | ||
- name: 'Comment PR with web address of application live preview' | ||
uses: actions/github-script@v3 | ||
if: github.event_name == 'pull_request' | ||
with: | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: "🙌 Live preview is here: http://GBP-${{ github.head_ref }}.pcpink.co.uk" | ||
}) | ||
- uses: actions/setup-node@v3 | ||
|
||
- uses: microsoft/playwright-github-action@v1 | ||
|
||
- name: Install node dependencies needed for Playwright browser tests | ||
run: | | ||
npm i -D @playwright/[email protected] | ||
npx playwright install | ||
sudo npx playwright install-deps | ||
- name: Run & Record browser automated tests (Playwright) | ||
env: | ||
PLAYWRIGHT_HOST: http://GBP-${{ github.head_ref }}.pcpink.co.uk/ | ||
PLAYWRIGHT_SLOWMO: 1000 | ||
PLAYWRIGHT_HEADLESS: true | ||
SUBSCRIBER_EMAIL_HOST: ${{ secrets.SUBSCRIBER_EMAIL_HOST }} | ||
SUBSCRIBER_EMAIL_USER: ${{ secrets.SUBSCRIBER_EMAIL_USER }} | ||
SUBSCRIBER_EMAIL_PASSWORD: ${{ secrets.SUBSCRIBER_EMAIL_PASSWORD }} | ||
EMAIL_SEARCH_API_HOST: ${{ secrets.EMAIL_SEARCH_API_HOST }} | ||
RESET_PASSWORD_IMAP_SEARCH_SUBJECT: ${{ secrets.RESET_PASSWORD_IMAP_SEARCH_SUBJECT }} | ||
IMAP_SEARCH_UNSEEN: "1" | ||
IMAP_SEARCH_SINCE_DATE: "01-Sep-2022" | ||
run: | | ||
set -x | ||
cp tests/browser-automated-tests-playwright/.env.example tests/browser-automated-tests-playwright/.env | ||
cp .env.example .env | ||
cd tests/browser-automated-tests-playwright; npx playwright test --grep @GBP --update-snapshots | ||
- uses: actions/upload-artifact@v2 | ||
if: ${{ always() }} | ||
with: | ||
name: Screenshots-and-video-artifacts | ||
path: | | ||
./index.spec.js-snapshots/* | ||
./tests/browser-automated-tests-playwright/test-results/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
"SK": "EUR", | ||
"SI": "EUR", | ||
"ES": "EUR", | ||
"CA": "CAD", | ||
"AU": "AUD", | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
|
||
test.describe("Github actions test:", () => { | ||
const magic_login_receives_email = require('./tests/704_shop_owner_magic_login_receives_email'); | ||
const magic_login_receives_email = require(`./tests/704_shop_owner_magic_login_receives_email`); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.