remove workflows

refactor admin plugin tests
bisect-plugins
webzwo0i 2023-07-02 03:02:39 +02:00
parent 868c6852de
commit cc80db2d3c
11 changed files with 149 additions and 921 deletions

View File

@ -1,181 +0,0 @@
name: "Backend tests"
# any branch is useful for testing before a PR is submitted
on: [push, pull_request]
jobs:
withoutpluginsLinux:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: Linux without plugins
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [12, 14, 16]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Install libreoffice
run: |
sudo add-apt-repository -y ppa:libreoffice/ppa
sudo apt update
sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
- name: Run the backend tests
run: cd src && npm test
withpluginsLinux:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: Linux with Plugins
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [12, 14, 16]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Install libreoffice
run: |
sudo add-apt-repository -y ppa:libreoffice/ppa
sudo apt update
sudo apt install -y --no-install-recommends libreoffice libreoffice-pdfimport
- name: Install Etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199
run: >
npm install --no-save --legacy-peer-deps
ep_align
ep_author_hover
ep_cursortrace
ep_font_size
ep_hash_auth
ep_headings2
ep_image_upload
ep_markdown
ep_readonly_guest
ep_set_title_on_pad
ep_spellcheck
ep_subscript_and_superscript
ep_table_of_contents
# This must be run after installing the plugins, otherwise npm will try to
# hoist common dependencies by removing them from src/node_modules and
# installing them in the top-level node_modules. As of v6.14.10, npm's hoist
# logic appears to be buggy, because it sometimes removes dependencies from
# src/node_modules but fails to add them to the top-level node_modules. Even
# if npm correctly hoists the dependencies, the hoisting seems to confuse
# tools such as `npm outdated`, `npm update`, and some ESLint rules.
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
- name: Run the backend tests
run: cd src && npm test
withoutpluginsWindows:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: Windows without plugins
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installOnWindows.bat
- name: Fix up the settings.json
run: |
powershell -Command "(gc settings.json.template) -replace '\"max\": 10', '\"max\": 10000' | Out-File -encoding ASCII settings.json.holder"
powershell -Command "(gc settings.json.holder) -replace '\"points\": 10', '\"points\": 1000' | Out-File -encoding ASCII settings.json"
- name: Run the backend tests
run: cd src && npm test
withpluginsWindows:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: Windows with Plugins
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Install Etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199
run: >
npm install --no-save --legacy-peer-deps
ep_align
ep_author_hover
ep_cursortrace
ep_font_size
ep_hash_auth
ep_headings2
ep_image_upload
ep_markdown
ep_readonly_guest
ep_set_title_on_pad
ep_spellcheck
ep_subscript_and_superscript
ep_table_of_contents
# This must be run after installing the plugins, otherwise npm will try to
# hoist common dependencies by removing them from src/node_modules and
# installing them in the top-level node_modules. As of v6.14.10, npm's hoist
# logic appears to be buggy, because it sometimes removes dependencies from
# src/node_modules but fails to add them to the top-level node_modules. Even
# if npm correctly hoists the dependencies, the hoisting seems to confuse
# tools such as `npm outdated`, `npm update`, and some ESLint rules.
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installOnWindows.bat
- name: Fix up the settings.json
run: |
powershell -Command "(gc settings.json.template) -replace '\"max\": 10', '\"max\": 10000' | Out-File -encoding ASCII settings.json.holder"
powershell -Command "(gc settings.json.holder) -replace '\"points\": 10', '\"points\": 1000' | Out-File -encoding ASCII settings.json"
- name: Run the backend tests
run: cd src && npm test

View File

@ -1,54 +0,0 @@
name: "CodeQL"
on:
push:
branches: [develop, master]
pull_request:
# The branches below must be a subset of the branches above
branches: [develop]
schedule:
- cron: '0 13 * * 1'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -1,26 +0,0 @@
name: "Dockerfile"
# any branch is useful for testing before a PR is submitted
on: [push, pull_request]
jobs:
dockerfile:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: build image and run connectivity test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: docker build
run: |
docker build -t etherpad:test .
docker run -d -p 9001:9001 etherpad:test
./src/bin/installDeps.sh
sleep 3 # delay for startup?
cd src && npm run test-container

View File

