Skip to content

Commit

Permalink
Merge pull request #2110 from bem/gemini-hermione
Browse files Browse the repository at this point in the history
Convert Gemini to Hermione
  • Loading branch information
tadatuta committed Jan 28, 2019
2 parents 7c00b75 + 66165ce commit fe7f8df
Show file tree
Hide file tree
Showing 1,555 changed files with 2,621 additions and 2,559 deletions.
31 changes: 0 additions & 31 deletions .gemini.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ libs

/coverage
/coverage.json
/gemini-report/
/hermione-report/

/dist
/*.docs
Expand Down
17 changes: 17 additions & 0 deletions .hermione-dist.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

const baseConfig = require('./hermione/config-common');

module.exports = Object.assign({}, baseConfig, {
sets : {
desktop : {
files : [
'test/dist/*.hermione.js'
],
browsers : [
'firefox-latest',
'chrome-latest'
]
}
}
});
17 changes: 17 additions & 0 deletions .hermione.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

const baseConfig = require('./hermione/config-common');

module.exports = Object.assign({}, baseConfig, {
sets : {
desktop : {
files : [
'hermione/**/*.hermione.js'
],
browsers : [
'firefox-latest',
'chrome-latest'
]
}
}
});
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js

node_js:
- "4"
- "8"

# sudo=false to run builds inside container infrastructure
# see https://github.com/bem/bem-components/issues/1528
Expand All @@ -21,13 +21,14 @@ env:
matrix:
- TEST_SCOPE: specs
- TEST_SCOPE: tmpls
- TEST_SCOPE: gemini
- TEST_SCOPE: hermione
- TEST_SCOPE: dists

matrix:
fast_finish: true

addons:
sauce_connect: true
apt:
sources:
- ubuntu-toolchain-r-test
Expand All @@ -41,12 +42,12 @@ branches:

