mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-03-14 15:09:59 -04:00
Merge pull request #1910 from LLK/travis
Run smoke tests with Travis after deployment
This commit is contained in:
commit
5124c613db
4 changed files with 62 additions and 25 deletions
54
.travis.yml
54
.travis.yml
|
@ -18,6 +18,12 @@ env:
|
|||
- API_HOST_VAR=API_HOST_$TRAVIS_BRANCH
|
||||
- API_HOST=${!API_HOST_VAR}
|
||||
- API_HOST=${API_HOST:-$API_HOST_STAGING}
|
||||
- ROOT_URL_master=https://scratch.mit.edu
|
||||
- ROOT_URL_STAGING=https://scratch.ly
|
||||
- ROOT_URL_VAR=ROOT_URL_$TRAVIS_BRANCH
|
||||
- ROOT_URL=${!ROOT_URL_VAR}
|
||||
- ROOT_URL=${ROOT_URL:-$ROOT_URL_STAGING}
|
||||
- PATH=$PATH:$PWD/test/integration/node_modules/chromedriver/bin
|
||||
# EB_AWS_ACCESS_KEY_ID
|
||||
- secure: A138rYuXDsOmpEwYxZ31WyXEeq5fgr9qyqsQh1nTFsjBKpFtNM+CN9e0QJQFT3PLs4wH/lWTRSyHxakxKQS1sxq828f9gHed+f15REKk/fRUplcCYIexT9xKVtU3D8CRNn/KBFWk75fZyZt20eyOVIv4h3pInKQz7y84J6PWzB1BCrAFvADrzS1X68Z3NJJLyxnz0YEurzz8mC2v4D0s/XifKTWvRtefD4QM6pE0C2iYyk+ThrLwg7i9FDHVfo0MrkgcdX7mz37SnTr7p7mHWnGXrGngi/NiDRQ+Uwwq/sr2UIww0rCwS1xsOcS//dC4NNqrrt1kUTsoC1Yt87Ny+gI0nUplsfEpdKajAkOYdANC5bJUGqPdSlOds1v9aJs9Hx48uGamWkm/3cFmoJ5uA2ZzUwbSGjTkWbnhwzT0YRvcLGhP1WE/EswaIyK5qMp522E79mP1yH6M750iUvi4N39+QW1BNX3ADkOwyAI67ArX5on5gWP83RXcJ15im7XsBpsmVn/KXi6AouWPb8jmSmKCj0QZCzfLY7ivM42IugYpK2NV7kFB38DpXQamJ5eskgwYa3elRmednIFUuwb1QDnONvJogVjk4CLmoSxssC2mJnnrUItM7l8G6As81GMI+6lTtl86hAuXBjUk60FMbgTAQDX9ll26LgpBy8jHSx8=
|
||||
# EB_AWS_SECRET_ACCESS_KEY
|
||||
|
@ -58,6 +64,7 @@ env:
|
|||
- NODE_ENV=production
|
||||
- WWW_VERSION=${TRAVIS_COMMIT:0:5}
|
||||
addons:
|
||||
chrome: stable
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
|
@ -66,20 +73,33 @@ addons:
|
|||
install:
|
||||
- sudo -H pip install -r requirements.txt
|
||||
- npm --production=false install
|
||||
deploy:
|
||||
- provider: script
|
||||
skip_cleanup: $SKIP_CLEANUP
|
||||
script: env make sync
|
||||
on:
|
||||
repo: LLK/scratch-www
|
||||
branch:
|
||||
- develop
|
||||
- hotfix/*
|
||||
- release/*
|
||||
- provider: script
|
||||
skip_cleanup: $SKIP_CLEANUP
|
||||
script: env make sync
|
||||
on:
|
||||
repo: LLK/scratch-www
|
||||
branch:
|
||||
- master
|
||||
jobs:
|
||||
include:
|
||||
- stage: test
|
||||
deploy:
|
||||
- provider: script
|
||||
skip_cleanup: $SKIP_CLEANUP
|
||||
script: env make sync
|
||||
on:
|
||||
repo: LLK/scratch-www
|
||||
branch:
|
||||
- develop
|
||||
- hotfix/*
|
||||
- release/*
|
||||
- provider: script
|
||||
skip_cleanup: $SKIP_CLEANUP
|
||||
script: env make sync
|
||||
on:
|
||||
repo: LLK/scratch-www
|
||||
branch:
|
||||
- master
|
||||
- stage: smoke
|
||||
install:
|
||||
- cd test/integration
|
||||
- npm install
|
||||
- cd -
|
||||
script: npm run smoke
|
||||
stages:
|
||||
- test
|
||||
- name: smoke
|
||||
if: branch IN (travis) and type != pull_request
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"dependencies": {
|
||||
"selenium-webdriver": "3.6.0",
|
||||
"chromedriver": "2.37.0"
|
||||
}
|
||||
|
|
|
@ -1,8 +1,24 @@
|
|||
var webdriver = require('selenium-webdriver');
|
||||
|
||||
const driver = new webdriver.Builder()
|
||||
.forBrowser('chrome')
|
||||
.build();
|
||||
const headless = process.env.SMOKE_HEADLESS || false;
|
||||
|
||||
const getDriver = function () {
|
||||
const chromeCapabilities = webdriver.Capabilities.chrome();
|
||||
let args = [];
|
||||
if (headless) {
|
||||
args.push('--headless');
|
||||
args.push('window-size=1024,1680');
|
||||
args.push('--no-sandbox');
|
||||
}
|
||||
chromeCapabilities.set('chromeOptions', {args});
|
||||
const newDriver = new webdriver.Builder()
|
||||
.forBrowser('chrome')
|
||||
.withCapabilities(chromeCapabilities)
|
||||
.build();
|
||||
return newDriver;
|
||||
};
|
||||
|
||||
const driver = getDriver();
|
||||
|
||||
const {By, until} = webdriver;
|
||||
|
||||
|
@ -70,5 +86,6 @@ module.exports = {
|
|||
clickButton,
|
||||
findByCss,
|
||||
clickCss,
|
||||
getLogs
|
||||
getLogs,
|
||||
getDriver
|
||||
};
|
||||
|
|
|
@ -12,9 +12,9 @@ var seleniumWebdriver = require('selenium-webdriver');
|
|||
// Selenium's promise driver will be deprecated, so we should not rely on it
|
||||
seleniumWebdriver.SELENIUM_PROMISE_MANAGER = 0;
|
||||
|
||||
// chrome driver
|
||||
var driver = new seleniumWebdriver.Builder().withCapabilities(seleniumWebdriver.Capabilities.chrome())
|
||||
.build();
|
||||
const {
|
||||
driver
|
||||
} = require('../selenium-helpers.js');
|
||||
|
||||
var rootUrl = process.env.ROOT_URL || 'https://scratch.ly';
|
||||
|
||||
|
|
Loading…
Reference in a new issue