...
 
Commits (17)
stages:
- build
- test
- deploy
variables:
# AWS_KEY: See https://console.aws.amazon.com/iam/home?#/users/sidecar-ci?section=security_credentials
# AWS_SECRET: See https://console.aws.amazon.com/iam/home?#/users/sidecar-ci?section=security_credentials
cache:
paths:
- node_modules/
- dist/
build:
stage: build
image: node:8
script:
- npm install
- npm run build
artifacts:
expire_in: 1 week
paths:
- node_modules/
- dist/
test:
stage: test
image: node:8
script:
- npm test
variables:
SELENIUM_REMOTE_URL: http://selenium-server:4444/wd/hub
services:
- name: selenium/standalone-chrome:3.14.0
alias: selenium-server
deploy_prod_microsite_manual:
stage: deploy
image: node:8
only:
- master
# Production is only manual
when: manual
script:
# This handles building, uploading, deploying
- npm run deploy-microsite
environment:
name: microsite-prod
url: https://sidecar.gitter.im/
deploy_prod_script_manual:
stage: deploy
image: node:8
only:
- tags
# Production is only manual
when: manual
script:
# This handles building, uploading, deploying
- npm run deploy-sidecar
environment:
name: script-prod
url: https://sidecar.gitter.im/dist/sidecar.v1.js
...@@ -34,9 +34,9 @@ You can define toggle/open/close buttons in your page using the `.js-gitter-togg ...@@ -34,9 +34,9 @@ You can define toggle/open/close buttons in your page using the `.js-gitter-togg
## Examples ## Examples
- [Basic](https://github.com/gitterHQ/sidecar/tree/master/examples/basic) - [Basic](https://gitlab.com/gitlab-org/gitter/sidecar/tree/master/examples/basic)
- [Toggle chat, show/hide](https://github.com/gitterHQ/sidecar/tree/master/examples/toggle-chat-class-buttons) - [Toggle chat, show/hide](https://gitlab.com/gitlab-org/gitter/sidecar/tree/master/examples/toggle-chat-class-buttons)
- [Create and Destroy chat](https://github.com/gitterHQ/sidecar/tree/master/examples/create-destroy-chat) - [Create and Destroy chat](https://gitlab.com/gitlab-org/gitter/sidecar/tree/master/examples/create-destroy-chat)
# Options # Options
......
# v1.4.2 - 2019-1-2
- [Microsite](https://sidecar.gitter.im/): Update example links from GitHub to GitLab
- Thanks to [@avelino](https://gitlab.com/avelino) for the contribution, https://gitlab.com/gitlab-org/gitter/sidecar/merge_requests/74
# v1.4.0 - 2018-9-4
- Use `rel="noopener"` on external links to isolate Gitter from referrers JavaScript
- Thanks to [@wmhilton](https://gitlab.com/wmhilton) for the contribution, https://gitlab.com/gitlab-org/gitter/sidecar/merge_requests/72
- Migrate project over to GitLab
# v1.3.3 - 2018-2-12
- Only shim `Array.from` when it isn't available natively
# v1.3.2 - 2016-11-9
- Disable Selenium tests because we don't have a BrowserStack subscription anymore
- Update Node.js engine to `4.8.6` in CircleCI config
# v1.3.1 - 2016-11-9
- Update Node.js engine to `4.8.6` in package.json
# v1.3.0 - 2016-11-9
- Slight readme fixes
- Ignore SauceLabs log file
# v1.2.4 - 2016-6-6
- Remove `libraryTarget: 'umd'` from webpack config
# v1.2.3 - 2016-2-9 # v1.2.3 - 2016-2-9
- Fix action bar items on IE11. IE11 doesn't support adding multiple class names at once `element.classList.add('foo', 'bar')` so we separated out the calls - Fix action bar items on IE11. IE11 doesn't support adding multiple class names at once `element.classList.add('foo', 'bar')` so we separated out the calls
- Fixed shim usage from breaking change in [`array.from`](https://github.com/mathiasbynens/Array.from) that now uses es-shim API - Fixed shim usage from breaking change in [`array.from`](https://github.com/mathiasbynens/Array.from) that now uses es-shim API
# v1.2.2 - 2016-2-8 # v1.2.2 - 2016-2-8
- Update dependencies - Update dependencies
......
...@@ -79,6 +79,4 @@ You'll need AWS credentials exported as `AWS_KEY` and `AWS_SECRET`. This command ...@@ -79,6 +79,4 @@ You'll need AWS credentials exported as `AWS_KEY` and `AWS_SECRET`. This command
# Testing # Testing
You'll need a BrowserStack username and key, exported as `BS_USER` and `BS_KEY` respectively.
`npm test` `npm test`
#!/bin/bash
if [[ "$1" == "stop" ]]
then
echo "Stopping browserstack tunnel..."
killall BrowserStackLocal
exit
fi
if [[ ! -e browserstack ]]
then
echo "Downloading browserstack tunnel..."
mkdir -p browserstack
curl https://www.browserstack.com/browserstack-local/BrowserStackLocal-linux-x64.zip > browserstack/BrowserStackLocal-linux-x64.zip
cd browserstack && unzip BrowserStackLocal-linux-x64.zip && chmod a+x BrowserStackLocal
cd ..
fi
echo "Browserstack tunnel ready..."
dependencies:
cache_directories:
- browserstack
test:
override:
- npm run build
#- ci/browserstack_tunnel.sh
#- browserstack/BrowserStackLocal -f $BS_KEY $PWD/test/fixtures:
# background: true
#- npm test
#- ci/browserstack_tunnel.sh stop
deployment:
master:
branch: master
owner: gitterHQ
commands:
- npm run deploy-microsite
release:
tag: /v[0-9]+(\.[0-9]+)*/
owner: gitterHQ
commands:
- npm run deploy-sidecar
machine:
node:
version: 4.8.6
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{ {
"name": "gitter-sidecar", "name": "gitter-sidecar",
"version": "1.3.2", "version": "1.4.2",
"description": "An embeddable Gitter client.", "description": "An embeddable Gitter client.",
"main": "./dist/sidecar-module.js", "main": "./dist/sidecar-module.js",
"repository": "https://github.com/gitterHQ/sidecar", "repository": "https://github.com/gitterHQ/sidecar",
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
}, },
"scripts": { "scripts": {
"prepublish": "npm run build-module && npm run build", "prepublish": "npm run build-module && npm run build",
"test": "gulp move-sidecar-dist-to-fixtures && npm run test-unformatted | tap-spec", "test": "gulp move-sidecar-dist-to-fixtures && npm run test-base | tap-spec",
"test-unformatted": "babel-tape-runner test/button_present_test.js", "test-base": "babel-tape-runner test/button_present_test.js",
"devbuild": "webpack --watch --progress", "devbuild": "webpack --watch --progress",
"build": "webpack -p", "build": "webpack -p",
"build-module": "webpack -p --config ./webpack.sidecar-module.config.js", "build-module": "webpack -p --config ./webpack.sidecar-module.config.js",
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
"babel-loader": "^6.2.2", "babel-loader": "^6.2.2",
"babel-preset-es2015": "^6.3.13", "babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13", "babel-preset-react": "^6.3.13",
"babel-tape-runner": "^2.0.0", "babel-tape-runner": "^2.0.1",
"bluebird": "^3.2.2", "bluebird": "^3.2.2",
"classnames": "^2.2.3", "classnames": "^2.2.3",
"css-loader": "^0.23.1", "css-loader": "^0.23.1",
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
"gulp-util": "^3.0.6", "gulp-util": "^3.0.6",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"mocha": "^2.4.5", "mocha": "^2.4.5",
"npm": "^3.7.2",
"postcss": "^5.0.14", "postcss": "^5.0.14",
"postcss-browser-reporter": "^0.4.0", "postcss-browser-reporter": "^0.4.0",
"postcss-calc": "^5.2.0", "postcss-calc": "^5.2.0",
...@@ -63,7 +62,7 @@ ...@@ -63,7 +62,7 @@
"run-sequence": "^1.1.5", "run-sequence": "^1.1.5",
"s3": "^4.4.0", "s3": "^4.4.0",
"safe-tape-runner": "^0.1.3", "safe-tape-runner": "^0.1.3",
"selenium-webdriver": "^2.48.2", "selenium-webdriver": "^4.0.0-alpha.1",
"serve-static": "^1.10.2", "serve-static": "^1.10.2",
"style-loader": "^0.13.0", "style-loader": "^0.13.0",
"tap-spec": "^4.1.1", "tap-spec": "^4.1.1",
......
...@@ -142,6 +142,7 @@ let addActionBar = function(chat) { ...@@ -142,6 +142,7 @@ let addActionBar = function(chat) {
popOutActionElement.setAttribute('aria-label', 'Open Chat in Gitter.im'); popOutActionElement.setAttribute('aria-label', 'Open Chat in Gitter.im');
popOutActionElement.setAttribute('href', `${opts.host}${opts.room}`); popOutActionElement.setAttribute('href', `${opts.host}${opts.room}`);
popOutActionElement.setAttribute('target', `_blank`); popOutActionElement.setAttribute('target', `_blank`);
popOutActionElement.setAttribute('rel', `noopener`);
actionBar.appendChild(popOutActionElement); actionBar.appendChild(popOutActionElement);
......
// See: https://www.browserstack.com/automate/node
// API: http://selenium.googlecode.com/git/docs/api/javascript/index.html
// Capabilities
// - https://www.browserstack.com/automate/capabilities
// - Capability platform/os configurator: https://docs.saucelabs.com/reference/platforms-configurator/#/
//
// How can I use selenium-webdriver package with SauceLabs?: http://stackoverflow.com/q/21170734/796832
// # Setup
//
// ### Set environment variables with your browserstack credentials
// See: http://stackoverflow.com/a/13333312/796832
//
// Windows:
// ```
// set BS_USER=xxx
// set BS_KEY=xxx
// ```
import Promise from 'bluebird'; import Promise from 'bluebird';
import assert from 'assert';
import path from 'path';
import objectAssign from 'object-assign'; import objectAssign from 'object-assign';
//var webdriver = require('browserstack-webdriver');
import webdriver from 'selenium-webdriver'; import webdriver from 'selenium-webdriver';
import chrome from 'selenium-webdriver/chrome';
import test from 'tape'; import test from 'tape';
//var test = require('browserstack-webdriver/testing');
import testingEnvironments from './utility/testing-environments.js'; const options = new chrome.Options();
options.addArguments('headless');
options.addArguments('disable-gpu');
options.addArguments('disable-extensions');
options.addArguments('no-sandbox');
const capabilities = webdriver.Capabilities.chrome();
const driver = new webdriver.Builder()
.forBrowser('chrome')
.setChromeOptions(options)
.withCapabilities(capabilities)
.build();
let createWebDriver = function({
server = 'http://hub.browserstack.com/wd/hub',
capabilities = {}
}) {
let driver = new webdriver.Builder()
.usingServer(server)
.withCapabilities(capabilities)
.build();
return driver; test('Open Chat Button should be present', function (t) {
}; t.plan(1);
const getPage = driver.get(`file://${path.join(__dirname, './fixtures/example.html')}`);
const buttonTextExpected = 'open chat'; const buttonLocator = webdriver.By.css('.gitter-open-chat-button');
testingEnvironments.forEach(function(testingEnvironment) {
const testName = `Open Chat Button should be present. in ${testingEnvironment.browserName} on ${testingEnvironment.platform}`;
test(testName, function (t) {
t.plan(1);
let driver = createWebDriver({
capabilities: testingEnvironment
});
let getPage = driver.get(`http://${testingEnvironment['browserstack.user']}.browserstack.com/example.html`); const openChatButtonExists = getPage.then(function() {
return driver.wait(
let buttonLocator = webdriver.By.css('.gitter-open-chat-button'); webdriver.until.elementLocated(buttonLocator),
20000
);
});
let openChatButtonExists = getPage.then(function() { openChatButtonExists
return driver.wait(function() { .then(function() {
return driver.isElementPresent(buttonLocator); return driver.findElement(buttonLocator);
}, 10000); })
.then(function(item) {
return Promise.resolve(item.getText());
})
.then(function(text) {
const actualText = text.toLowerCase();
const buttonTextExpected = 'open chat';
assert(actualText, buttonTextExpected, `Expected text to look like ${buttonTextExpected} but actually was ${actualText}`);
})
.then(function() {
t.pass('Successfully ran through selenium tasks');
})
.finally(() => {
driver.quit();
}); });
openChatButtonExists
.then(function() {
return driver.findElement(buttonLocator);
})
.then(function(item) {
return Promise.resolve(item.getText());
})
.then(function(text) {
let actual = text.toLowerCase();
if(actual !== buttonTextExpected) {
throw new Error(`Failed, expected text to look like ${buttonTextExpected} but actually was ${actual}`);
}
})
.then(function() {
//console.log('driver.quit called');
driver.quit();
t.pass('Successfully ran through selenium tasks');
});
});
}); });
This diff is collapsed.
import objectAssign from 'object-assign';
let calculatePlatformFromBS = function(capabilities) {
const os = (capabilities.os || '').toLowerCase();
const osVersion = (capabilities.os_version || '').toLowerCase();
if(os === 'windows') {
if(osVersion === '8' || osVersion === '8.1') {
return 'WIN8';
}
else if(osVersion === 'xp') {
return 'XP';
}
return 'WINDOWS';
}
else if(os === 'os x') {
return 'MAC';
}
return 'ANY';
};
const USER = process.env.BS_USER;
const KEY = process.env.BS_KEY;
// See: https://www.browserstack.com/automate/capabilities
const defaultEnvironmentCapabilities = {
// Browser you want to test.
// firefox, chrome, internet explorer, safari, opera, iPad, iPhone, android
browserName: 'chrome',
// Browser version you want to test.
version: 45.0,
// OS you want to test.
// ANY, WINDOWS, WIN8, MAC, and XP.
platform: 'ANY',
// OS you want to test. (BrowserStack-specific)
// WINDOWS, OS X
os: 'Windows',
// OS version you want to test. (BrowserStack-specific)
// Windows: XP, 7, 8 and 8.1
// OS X: Snow Leopard, Lion, Mountain Lion, Mavericks, Yosemite
os_version: '8.1',
screenResolution: '1024x768',
'browserstack.local': true,
'browserstack.debug': true,
'browserstack.user': USER,
'browserstack.key': KEY
};
const testingEnvironments = [
{
browserName: 'chrome',
version: 45.0,
os: 'Windows',
os_version: '8.1'
},
{
browserName: 'chrome',
version: 45.0,
os: 'OS X',
os_version: 'Yosemite'
}
];
export default testingEnvironments.map((envCaps) => {
let capabilities = objectAssign({}, defaultEnvironmentCapabilities, envCaps);
capabilities.platform = calculatePlatformFromBS(capabilities);
return capabilities;
});