before_install:
- |
if [ "${TEST_SCOPE}" == "gemini" ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
if [ "${TEST_SCOPE}" == "hermione" ] && [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then
if [ ! "$SAUCE_USERNAME" -a ! "$SAUCE_ACCESS_KEY" ]; then
true && export `base64 --decode <<< U0FVQ0VfVVNFUk5BTUU9YmVtLWluZm8K`
true && export `base64 --decode <<< U0FVQ0VfQUNDRVNTX0tFWT0yODFiNGMzNy02YWYzLTRmMGEtOGRmYi0xYmUzMjY1OGNiOTQK`
fi
curl https://api.github.com/repos/bem/bem-components/pulls/$TRAVIS_PULL_REQUEST/files?per_page=100 | grep '"filename":.*"' | grep -v '\.md"' >/dev/null || (echo "Gemini tests skipped!" && exit 0)
curl https://api.github.com/repos/bem/bem-components/pulls/$TRAVIS_PULL_REQUEST/files?per_page=100 | grep '"filename":.*"' | grep -v '\.md"' >/dev/null || (echo "Hermione tests skipped!" && exit 0)
fi
before_script:
Expand All @@ -56,13 +57,12 @@ before_script:
node notify.js --clear
fi
- |
if [ "${TEST_SCOPE}" == "gemini" -o "${TEST_SCOPE}" == "dists" ]; then
if [ "${TEST_SCOPE}" == "hermione" -o "${TEST_SCOPE}" == "dists" ]; then
if [ ! "$SAUCE_USERNAME" -a ! "$SAUCE_ACCESS_KEY" ]; then
true && export `base64 --decode <<< U0FVQ0VfVVNFUk5BTUU9YmVtLWluZm8K`
true && export `base64 --decode <<< U0FVQ0VfQUNDRVNTX0tFWT0yODFiNGMzNy02YWYzLTRmMGEtOGRmYi0xYmUzMjY1OGNiOTQK`
fi
curl -L https://gist.githubusercontent.com/tadatuta/3303b14f47dbee9ca079/raw/sauce-connect.sh | bash
cat .gemini.yml
cat .hermione.conf.js
fi
after_success:
Expand All @@ -78,6 +78,6 @@ after_success:
after_failure:
- |
if [ "${TRAVIS_PULL_REQUEST}" != "false" ] && [ "${TEST_SCOPE}" == "gemini" ] && [ "${TRAVIS_SECURE_ENV_VARS}" != "false" ]; then
if [ "${TRAVIS_PULL_REQUEST}" != "false" ] && [ "${TEST_SCOPE}" == "hermione" ] && [ "${TRAVIS_SECURE_ENV_VARS}" != "false" ]; then
sh publish_report.sh
fi
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -397,26 +397,26 @@ Tests will be run automatically on [Travis](https://travis-ci.org) for each pull

#### Regression tests for layout

[Gemini](https://en.bem.info/tools/testing/gemini/) is used for layout testing.
[Hermione](https://github.com/gemini-testing/hermione/) is used for layout testing.

Tests for each block are stored in a separate `block-name.gemini.js` file in the `gemini/` directory. Locally, test are executed manually. On Travis, tests are executed automatically. For [Selenium Grid](https://code.google.com/p/selenium/wiki/Grid2), the [SauceLabs](https://saucelabs.com) service is used.
Tests for each block are stored in a separate `block-name.hermione.js` file in the `hermione/` directory. Locally, test are executed manually. On Travis, tests are executed automatically. For [Selenium Grid](https://code.google.com/p/selenium/wiki/Grid2), the [SauceLabs](https://saucelabs.com) service is used.

For executing tests locally, you need to:

1. Create an [OpenSauce](https://saucelabs.com/opensauce) account in SauceLabs.
2. Install the [Sauce Connect](https://saucelabs.com/connect) utility.
3. Set up environment variables (`SAUCE_USERNAME` and `SAUCE_ACCESS_KEY`).
4. Launch the `sc` utility (SauceConnect) and wait for the tunnel to be opened.
5. Run the tests using `npm run gemini`.
6. If you need to make new versions of screenshots, use the command `npm run gemini-gather`.
5. Run the tests using `hermione`.
6. If you need to make new versions of screenshots, use the command `hermione gui`.

When developing new tests to speed up local execution:

1. Install and run [Selenium Server](http://docs.seleniumhq.org/download/) or [PhantomJS](http://phantomjs.org/).
2. In the `.gemini.yml` file, change the `gridUrl` option to `http://localhost:4444/`.
2. In the `.hermione.conf.js` file, change the `gridUrl` option to `http://localhost:4444/`.
3. Run the tests.

For more information about using `Gemini` with various backends, read the article [Gemini quick start](https://en.bem.info/tools/testing/gemini/).
For more information about using `Hermione` with various backends, read the article [Hermione quick start](https://github.com/gemini-testing/hermione#quick-start).

**Note:** You need to save screenshots from SauceLabs in the repository. This helps to avoid discrepancies when rendering fonts.

Expand Down
12 changes: 6 additions & 6 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,26 +322,26 @@ $ npm run lint

#### Регрессионное тестирование верстки

Для тестирования верстки используется [Gemini](https://ru.bem.info/tools/testing/gemini/).
Для тестирования верстки используется [Hermione](https://ru.bem.info/tools/testing/hermione/).

Тесты каждого блока находятся в отдельном файле вида `block-name.gemini.js` в директории `gemini/`. Локально тесты запускаются вручную. Тесты на Travis запускаются автоматически. В качестве [Selenium Grid](https://code.google.com/p/selenium/wiki/Grid2) используется сервис [SauceLabs](https://saucelabs.com).
Тесты каждого блока находятся в отдельном файле вида `block-name.hermione.js` в директории `hermione/`. Локально тесты запускаются вручную. Тесты на Travis запускаются автоматически. В качестве [Selenium Grid](https://code.google.com/p/selenium/wiki/Grid2) используется сервис [SauceLabs](https://saucelabs.com).

Для запуска тестов локально необходимо:

1. Создайте учетную запись [OpenSauce](https://saucelabs.com/opensauce) в SauceLabs.
1. Установите утилиту [Sauce Connect](https://saucelabs.com/connect).
1. Настройте окружение (переменные среды `SAUCE_USERNAME` и `SAUCE_ACCESS_KEY`).
1. Запустите утилиту `sc` (SauceConnect) и дождаться установки туннеля.
1. Запустите тесты командой `npm run gemini`.
1. Соберите новые версии скриншотов при необходимости командой `npm run gemini-gather`.
1. Запустите тесты командой `hermione`.
1. Соберите новые версии скриншотов при необходимости командой `hermione gui`.

При разработке новых тестов для ускорения локального запуска:

1. Установите и запустите [Selenium Server](http://docs.seleniumhq.org/download/) или [PhantomJS](http://phantomjs.org/).
1. Исправьте в файле `.gemini.yml` опцию `gridUrl` на `http://localhost:4444/`.
1. Исправьте в файле `.hermione.conf.js` опцию `gridUrl` на `http://localhost:4444/`.
1. Запустите тесты.

Подробно про использование `Gemini` с разными бекендами читайте в статье [Введение в работу с Gemini](https://ru.bem.info/tools/testing/gemini/).
Подробно про использование `Hermione` с разными бекендами читайте в статье [Введение в работу с Hermione](https://github.com/gemini-testing/hermione#quick-start).

**Важно!** В репозиторий необходимо сохранять скриншоты, собранные в SauceLabs. Это позволит избежать отличий в отрисовке шрифтов.

Expand Down
52 changes: 0 additions & 52 deletions common.blocks/attach/attach.tests/gemini.bemjson.js

This file was deleted.

52 changes: 52 additions & 0 deletions common.blocks/attach/attach.tests/hermione.bemjson.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
({
block : 'page',
title : 'bem-components: attach',
mods : { theme : 'islands' },
head : [
{ elem : 'css', url : 'hermione.css' },
{ elem : 'js', url : 'hermione.js' }
],
content : ['s', 'm', 'l', 'xl'].map(function(size) {
var cls = 'islands-size' + size.toUpperCase();
return {
tag : false,
content : [{
tag : 'h2',
content : cls,
},
{
tag : 'p',
attrs : { style : 'width: 300px' },
cls : cls + '-enabled',
content : {
block : 'attach',
button : 'file',
noFileText : 'no file selected',
mods : {
theme : 'islands',
size : size,
},
attrs : {
tabindex : 0 // To trap focus in Chrome
}
}
},
{
tag : 'p',
attrs : { style : 'width: 300px' },
cls : cls + '-disabled',
content : {
block : 'attach',
mods : {
theme : 'islands',
size : size,
disabled : true
},
button : 'file',
noFileText : 'no file selected'
}
}
]
};
})
});
Loading

0 comments on commit fe7f8df

Please sign in to comment.