Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .circleci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -e

cd test

docker-compose build \
--build-arg NODE_VERSION=$NODE_VERSION \
test-unit \
test-helpers \
test-acceptance.webdriverio \
test-acceptance.nightmare \
json_server

docker-compose pull \
php \
selenium.chrome
35 changes: 35 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 2

defaults: &defaults
machine:
image: circleci/classic:201710-02
docker_layer_caching: true
steps:
- checkout
- run: .circleci/build.sh
- run: .circleci/test.sh

jobs:
node 6.9.5:
<<: *defaults
environment:
- NODE_VERSION: 6.9.5

node 8.9.1:
<<: *defaults
environment:
- NODE_VERSION: 8.9.1

node 9.2.0:
<<: *defaults
environment:
- NODE_VERSION: 9.2.0

workflows:
version: 2

test_all:
jobs:
- node 6.9.5
- node 8.9.1
- node 9.2.0
11 changes: 11 additions & 0 deletions .circleci/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -e

cd test

docker-compose run --rm test-unit
docker-compose run --rm test-helpers test/helper
docker-compose run --rm test-helpers test/rest
docker-compose run --rm test-acceptance.webdriverio
docker-compose run --rm test-acceptance.nightmare
5 changes: 1 addition & 4 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ module.exports.test = {
}
return data;
};
},

expectError: function () {
throw new Error('should not be thrown');
}

};
1 change: 0 additions & 1 deletion test/helper/AppiumWeb_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ let path = require('path');
let fs = require('fs');
let fileExists = require('../../lib/utils').fileExists;
let AssertionFailedError = require('../../lib/assert/error');
let expectError = require('../../lib/utils').test.expectError;
let webApiTests = require('./webapi');
let within = require('../../lib/within')
require('co-mocha')(require('mocha'));
Expand Down
11 changes: 1 addition & 10 deletions test/helper/Appium_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ let path = require('path');
let fs = require('fs');
let fileExists = require('../../lib/utils').fileExists;
let AssertionFailedError = require('../../lib/assert/error');
let expectError = require('../../lib/utils').test.expectError;
require('co-mocha')(require('mocha'));

