-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Selenium-powered.
- Loading branch information
Showing
13 changed files
with
554 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
|
||
dist: trusty | ||
sudo: false | ||
sudo: true | ||
language: node_js | ||
|
||
node_js: "8" | ||
|
||
cache: yarn | ||
cache: | ||
yarn: true | ||
directories: | ||
- server/node_modules | ||
- client/node_modules | ||
|
||
env: | ||
- NODE_ENV=development | ||
- NODE_ENV=development GTSEARCH_SERVER_HOST_FROM_SELENIUM=192.168.0.1 | ||
|
||
install: | ||
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.27.5 | ||
- export PATH="$HOME/.yarn/bin:$PATH" | ||
- cd client && yarn && cd .. | ||
- cd server && yarn | ||
|
||
script: | ||
- docker network create -d bridge --subnet 192.168.0.0/24 --gateway 192.168.0.1 dockernet | ||
- docker run --net dockernet --rm -v /dev/shm:/dev/shm --name selenium -d -p 4444:4444 selenium/standalone-chrome | ||
- cd ../client && yarn run build && cd ../server | ||
- yarn run test |
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,34 @@ | ||
version: '3' | ||
services: | ||
|
||
client: | ||
build: | ||
context: ./client/ | ||
dockerfile: Dockerfile.dev | ||
volumes: | ||
- ./client/src:/gs/client/src:ro | ||
- client-dist:/gs/client/dist | ||
|
||
server: | ||
environment: | ||
- "GTSEARCH_ADDRESS=0.0.0.0" | ||
- "GTSEARCH_PORT=80" | ||
- "GTSEARCH_SELENIUM_HOST=selenium" | ||
build: | ||
context: ./server/ | ||
dockerfile: Dockerfile.dev | ||
volumes: | ||
- ./server/src:/gs/server/src:ro | ||
- ./client/index.html:/gs/client/index.html:ro | ||
- client-dist:/gs/client/dist:ro | ||
ports: | ||
- "8081:80" | ||
command: sleep infinity | ||
|
||
selenium: | ||
image: selenium/standalone-chrome | ||
volumes: | ||
- /dev/shm:/dev/shm | ||
|
||
volumes: | ||
client-dist: |
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
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,32 @@ | ||
|
||
const createSearches = require('./searches') | ||
const {dummyLogger} = require('./log') | ||
const createDb = require('./db') | ||
const createClones = require('./clones') | ||
const serve = require('./serve') | ||
|
||
module.exports = async () => { | ||
const address = '0.0.0.0' | ||
const port = 8081 | ||
|
||
const db = await createDb('test') | ||
await db._db.truncateTables() | ||
await db.setupAdmin() | ||
|
||
const adminPassword = await db.resetAdminPassword() | ||
const clones = createClones('test-clones') | ||
const searches = createSearches() | ||
const log = dummyLogger | ||
|
||
const server = await serve({ | ||
db, clones, searches, log, | ||
address, port, | ||
}) | ||
|
||
return { | ||
adminPassword, | ||
db, clones, searches, log, | ||
server, | ||
address, port, | ||
} | ||
} |
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,50 @@ | ||
|
||
const {assert} = require('chai') | ||
const wdio = require('webdriverio') | ||
|
||
const createTestServer = require('../create-test-server') | ||
|
||
describe('e2e', function () { | ||
this.timeout(1000 * 1000) | ||
|
||
let client | ||
let serverConfig | ||
|
||
const serverHostFormSelenium = process.env.GTSEARCH_SERVER_HOST_FROM_SELENIUM || 'server' | ||
|
||
const navigate = (path = '') => | ||
client.url('http://' + serverHostFormSelenium + ':' + serverConfig.port) | ||
|
||
before(async () => { | ||
serverConfig = await createTestServer() | ||
|
||
client = wdio.remote({ | ||
host: process.env.GTSEARCH_SELENIUM_HOST || 'localhost', | ||
port: ~~process.env.GTSEARCH_SELENIUM_PORT || 4444, | ||
desiredCapabilities: { | ||
browserName: 'chrome', | ||
}, | ||
}) | ||
|
||
await client.init() | ||
}) | ||
|
||
after(async () => { | ||
serverConfig.server.close() | ||
await client.endAll() | ||
}) | ||
|
||
it('loads properly the index page', | ||
() => { | ||
return navigate() | ||
.getTitle().then(title => assert(title === 'gtsearch')) | ||
.getText('h1').then(text => assert(text === 'repositories')) | ||
} | ||
) | ||
|
||
it('clones a repository') | ||
|
||
it('pulls an existing repository') | ||
|
||
it('searches in a repository') | ||
}) |
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.