@ -1,134 +0,0 @@
# Leave the powered by Sauce Labs bit in as this means we get additional concurrency
name: "Frontend tests powered by Sauce Labs"
on: [push]
jobs:
withoutplugins:
name: without plugins
runs-on: ubuntu-latest
steps:
- name: Generate Sauce Labs strings
id: sauce_strings
run: |
printf %s\\n '::set-output name=name::${{ github.workflow }} - ${{ github.job }}'
printf %s\\n '::set-output name=tunnel_id::${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}'
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
- name: export GIT_HASH to env
id: environment
run: echo "::set-output name=sha_short::$(git rev-parse --short ${{ github.sha }})"
- name: Create settings.json
run: cp settings.json.template settings.json
- name: Disable import/export rate limiting
run: |
sed -e '/^ *"importExportRateLimiting":/,/^ *\}/ s/"max":.*/"max": 0/' -i settings.json
- uses: saucelabs/sauce-connect-action@v1
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
tunnelIdentifier: ${{ steps.sauce_strings.outputs.tunnel_id }}
- name: Run the frontend tests
shell: bash
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
SAUCE_NAME: ${{ steps.sauce_strings.outputs.name }}
TRAVIS_JOB_NUMBER: ${{ steps.sauce_strings.outputs.tunnel_id }}
GIT_HASH: ${{ steps.environment.outputs.sha_short }}
run: |
src/tests/frontend/travis/runner.sh
withplugins:
name: with plugins
runs-on: ubuntu-latest
steps:
- name: Generate Sauce Labs strings
id: sauce_strings
run: |
printf %s\\n '::set-output name=name::${{ github.workflow }} - ${{ github.job }}'
printf %s\\n '::set-output name=tunnel_id::${{ github.run_id }}-${{ github.run_number }}-${{ github.job }}'
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Install Etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199
run: >
npm install --no-save --legacy-peer-deps
ep_align
ep_author_hover
ep_cursortrace
ep_embedmedia
ep_font_size
ep_hash_auth
ep_headings2
ep_image_upload
ep_markdown
ep_readonly_guest
ep_set_title_on_pad
ep_spellcheck
ep_subscript_and_superscript
ep_table_of_contents
# This must be run after installing the plugins, otherwise npm will try to
# hoist common dependencies by removing them from src/node_modules and
# installing them in the top-level node_modules. As of v6.14.10, npm's hoist
# logic appears to be buggy, because it sometimes removes dependencies from
# src/node_modules but fails to add them to the top-level node_modules. Even
# if npm correctly hoists the dependencies, the hoisting seems to confuse
# tools such as `npm outdated`, `npm update`, and some ESLint rules.
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
- name: export GIT_HASH to env
id: environment
run: echo "::set-output name=sha_short::$(git rev-parse --short ${{ github.sha }})"
- name: Create settings.json
run: cp settings.json.template settings.json
- name: Disable import/export rate limiting
run: |
sed -e '/^ *"importExportRateLimiting":/,/^ *\}/ s/"max":.*/"max": 0/' -i settings.json
# XXX we should probably run all tests, because plugins could effect their results
- name: Remove standard frontend test files, so only plugin tests are run
run: rm src/tests/frontend/specs/*
- uses: saucelabs/sauce-connect-action@v1
with:
username: ${{ secrets.SAUCE_USERNAME }}
accessKey: ${{ secrets.SAUCE_ACCESS_KEY }}
tunnelIdentifier: ${{ steps.sauce_strings.outputs.tunnel_id }}
- name: Run the frontend tests
shell: bash
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
SAUCE_NAME: ${{ steps.sauce_strings.outputs.name }}
TRAVIS_JOB_NUMBER: ${{ steps.sauce_strings.outputs.tunnel_id }}
GIT_HASH: ${{ steps.environment.outputs.sha_short }}
run: |
src/tests/frontend/travis/runner.sh

View File

@ -1,28 +0,0 @@
name: "Lint"
# any branch is useful for testing before a PR is submitted
on: [push, pull_request]
jobs:
lint-package-lock:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: package-lock.json
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Install lockfile-lint
run: npm install lockfile-lint
- name: Run lockfile-lint on package-lock.json
run: npx lockfile-lint --path src/package-lock.json --validate-https --allowed-hosts npm

View File

@ -1,111 +0,0 @@
name: "Loadtest"
# any branch is useful for testing before a PR is submitted
on: [push, pull_request]
jobs:
withoutplugins:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: without plugins
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
- name: Install etherpad-load-test
run: sudo npm install -g etherpad-load-test
- name: Run load test
run: src/tests/frontend/travis/runnerLoadTest.sh 25 50
withplugins:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: with Plugins
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Install etherpad-load-test
run: sudo npm install -g etherpad-load-test
- name: Install etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199
run: >
npm install --no-save --legacy-peer-deps
ep_align
ep_author_hover
ep_cursortrace
ep_font_size
ep_hash_auth
ep_headings2
ep_markdown
ep_readonly_guest
ep_set_title_on_pad
ep_spellcheck
ep_subscript_and_superscript
ep_table_of_contents
# This must be run after installing the plugins, otherwise npm will try to
# hoist common dependencies by removing them from src/node_modules and
# installing them in the top-level node_modules. As of v6.14.10, npm's hoist
# logic appears to be buggy, because it sometimes removes dependencies from
# src/node_modules but fails to add them to the top-level node_modules. Even
# if npm correctly hoists the dependencies, the hoisting seems to confuse
# tools such as `npm outdated`, `npm update`, and some ESLint rules.
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
# configures some settings and runs npm run test
- name: Run load test
run: src/tests/frontend/travis/runnerLoadTest.sh 25 50
long:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: long running
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
- name: Install etherpad-load-test
run: sudo npm install -g etherpad-load-test
# configures some settings and runs npm run test
- name: Run load test
run: src/tests/frontend/travis/runnerLoadTest.sh 5000 5

View File

@ -1,43 +0,0 @@
name: "rate limit"
# any branch is useful for testing before a PR is submitted
on: [push, pull_request]
jobs:
ratelimit:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: docker network
run: docker network create --subnet=172.23.42.0/16 ep_net
- name: build docker image
run: |
docker build -f Dockerfile -t epl-debian-slim .
docker build -f src/tests/ratelimit/Dockerfile.nginx -t nginx-latest .
docker build -f src/tests/ratelimit/Dockerfile.anotherip -t anotherip .
- name: run docker images
run: |
docker run --name etherpad-docker -p 9000:9001 --rm --network ep_net --ip 172.23.42.2 -e 'TRUST_PROXY=true' epl-debian-slim &
docker run -p 8081:80 --rm --network ep_net --ip 172.23.42.1 -d nginx-latest
docker run --rm --network ep_net --ip 172.23.42.3 --name anotherip -dt anotherip
- name: install dependencies and create symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
- name: run rate limit test
run: |
cd src/tests/ratelimit
./testlimits.sh

View File

@ -1,91 +0,0 @@
name: "Upgrade from latest release"
# any branch is useful for testing before a PR is submitted
on: [push, pull_request]
jobs:
withpluginsLinux:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: Linux with Plugins
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [12, 14, 16]
steps:
- name: Check out latest release
uses: actions/checkout@v2
with:
ref: master
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Install Etherpad plugins
# The --legacy-peer-deps flag is required to work around a bug in npm v7:
# https://github.com/npm/cli/issues/2199
run: >
npm install --no-save --legacy-peer-deps
ep_align
ep_author_hover
ep_cursortrace
ep_font_size
ep_hash_auth
ep_headings2
ep_image_upload
ep_markdown
ep_readonly_guest
ep_set_title_on_pad
ep_spellcheck
ep_subscript_and_superscript
ep_table_of_contents
# This must be run after installing the plugins, otherwise npm will try to
# hoist common dependencies by removing them from src/node_modules and
# installing them in the top-level node_modules. As of v6.14.10, npm's hoist
# logic appears to be buggy, because it sometimes removes dependencies from
# src/node_modules but fails to add them to the top-level node_modules. Even
# if npm correctly hoists the dependencies, the hoisting seems to confuse
# tools such as `npm outdated`, `npm update`, and some ESLint rules.
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
- name: Run the backend tests
run: cd src && npm test
# Because actions/checkout@v2 is called with "ref: master" and without
# "fetch-depth: 0", the local clone does not have the ${GITHUB_SHA} commit.
# Fetch ${GITHUB_REF} to get the ${GITHUB_SHA} commit. Note that a plain
# "git fetch" only fetches "normal" references (refs/heads/* and
# refs/tags/*), and for pull requests none of the normal references include
# ${GITHUB_SHA}, so we have to explicitly tell Git to fetch ${GITHUB_REF}.
- name: Fetch the new Git commits
run: git fetch --depth=1 origin "${GITHUB_REF}"
- name: Upgrade to the new Git revision
# For pull requests, ${GITHUB_SHA} is the automatically generated merge
# commit that merges the PR's source branch to its destination branch.
run: git checkout "${GITHUB_SHA}"
- name: Install all dependencies and symlink for ep_etherpad-lite
run: src/bin/installDeps.sh
- name: Run the backend tests
run: cd src && npm test
- name: Install Cypress
run: npm install cypress -g
- name: Run Etherpad & Test Frontend
run: |
node src/node/server.js &
curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9001/p/test
cd src/tests/frontend
cypress run --spec cypress/integration/test.js --config-file cypress/cypress.json

View File

@ -1,61 +0,0 @@
name: "Windows Installer"
# any branch is useful for testing before a PR is submitted
on: [push, pull_request]
jobs:
build:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: Build Zip & Exe
runs-on: windows-latest
steps:
- uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: >-
zip
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Install all dependencies and symlink for ep_etherpad-lite
shell: msys2 {0}
run: src/bin/installDeps.sh
- name: Run the backend tests
shell: msys2 {0}
run: cd src && npm test
- name: Build the .zip
shell: msys2 {0}
run: src/bin/buildForWindows.sh
- name: Extract the .zip into folder
run: 7z x etherpad-lite-win.zip -oetherpad-lite-new
- name: Grab nsis config
run: git clone https://github.com/ether/etherpad_nsis.git
- name: Create installer
uses: joncloud/makensis-action@v3.4
with:
script-file: 'etherpad_nsis/etherpad.nsi'
- name: Check something..
run: ls etherpad_nsis
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: etherpad-server-windows.exe
path: etherpad_nsis/etherpad-server-windows.exe

View File

@ -1,77 +0,0 @@
name: "Windows Zip"
# any branch is useful for testing before a PR is submitted
on: [push, pull_request]
jobs:
build:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: Build
runs-on: windows-latest
steps:
- uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: >-
zip
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 12
- name: Install all dependencies and symlink for ep_etherpad-lite
shell: msys2 {0}
run: src/bin/installDeps.sh
- name: Run the backend tests
shell: msys2 {0}
run: cd src && npm test
- name: Build the .zip
shell: msys2 {0}
run: src/bin/buildForWindows.sh
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: etherpad-lite-win.zip
path: etherpad-lite-win.zip
deploy:
# run on pushes to any branch
# run on PRs from external forks
if: |
(github.event_name != 'pull_request')
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
name: Deploy
needs: build
runs-on: windows-latest
steps:
- name: Download zip
uses: actions/download-artifact@v2
with:
name: etherpad-lite-win.zip
- name: Extract Etherpad
run: 7z x etherpad-lite-win.zip -oetherpad
- name: Install Cypress
run: npm install cypress -g
- name: Run Etherpad
run: |
cd etherpad
node node_modules\ep_etherpad-lite\node\server.js &
curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9001/p/test
cd src\tests\frontend
cypress run --spec cypress\integration\test.js --config-file cypress\cypress.json

View File

@ -1,115 +1,149 @@
'use strict';
describe('Plugins page', function () {
function timeout(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
before(async function () {
let success = false;
$.ajax({
url: `${location.protocol}//admin:changeme@${location.hostname}:${location.port}/admin`,
type: 'GET',
success: () => success = true,
});
await helper.waitForPromise(() => success === true);
});
// create a new pad before each test run
beforeEach(async function () {
helper.newAdmin('plugins');
await helper.waitForPromise(
() => helper.admin$ && helper.admin$('.menu').find('li').length >= 3, 30000);
});
it('Lists some plugins', async function () {
await helper.waitForPromise(() => helper.admin$('.results').children().length > 50, 20000);
});
it('Searches for plugin', async function () {
helper.admin$('#search-query').val('ep_font_color');
await helper.waitForPromise(() => helper.admin$('.results').children().length > 0, 10000);
await helper.waitForPromise(() => helper.admin$('.results').children().length < 300, 10000);
});
it('Attempt to Update a plugin', async function () {
this.timeout(280000);
await helper.waitForPromise(() => helper.admin$('.results').children().length > 50, 20000);
if (helper.admin$('.ep_align').length === 0) this.skip();
await helper.waitForPromise(
() => helper.admin$('.ep_align .version').text().split('.').length >= 2);
const minorVersionBefore =
parseInt(helper.admin$('.ep_align .version').text().split('.')[1]);
if (!minorVersionBefore) {
throw new Error('Unable to get minor number of plugin, is the plugin installed?');
}
if (minorVersionBefore !== 2) this.skip();
helper.waitForPromise(
() => helper.admin$('.ep_align .do-update').length === 1);
await timeout(500); // HACK! Please submit better fix..
const $doUpdateButton = helper.admin$('.ep_align .do-update');
$doUpdateButton.click();
// ensure its showing as Updating
await helper.waitForPromise(
() => helper.admin$('.ep_align .message').text() === 'Updating');
// Ensure it's a higher minor version IE 0.3.x as 0.2.x was installed
// Coverage for https://github.com/ether/etherpad-lite/issues/4536
await helper.waitForPromise(() => parseInt(helper.admin$(
'.ep_align .version'
)
.text()
.split('.')[1]) > minorVersionBefore, 60000, 1000);
// allow 50 seconds, check every 1 second.
});
it('Attempt to Install a plugin', async function () {
this.timeout(280000);
helper.admin$('#search-query').val('ep_headings2');
await helper.waitForPromise(() => helper.admin$('.results').children().length < 300, 6000);
await helper.waitForPromise(() => helper.admin$('.results').children().length > 0, 6000);
// skip if we already have ep_headings2 installed..
if (helper.admin$('.ep_headings2 .do-install').is(':visible') === false) this.skip();
helper.admin$('.ep_headings2 .do-install').click();
// ensure install has attempted to be started
await helper.waitForPromise(
() => helper.admin$('.ep_headings2 .do-install').length !== 0, 120000);
// ensure its not showing installing any more
await helper.waitForPromise(
() => helper.admin$('.ep_headings2 .message').text() === '', 180000);
// ensure uninstall button is visible
await helper.waitForPromise(
() => helper.admin$('.ep_headings2 .do-uninstall').length !== 0, 120000);
});
it('Attempt to Uninstall a plugin', async function () {
this.timeout(360000);
await helper.waitForPromise(
() => helper.admin$('.ep_headings2 .do-uninstall').length !== 0, 120000);
helper.admin$('.ep_headings2 .do-uninstall').click();
// ensure its showing uninstalling
await helper.waitForPromise(
() => helper.admin$('.ep_headings2 .message')
.text() === 'Uninstalling', 120000);
// ensure its gone
await helper.waitForPromise(
() => helper.admin$('.ep_headings2').length === 0, 240000);
helper.admin$('#search-query').val('ep_font');
await helper.waitForPromise(() => helper.admin$('.results').children().length < 300, 240000);
await helper.waitForPromise(() => helper.admin$('.results').children().length > 0, 1000);
});
});
diff --git a/src/tests/frontend/specs/adminupdateplugins.js b/src/tests/frontend/specs/adminupdateplugins.js
index cbb5f120..e69de29b 100755
--- a/src/tests/frontend/specs/adminupdateplugins.js
+++ b/src/tests/frontend/specs/adminupdateplugins.js
@@ -1,144 +0,0 @@
-'use strict';
-
-describe('Plugins page', function () {
- function timeout(ms) {
- return new Promise((resolve) => setTimeout(resolve, ms));
- }
-
- before(async function () {
- let success = false;
- $.ajax({
- url: `${location.protocol}//admin:changeme@${location.hostname}:${location.port}/admin`,
- type: 'GET',
- success: () => success = true,
- });
- await helper.waitForPromise(() => success === true);
- });
-
- // create a new pad before each test run
- beforeEach(async function () {
- helper.newAdmin('plugins');
- // menu is plugins, settings, help - so at least three entries atm
- await helper.waitForPromise(
- () => helper.admin$ && helper.admin$('.menu').find('li').length >= 3, 30000);
- });
-
- it('Lists some plugins assuming more than 50 available plugins', async function () {
- await helper.waitForPromise(() => helper.admin$('.results').children().length > 50, 20000);
- });
-
- it('Searches for plugin ep_font_color', async function () {
- helper.admin$('#search-query').val('ep_font_color');
- await helper.waitForPromise(() => helper.admin$('.results').children().length > 0, 10000);
- // multiple packages may be found
- await helper.waitForPromise(() => helper.admin$('.results').children().length < 20, 10000);
- await helper.waitForPromise(() => helper.admin$('.results .ep_font_color').length === 1, 10000);
- });
-
- it('Second search for ep_font_size does not return old result', async function () {
- helper.admin$('#search-query').val('ep_font_size');
- await helper.waitForPromise(() => helper.admin$('.results').children().length > 0, 10000);
- // multiple packages may be found
- await helper.waitForPromise(() => helper.admin$('.results').children().length < 20, 10000);
- await helper.waitForPromise(() => helper.admin$('.results .ep_font_size').length === 1, 10000);
- await helper.waitForPromise(() => helper.admin$('.results .ep_font_color').length === 0, 10000);
- });
-
- it('Searches for plugins ep_font_ (partial match)', async function () {
- helper.admin$('#search-query').val('ep_font');
- await helper.waitForPromise(() => helper.admin$('.results').children().length > 0, 10000);
- // multiple packages may be found
- await helper.waitForPromise(() => helper.admin$('.results').children().length < 50, 10000);
- await helper.waitForPromise(() => helper.admin$('.results .ep_font_size').length === 1, 10000);
- await helper.waitForPromise(() => helper.admin$('.results .ep_font_color').length === 1, 10000);
- });
-
- it('Attempt to Update a plugin (minor version update)', async function () {
- this.timeout(280000);
-
- // available plugin list should load
- await helper.waitForPromise(() => helper.admin$('.results').children().length > 50, 20000);
-
- // ep_align should be installed (via step in workflow)
- await helper.waitForPromise(() => helper.admin$('#installed-plugins .ep_align').length >= 1, 10000);
-
- let latestVersion;
- await helper.waitForPromise(
- () => {
- latestVersion = helper.admin$('#installed-plugins .ep_align .version').text();
- return latestVersion === '0.2.27';
- }
- );
-
- const minorVersionBefore =
- parseInt(latestVersion.split('.')[1]);
-
- await helper.waitForPromise(
- () => helper.admin$('#installed-plugins .ep_align .do-update').length === 1);
-
- helper.admin$('#installed-plugins .ep_align .do-update').click();
-
- // ensure its showing as Updating
- // this assumes that updating will take some time, so there is a message showing up
- // in the mean time
- await helper.waitForPromise(
- () => {
- const message = helper.admin$('#installed-plugins .ep_align .message').text();
- return message === 'Updating';
- }, 120000)
-
- // Ensure it's a higher minor version IE 0.3.x as 0.2.x was installed
- // Coverage for https://github.com/ether/etherpad-lite/issues/4536
- await helper.waitForPromise(() => parseInt(helper.admin$('#installed-plugins .ep_align .version')
- .text()
- .split('.')[1]) > minorVersionBefore, 60000, 1000);
-
- // ensure it's the latest version
- await helper.waitForPromise(
- () => helper.admin$('.ep_align .do-update').length === 0);
- });
-
- it('Attempt to Install a plugin', async function () {
- this.timeout(280000);
-
- helper.admin$('#search-query').val('ep_headings2');
- await helper.waitForPromise(() => helper.admin$('.results').children().length > 0, 10000);
- await helper.waitForPromise(() => helper.admin$('.results').children().length < 50, 10000);
-
- helper.admin$('.ep_headings2 .do-install').click();
- // ensure install has attempted to be started
- await helper.waitForPromise(
- () => helper.admin$('.ep_headings2 .do-install').length > 0, 120000);
- // ensure its not showing installing any more
- await helper.waitForPromise(
- () => helper.admin$('.ep_headings2 .message').text() === '', 180000);
- // ensure uninstall button is visible
- await helper.waitForPromise(
- () => helper.admin$('#installed-plugins .ep_headings2 .do-uninstall').length > 0, 120000);
- });
-
- it('Attempt to Uninstall a plugin', async function () {
- this.timeout(280000);
-
- await helper.waitForPromise(
- () => helper.admin$('#installed-plugins .ep_headings2 .do-uninstall').length > 0, 120000);
-
- helper.admin$('#installed-plugins .ep_headings2 .do-uninstall').click();
-
- // ensure its showing uninstalling
- // this assumes that uninstalling will take some time, so there is a message showing up
- // in the mean time
- await helper.waitForPromise(
- () => helper.admin$('#installed-plugins .ep_headings2 .message')
- .text() === 'Uninstalling', 120000);
- // ensure its gone
- await helper.waitForPromise(() => helper.admin$('#installed-plugins .ep_headings2').length === 0, 200000);
-
- // ensure search still works
- helper.admin$('#search-query').val('ep_font');
- await helper.waitForPromise(() => helper.admin$('.results').children().length < 50, 240000);
- await helper.waitForPromise(() => helper.admin$('.results').children().length > 0, 1000);
- await helper.waitForPromise(() => helper.admin$('.results .ep_font_size').length === 1, 10000);
- await helper.waitForPromise(() => helper.admin$('.results .ep_font_color').length === 1, 10000);
- });
-});