Skip to content

Commit

Permalink
upgrade nightwatch and switch from Travis to GH Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fryjordan committed Apr 21, 2022
1 parent 1307071 commit 5ed726b
Show file tree
Hide file tree
Showing 40 changed files with 1,090 additions and 1,164 deletions.
1 change: 0 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Default environment variables for the Docker Compose files in /docker
# This file needs to be placed where the docker-compose command is run from.

# Used to provide a CouchDB 2 / 3 build matrix in .travis.yml
COUCHDB_IMAGE=apache/couchdb3
72 changes: 72 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: CI
on: [push]
jobs:
run-unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install npm packages
run: |
npm install -g npm@latest
npm ci
npm ls --production --depth=0
- name: Run style check
run: npm run stylecheck
- name: Run unit tests
run: npm run test
run-e2e-tests:
name: Run e2e tests
runs-on: ubuntu-latest
needs: [run-unit-tests]
strategy:
matrix:
include:
- COUCHDB_IMAGE: apache/couchdb:3
NIGHTWATCH_SKIPTAGS: "search,nonpartitioned,couchdb-v2-only"
- COUCHDB_IMAGE: apache/couchdb:2.3.1
NIGHTWATCH_SKIPTAGS: "search,partitioned"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
- run: ./bin/build-couchdb-dev.sh
env:
COUCHDB_IMAGE: ${{ matrix.COUCHDB_IMAGE }}
NIGHTWATCH_SKIPTAGS: ${{ matrix.NIGHTWATCH_SKIPTAGS }}
- name: Install npm packages
run: |
npm install -g npm@latest
npm ci
npm ls --production --depth=0
- name: Start CouchDB
env:
COUCHDB_IMAGE: ${{ matrix.COUCHDB_IMAGE }}
NIGHTWATCH_SKIPTAGS: ${{ matrix.NIGHTWATCH_SKIPTAGS }}
run: |
./bin/docker-up-and-check.sh
curl http:https://127.0.0.1:5984
- name: Configure display
run: |
export DISPLAY=:99
sudo apt-get install xvfb
- name: Start Fauxton
env:
COUCHDB_IMAGE: ${{ matrix.COUCHDB_IMAGE }}
NIGHTWATCH_SKIPTAGS: ${{ matrix.NIGHTWATCH_SKIPTAGS }}
run: |
grunt debugDev && DIST=./dist/debug ./bin/fauxton &
sleep 60
curl http:https://localhost:8000
- name: Run e2e tests
env:
COUCHDB_IMAGE: ${{ matrix.COUCHDB_IMAGE }}
NIGHTWATCH_SKIPTAGS: ${{ matrix.NIGHTWATCH_SKIPTAGS }}
run: xvfb-run --auto-servernum ./node_modules/.bin/grunt nightwatch_retries
- name: Shutdown CouchDB
run: npm run docker:down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.log
node_modules
dist
build
Expand Down
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ module.exports = {
.loginToGUI()

// delete the document manually. This'll ensure the database page has at least one "!" icon
.waitForElementPresent('#dashboard-content a[href="database/' + newDatabaseName + '/_all_docs"]', waitTime, false)
.click('#dashboard-content a[href="database/' + newDatabaseName + '/_all_docs"]')
.clickWhenVisible('#dashboard-content a[href="database/' + newDatabaseName + '/_all_docs"]', waitTime, false)

//this opens the alternative header
.clickWhenVisible('.tableview-checkbox-cell input[type="checkbox"]')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = {
.clickWhenVisible('#js-create-database', waitTime, false)
.waitForElementNotPresent('.new-database-tray', waitTime, false)
.checkForDatabaseCreated(newDatabaseName, waitTime)
.url(baseUrl + '/_all_dbs')
.url(baseUrl + '/#/_all_dbs')
.waitForElementVisible('html', waitTime, false)
.getText('html', function (result) {
var data = result.value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {

.waitForElementVisible('.database-load-fail', waitTime, false)
.waitForElementVisible('[data-name="database-load-fail-name"]', waitTime, false)
.assert.containsText('[data-name="database-load-fail-name"]', '_global_changes')
.assert.textContains('[data-name="database-load-fail-name"]', '_global_changes')

.end();
}
Expand Down
4 changes: 2 additions & 2 deletions app/addons/databases/tests/nightwatch/specialCharListLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ function createTest (db) {
.waitForElementVisible('.faux-header__doc-header-title', waitTime, false)
.waitForElementVisible('.no-results-screen', waitTime, false)

.assert.containsText('.no-results-screen', 'No Documents Found')
.assert.containsText('.faux-header__doc-header-title', db)
.assert.textContains('.no-results-screen', 'No Documents Found')
.assert.textContains('.faux-header__doc-header-title', db)
.end();
};
}
8 changes: 6 additions & 2 deletions app/addons/databases/tests/nightwatch/switchDatabase.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.


const {Key} = require('selenium-webdriver');

module.exports = {
'Confirm selecting database via typeahead redirects properly': function (client) {
Expand All @@ -32,7 +32,11 @@ module.exports = {
.clickWhenVisible('[data-name="jump-to-db"] .Select-placeholder')
.setValue('[data-name="jump-to-db"] input', [newDatabaseName])
.waitForElementPresent('.Select-option', waitTime, false)
.keys([client.Keys.ENTER])
.perform(function() {
const actions = this.actions({async: true});
return actions
.sendKeys(Key.ENTER);
})
.waitForElementPresent('.index-pagination', waitTime, false)
// now check we've redirected and the URL ends with /_all_docs
.url((result) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ export default class DocEditorScreen extends React.Component {
};

onSaveComplete = () => {
this.getEditor().clearChanges();
if (this.getEditor()) {
this.getEditor().clearChanges();
}
};

hideDeleteDocModal = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = {
.clickWhenVisible('span[title="_design/' + docSpecialChars + '"]')
.assert.visible('a[href="#/database/' + newDatabaseName + '/_design/' + docSpecialCharsEncoded + '/_info"]')
// Verify display name is not encoded
.assert.containsText('span[title="_design/' + docSpecialChars + '"]', docSpecialChars)
.assert.textContains('span[title="_design/' + docSpecialChars + '"]', docSpecialChars)
.end();
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = {
.waitForElementNotPresent('#string-editor-container', waitTime, false)
//Check value has changed in the maind editor
.waitForElementPresent('#editor-container', waitTime, false)
.assert.containsText('span.ace_string', '"' + newDocumentName + '"')
.assert.textContains('span.ace_string', '"' + newDocumentName + '"')
.end();
}
};
2 changes: 1 addition & 1 deletion app/addons/documents/tests/nightwatch/jsonView.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = {
.waitForElementPresent('.doc-item', client.globals.maxWaitTime, false)
// by default include_docs is on, so check "American Bittern" does exist in the DOM
.waitForElementPresent('.prettyprint', client.globals.maxWaitTime, false)
.assert.containsText('.prettyprint', 'American Bittern')
.assert.textContains('.prettyprint', 'American Bittern')
.end();
}
};
Expand Down
4 changes: 2 additions & 2 deletions app/addons/documents/tests/nightwatch/mangoIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = {
.checkForStringPresent(newDatabaseName + '/_index', 'rocko-artischocko')
.checkForStringPresent(newDatabaseName + '/_index', 'gans_gans_mango')
.waitForElementPresent('.prettyprint', waitTime, false)
.assert.containsText('#dashboard-lower-content', 'gans_gans_mango')
.assert.textContains('#dashboard-lower-content', 'gans_gans_mango')
.end();
},

Expand All @@ -56,7 +56,7 @@ module.exports = {
.loginToGUI()
.url(baseUrl + '/#/database/' + newDatabaseName + '/_index')
.waitForElementPresent('#doc-list', waitTime, false)
.assert.containsText('#dashboard-lower-content', 'ente_ente_mango_ananas')
.assert.textContains('#dashboard-lower-content', 'ente_ente_mango_ananas')
.clickWhenVisible('.bulk-action-component-panel input[type="checkbox"]')
.clickWhenVisible('.bulk-action-component-selector-group button.fonticon-trash', waitTime, false)
.acceptAlert()
Expand Down
4 changes: 2 additions & 2 deletions app/addons/documents/tests/nightwatch/mangoQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ module.exports = {
.clickWhenVisible('.fonticon-json')

.waitForElementPresent('.prettyprint', waitTime, false)
.assert.containsText('#dashboard-lower-content', 'number')
.assert.containsText('#dashboard-lower-content', 'ente_ente_mango_ananas_res')
.assert.textContains('#dashboard-lower-content', 'number')
.assert.textContains('#dashboard-lower-content', 'ente_ente_mango_ananas_res')
.end();
}
};
4 changes: 2 additions & 2 deletions app/addons/documents/tests/nightwatch/navigateNotFoundDB.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ module.exports = {
.url(baseUrl + '/#/database/does-not-exist/_all_docs')
.waitForElementVisible('.Toastify__toast-container .Toastify__toast--error', waitTime, false)
// We wait for the first toasts to be cleared
.pause(1000)
.pause(3000)
.waitForElementVisible('.Toastify__toast-container .Toastify__toast--error', waitTime, false)
.assert.containsText('.Toastify__toast-container .Toastify__toast--error .Toastify__toast-body', 'does not exist')
.assert.textContains('.Toastify__toast-container .Toastify__toast--error .Toastify__toast-body', 'does not exist')
.verify.urlEquals(baseUrl + '/#');
}
};
30 changes: 10 additions & 20 deletions app/addons/documents/tests/nightwatch/paginateAllDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
// License for the specific language governing permissions and limitations under
// the License.



module.exports = {

'change number of items per page': function (client) {
/*jshint multistr: true */
var waitTime = client.globals.maxWaitTime,
Expand All @@ -25,16 +22,9 @@ module.exports = {
.loginToGUI()
.url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
.clickWhenVisible('.fonticon-json')

// ensures the main body (results list) has been rendered
.waitForElementPresent('.prettyprint', waitTime, false)

// ensures the select dropdown is rendered
.clickWhenVisible('#select-per-page', waitTime, false)

// hack to get select working by clicking on it and using keyboard to select
// http:https://www.w3.org/TR/2012/WD-webdriver-20120710/
.keys(['\uE013', '\uE006'])
.clickWhenVisible('select[id="select-per-page"] option[value="10"]')
.waitForElementPresent('.prettyprint', waitTime, false)
.waitForElementNotPresent('div[data-id="document_16"]', waitTime)
.waitForElementPresent('.doc-row', waitTime, false)
Expand Down Expand Up @@ -63,9 +53,8 @@ module.exports = {
// ensures the main body (results list) has been rendered
.waitForElementPresent('.prettyprint', waitTime, false)

.clickWhenVisible('#select-per-page', waitTime, false)
// http:https://www.w3.org/TR/2012/WD-webdriver-20120710/
.keys(['\uE013', '\uE006'])
.clickWhenVisible('select[id="select-per-page"] option[value="10"]')

.waitForElementNotPresent('.loading-lines', waitTime, false)
.waitForElementNotPresent('div[data-id="document_16"]', waitTime)
.clickWhenVisible('#next', waitTime, false)
Expand All @@ -91,17 +80,17 @@ module.exports = {

// ensures the main body (results list) has been rendered
.waitForElementPresent('.prettyprint', waitTime, false)
// moving from '20'
.clickWhenVisible('select[id="select-per-page"] option[value="10"]')

.clickWhenVisible('#select-per-page', waitTime, false)
// http:https://www.w3.org/TR/2012/WD-webdriver-20120710/
.keys(['\uE013', '\uE006'])
.waitForElementNotPresent('.loading-lines', waitTime, false)
.waitForElementNotPresent('div[data-id="document_16"]', waitTime)
.clickWhenVisible('#next', waitTime, false)
.waitForElementPresent('div[data-id="document_17"]', waitTime)
.clickWhenVisible('#select-per-page', waitTime, false)
// http:https://www.w3.org/TR/2012/WD-webdriver-20120710/
.keys(['\uE013', '\uE006'])
// moving from '10'
.clickWhenVisible('select[id="select-per-page"] option[value="5"]')

.waitForElementPresent('div[data-id="document_1"]', waitTime)
.end();
},
Expand All @@ -123,7 +112,8 @@ module.exports = {

.clickWhenVisible('#select-per-page', waitTime, false)
// http:https://www.w3.org/TR/2012/WD-webdriver-20120710/
.keys(['\uE013', '\uE006'])
// moving from '20'
.clickWhenVisible('select[id="select-per-page"] option[value="10"]')
.waitForElementNotPresent('.loading-lines', waitTime, false)
.waitForElementNotPresent('td[title="document_16"]', waitTime)
.clickWhenVisible('#next', waitTime, false)
Expand Down
27 changes: 10 additions & 17 deletions app/addons/documents/tests/nightwatch/paginateView.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ module.exports = {
.waitForElementPresent('.prettyprint', waitTime, false)

.waitForElementPresent('#select-per-page', waitTime, false)
.clickWhenVisible('#select-per-page', waitTime, false)

// hack to get select working by clicking on it and using keyboard to select
// http:https://www.w3.org/TR/2012/WD-webdriver-20120710/
.keys(['\uE013', '\uE006'])
// from '20'
.clickWhenVisible('select[id="select-per-page"] option[value="10"]')
.waitForElementPresent('.prettyprint', waitTime, false)
.waitForElementNotPresent('div[data-id="document_9"]', waitTime)
.execute(function () {
Expand Down Expand Up @@ -69,10 +67,9 @@ module.exports = {
// ensure the page content has loaded
.waitForElementPresent('.prettyprint', waitTime, false)

.clickWhenVisible('#select-per-page', waitTime, false)
// from '20'
.clickWhenVisible('select[id="select-per-page"] option[value="10"]')

// http:https://www.w3.org/TR/2012/WD-webdriver-20120710/
.keys(['\uE013', '\uE006'])
.waitForElementNotPresent('.loading-lines', waitTime, false)
.waitForElementPresent('#next', waitTime, false)
.clickWhenVisible('#next', waitTime, false)
Expand Down Expand Up @@ -104,19 +101,16 @@ module.exports = {

// ensure the page content has loaded
.waitForElementPresent('.prettyprint', waitTime, false)
.clickWhenVisible('#select-per-page', waitTime, false)

// http:https://www.w3.org/TR/2012/WD-webdriver-20120710/
.keys(['\uE013', '\uE006'])
// from '20'
.clickWhenVisible('select[id="select-per-page"] option[value="10"]')
.waitForElementNotPresent('.loading-lines', waitTime, false)

.clickWhenVisible('#next', waitTime, false)
.waitForElementNotPresent('div[data-id="document_1"]', waitTime)
.waitForElementNotPresent('.loading-lines', waitTime, false)

.clickWhenVisible('#select-per-page', waitTime, false)
// http:https://www.w3.org/TR/2012/WD-webdriver-20120710/
.keys(['\uE013', '\uE006'])
// from '10'
.clickWhenVisible('select[id="select-per-page"] option[value="5"]')

.waitForElementPresent('div[data-id="document_1"]', waitTime)
.end();
Expand All @@ -140,10 +134,9 @@ module.exports = {
// ensure the page content has loaded
.waitForElementPresent('.table-view-docs', waitTime)

.clickWhenVisible('#select-per-page', waitTime, false)
// from '20'
.clickWhenVisible('select[id="select-per-page"] option[value="10"]')

// http:https://www.w3.org/TR/2012/WD-webdriver-20120710/
.keys(['\uE013', '\uE006'])
.waitForElementNotPresent('.loading-lines', waitTime, false)
.waitForElementPresent('#next', waitTime, false)
.clickWhenVisible('#next', waitTime, false)
Expand Down
Loading

0 comments on commit 5ed726b

Please sign in to comment.