Skip to content

Commit

Permalink
Merge branch 'master' into feat-format-ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
zj9495 authored Jun 11, 2021
2 parents 4880c6c + 8165127 commit f40863d
Show file tree
Hide file tree
Showing 34 changed files with 946 additions and 113 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_TRANSMISSION_RPC=http://tr.zj9495.com:9091
10 changes: 6 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Deploy To GCP
name: Deploy preview environment
on:
push:
branches:
- master
pull_request:
branches: [master]
jobs:
build-and-deploy:
name: Deploy
Expand Down Expand Up @@ -36,9 +38,9 @@ jobs:
- uses: appleboy/scp-action@master
with:
host: tr.zj9495.com
username: zj9495
username: ubuntu
port: 22
key: ${{ secrets.DEPLOY_SSH_KEY }}
key: ${{ secrets.DEPLOY_PREVIEW_SSH_KEY }}
source: "build/*"
target: "/mnt/disks/disk1/transmission/transmission-client"
target: "/home/ubuntu/transmission-client"
strip_components: 1
59 changes: 59 additions & 0 deletions .github/workflows/e2e-test.chrome.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: E2E on Chrome

on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master]
pull_request:
branches: [master]

jobs:
e2e-on-chrome:
runs-on: ubuntu-20.04
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# run 4 copies of the current job in parallel
containers: [1, 2, 3, 4]
services:
transmission-rpc:
image: linuxserver/transmission:latest
env:
PUID: 1000
PGID: 1000
TZ: Europe/London
USER: zj9495
PASS: zj9495
ports:
- 9091:9091
nginx:
image: nginx:latest
env:
NGINX_PORT: 80
ports:
- 8080:80
steps:
- name: Checkout
uses: actions/checkout@v1
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v2
with:
browser: chrome
headless: true
start: npm start
wait-on: "http://localhost:8888"
record: true
parallel: true
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REACT_APP_TRANSMISSION_RPC: http://localhost:9091
REACT_APP_RPC_DELAY: 100
62 changes: 62 additions & 0 deletions .github/workflows/e2e-test.edge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: E2E on Edge

on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master]
pull_request:
branches: [master]

jobs:
e2e-on-edge:
runs-on: ubuntu-20.04
container:
image: cypress/browsers:node14.10.1-edge88
options: --user 1001
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# run 4 copies of the current job in parallel
containers: [1, 2, 3, 4]
services:
transmission-rpc:
image: linuxserver/transmission:latest
env:
PUID: 1000
PGID: 1000
TZ: Europe/London
USER: zj9495
PASS: zj9495
ports:
- 9091:9091
nginx:
image: nginx:latest
env:
NGINX_PORT: 80
ports:
- 8080:80
steps:
- name: Checkout
uses: actions/checkout@v1
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v2
with:
browser: edge
headless: true
start: npm start
wait-on: "http://localhost:8888"
record: true
parallel: true
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REACT_APP_TRANSMISSION_RPC: http://transmission-rpc:9091
REACT_APP_RPC_DELAY: 100
61 changes: 61 additions & 0 deletions .github/workflows/e2e-test.ff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: E2E on FireFox

on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master]
pull_request:
branches: [master]

jobs:
e2e-on-firefox:
runs-on: ubuntu-20.04
container:
image: cypress/browsers:node14.16.0-chrome90-ff88
options: --user 1001
strategy:
# when one test fails, DO NOT cancel the other
# containers, because this will kill Cypress processes
# leaving the Dashboard hanging ...
# https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# run 4 copies of the current job in parallel
containers: [1, 2, 3, 4]
services:
transmission-rpc:
image: linuxserver/transmission:latest
env:
PUID: 1000
PGID: 1000
TZ: Europe/London
USER: zj9495
PASS: zj9495
ports:
- 9091:9091
nginx:
image: nginx:latest
env:
NGINX_PORT: 80
ports:
- 8080:80
steps:
- name: Checkout
uses: actions/checkout@v1
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v2
with:
browser: firefox
start: npm start
wait-on: "http://localhost:8888"
record: true
parallel: true
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# pass GitHub token to allow accurately detecting a build vs a re-run build
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REACT_APP_TRANSMISSION_RPC: http://transmission-rpc:9091
REACT_APP_RPC_DELAY: 100
28 changes: 0 additions & 28 deletions .github/workflows/e2e-test.yml

This file was deleted.

8 changes: 8 additions & 0 deletions cypress.env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"protocol": "http",
"host": "localhost",
"port": 8888,
"path": "/transmission/web",
"user": "zj9495",
"password": "zj9495"
}
6 changes: 4 additions & 2 deletions cypress/integration/add.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="cypress" />

import { removeTestTorrent } from "./common"
import { removeTestTorrent, TEST_URL } from "./common"

const DOWNLOAD_DIR = "/downloads/complete"
const TORRENT = {
Expand All @@ -10,7 +10,7 @@ const TORRENT = {

context('app', () => {
beforeEach(() => {
cy.visit(`http://zj9495:zj9495@localhost:8888/transmission-client`)
cy.visit(TEST_URL)
cy.verifyConnected()
})

Expand Down Expand Up @@ -61,6 +61,8 @@ context('app', () => {
cy.contains('Adding...')
cy.contains(TORRENT.NAME)
cy.contains('Cancel').click()
// eslint-disable-next-line cypress/no-unnecessary-waiting
cy.wait(3000);
cy.contains(TORRENT.NAME).should('not.exist')
})

Expand Down
4 changes: 3 additions & 1 deletion cypress/integration/app.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/// <reference types="cypress" />

import { TEST_URL } from "./common"

context('app', () => {
beforeEach(() => {
cy.visit(`http://zj9495:zj9495@localhost:8888/transmission-client`)
cy.visit(TEST_URL)
})

it('boot', () => {
Expand Down
11 changes: 10 additions & 1 deletion cypress/integration/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,13 @@ export const removeTestTorrent = () => {
cy.get('[data-testid=delete-local-data] [type=checkbox]').check()
cy.contains('OK').click()
cy.contains(TEST_TORRENT.NAME).should('not.exist')
};
};

export const getUrl = () => {
console.log('TEST_URL: ');
const { env } = Cypress
// result example: protocol://user:password@host:port/path
return `${env('protocol')}://${env('user')}:${env('password')}@${env('host')}:${env('port')}${env('path')}`
}

export const TEST_URL = getUrl()
Loading

0 comments on commit f40863d

Please sign in to comment.