let apk_path = 'https://github.com/Codeception/CodeceptJS/raw/Appium/test/data/mobile/selendroid-test-app-0.17.0.apk'
Expand Down Expand Up @@ -102,13 +101,11 @@ describe('Appium', function () {

it('should assert when app is/is not installed', () => {
return app.seeAppIsInstalled("io.super.app")
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.include('expected app io.super.app to be installed');
})
.then(() => app.seeAppIsNotInstalled("io.selendroid.testapp"))
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.include('expected app io.selendroid.testapp not to be installed');
Expand All @@ -124,7 +121,6 @@ describe('Appium', function () {

it('should assert for wrong screen', () => {
return app.seeCurrentActivityIs(".SuperScreen")
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.include('expected current activity to be .SuperScreen');
Expand All @@ -137,7 +133,6 @@ describe('Appium', function () {
it('should return correct status about lock @second', () => {
return app.seeDeviceIsUnlocked()
.then(() => app.seeDeviceIsLocked())
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.include('expected device to be locked');
Expand All @@ -150,7 +145,6 @@ describe('Appium', function () {
it('should return correct status about lock', () => {
return app.seeOrientationIs('PORTRAIT')
.then(() => app.seeOrientationIs('LANDSCAPE'))
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.include('expected orientation to be LANDSCAPE');
Expand Down Expand Up @@ -217,7 +211,6 @@ describe('Appium', function () {
it('should hide device Keyboard @quick', () => {
return app.click('~startUserRegistrationCD')
.then(() => app.click('//android.widget.CheckBox'))
.then(expectError)
.catch((e) => {
e.message.should.include('Clickable element android.widget.CheckBox was not found by text|CSS|XPath');
})
Expand All @@ -226,7 +219,7 @@ describe('Appium', function () {
});

it('should assert if no keyboard', () => {
return app.hideDeviceKeyboard('pressKey', 'Done').then(expectError)
return app.hideDeviceKeyboard('pressKey', 'Done')
.catch((e) => {
e.message.should.include(
'An unknown server-side error occurred while processing the command. Original error: Soft keyboard not present, cannot hide keyboard');
Expand All @@ -248,7 +241,6 @@ describe('Appium', function () {

it('should react on notification opening', () => {
return app.seeElement('//android.widget.FrameLayout[@resource-id="com.android.systemui:id/quick_settings_container"]')
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.include('expected elements of //android.widget.FrameLayout[@resource-id="com.android.systemui:id/quick_settings_container"] to be seen');
Expand Down Expand Up @@ -425,7 +417,6 @@ describe('Appium', function () {
describe('#waitForText', () => {
it('should return error if not present', () => {
return app.waitForText('Nothing here', 1, '~buttonTestCD')
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.be.equal('expected element ~buttonTestCD to include "Nothing here"');
Expand Down
5 changes: 0 additions & 5 deletions test/helper/Nightmare_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ let fs = require('fs');
let fileExists = require('../../lib/utils').fileExists;
let AssertionFailedError = require('../../lib/assert/error');
let formContents = require('../../lib/utils').test.submittedData(path.join(__dirname, '/../data/app/db'));
let expectError = require('../../lib/utils').test.expectError;
require('co-mocha')(require('mocha'));
let webApiTests = require('./webapi');

Expand Down Expand Up @@ -88,7 +87,6 @@ describe('Nightmare', function () {
it('should fail when text is not on site', () => {
return I.amOnPage('/')
.then(() => I.see('Something incredible!'))
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.include('web application');
Expand All @@ -99,7 +97,6 @@ describe('Nightmare', function () {
it('should fail when clickable element not found', () => {
return I.amOnPage('/')
.then(() => I.click('Welcome'))
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(Error);
e.message.should.include('Clickable');
Expand All @@ -109,7 +106,6 @@ describe('Nightmare', function () {
it('should fail when text on site', () => {
return I.amOnPage('/')
.then(() => I.dontSee('Welcome'))
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.include('web application');
Expand All @@ -119,7 +115,6 @@ describe('Nightmare', function () {
it('should fail when test is not in context', () => {
return I.amOnPage('/')
.then(() => I.see('debug', {css: 'a'}))
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.toString().should.not.include('web page');
Expand Down
4 changes: 0 additions & 4 deletions test/helper/Protractor_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ var expect = chai.expect;
let AssertionFailedError = require('../../lib/assert/error');
let formContents = require('../../lib/utils').test.submittedData(path.join(__dirname, '/../data/app/db'));
let fileExists = require('../../lib/utils').fileExists;
let expectError = require('../../lib/utils').test.expectErrors;

require('co-mocha')(require('mocha'));

Expand Down Expand Up @@ -281,7 +280,6 @@ describe('Protractor', function() {
it('should throw error if field is not empty', function*() {
yield I.amOnPage('/#/options');
return I.seeInField('#ssh', 'something')
.then(expectError)
.catch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.be.equal('expected field by #ssh to include "something"');
Expand Down Expand Up @@ -475,7 +473,6 @@ describe('Protractor', function() {
it('should return error if not present', function*() {
if (I.isProtractor5) return;
return I.waitForText('Nothing here', 0, '#hello')
.then(expectError)
.thenCatch((e) => {
e.message.should.include('Wait timed out');
});
Expand All @@ -484,7 +481,6 @@ describe('Protractor', function() {
it('should return error if waiting is too small', function*() {
if (I.isProtractor5) return;
return I.waitForText('Boom!', 0.5)
.then(expectError)
.thenCatch((e) => {
e.message.should.include('Wait timed out');
});
Expand Down
4 changes: 0 additions & 4 deletions test/helper/SeleniumWebdriver_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ let fs = require('fs');
let fileExists = require('../../lib/utils').fileExists;
let AssertionFailedError = require('../../lib/assert/error');
let formContents = require('../../lib/utils').test.submittedData(path.join(__dirname, '/../data/app/db'));
let expectError = require('../../lib/utils').test.expectError;
require('co-mocha')(require('mocha'));
let webApiTests = require('./webapi');

Expand Down Expand Up @@ -86,7 +85,6 @@ describe('SeleniumWebdriver', function () {
it('should fail when text is not on site', () => {
return I.amOnPage('/')
.then(() => I.see('Something incredible!'))
.then(expectError)
.thenCatch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.include('web application');
Expand All @@ -96,7 +94,6 @@ describe('SeleniumWebdriver', function () {
it('should fail when text on site', () => {
return I.amOnPage('/')
.then(() => I.dontSee('Welcome'))
.then(expectError)
.thenCatch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.inspect().should.include('web application');
Expand All @@ -106,7 +103,6 @@ describe('SeleniumWebdriver', function () {
it('should fail when test is not in context', () => {
return I.amOnPage('/')
.then(() => I.see('debug', {css: 'a'}))
.then(expectError)
.thenCatch((e) => {
e.should.be.instanceOf(AssertionFailedError);
e.toString().should.not.include('web page');
Expand Down
Loading