forked from publiclab/plots2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into test/consolidate-co…
…mment-tests
- Loading branch information
Showing
9 changed files
with
205 additions
and
88 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 |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name: continuous-integration | ||
on: [push] | ||
jobs: | ||
test-runner: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
ports: | ||
- 3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
redis: | ||
image: redis | ||
# Set health checks to wait until redis has started | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
# Maps port 6379 on service container to the host | ||
- 6379:6379 | ||
|
||
steps: | ||
|
||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.6 # Not needed with a .ruby-version file | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically (not working?) | ||
|
||
- uses: nanasess/setup-chromedriver@v1.0.1 | ||
- uses: actions/checkout@v2 | ||
|
||
# Trying to cache yarn deps but they're in public/assets/**/**, but application.js is also | ||
# compiled there so we have to create an exception for that for any in-app js changes | ||
# - name: Cache yarn | ||
# uses: actions/cache@v2 | ||
# with: | ||
# path: public/assets/**/** | ||
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-yarn- | ||
|
||
# shouldn't be required w/ setup-ruby bundler-cache, but that isn't working? | ||
- name: Cache gems | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor/bundle | ||
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-gem- | ||
- name: Install Ruby gems with Bundler | ||
run: | | ||
bundle config path vendor/bundle | ||
bundle install --jobs 4 --retry 3 --path vendor/bundle | ||
bundle exec gem list | ||
- name: Setup database | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
# tell Rails to use proper port for MySQL | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
run: | | ||
cp config/database.yml.example config/database.yml | ||
cp db/schema.rb.example db/schema.rb | ||
sudo systemctl start mysql | ||
mysql -uroot -proot -e "SET @@global.sql_mode=(SELECT REPLACE(@@global.sql_mode, 'ONLY_FULL_GROUP_BY', ''));" | ||
mysql -uroot -proot -e "CREATE DATABASE plots;" | ||
bundle exec rake db:schema:load db:migrate --trace | ||
# above SET @@global.sql_mode is to address https://github.com/publiclab/plots2/issues/3120 | ||
- name: Install JavaScript dependencies with Yarn | ||
run: | | ||
yarn check || yarn install; | ||
- name: "Unit Tests" | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
run: bundle exec rails test test/unit | ||
|
||
- name: "Functional Tests" | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
run: bundle exec rails test test/functional | ||
|
||
- name: "Integration Tests" | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
run: bundle exec rails test test/integration | ||
|
||
- name: "System Tests" | ||
env: | ||
RAILS_ENV: test | ||
DB_PASSWORD: root | ||
DB_PORT: ${{ job.services.mysql.ports[3306] }} | ||
REDIS_HOST: localhost | ||
REDIS_PORT: 6379 | ||
run: | | ||
export DISPLAY=:99 | ||
chromedriver --url-base=/wd/hub & | ||
bundle exec rails test:system |
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 was deleted.
Oops, something went wrong.
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,81 @@ | ||
require "application_system_test_case" | ||
|
||
class EditorTest < ApplicationSystemTestCase | ||
include ActiveJob::TestHelper | ||
Capybara.default_max_wait_time = 60 | ||
|
||
def setup | ||
visit '/' | ||
find(".nav-link.loginToggle").click() | ||
fill_in("username-login", with: "palpatine") | ||
fill_in("password-signup", with: "secretive") | ||
find(".login-modal-form #login-button").click() | ||
end | ||
|
||
# test "check that rich wiki editor functions correctly" do | ||
# visit "/wiki/wiki-page-path" | ||
# find("a[data-original-title='Try the beta inline Rich Wiki editor.'").click() | ||
# first("div.inline-section").hover() | ||
|
||
# # click edit btn | ||
# using_wait_time(2) { first("a.inline-edit-btn").click() } | ||
|
||
# find("div.wk-wysiwyg").set("wiki text") | ||
|
||
# click_on "Save" | ||
# page.assert_selector("p", text: "wiki text") | ||
# end | ||
|
||
# test "check that markdown wiki editor functions correctly" do | ||
# visit "/wiki/wiki-page-path" | ||
# find("a[data-original-title='Edit this wiki page.'").click() | ||
|
||
# find("#text-input").set("wiki text") | ||
# find("a#publish").click() | ||
|
||
# page.assert_selector("p", text: "wiki text") | ||
# end | ||
|
||
# test "check rich editor features are functional" do | ||
# visit "/wiki/wiki-page-path" | ||
# find("a[data-original-title='Try the beta inline Rich Wiki editor.'").click() | ||
# first("div.inline-section").hover() | ||
|
||
# using_wait_time(2) { first("a.inline-edit-btn").click() } | ||
|
||
# # test the following features | ||
# ["bold", "italic", "code", "heading"].each do |element| | ||
# # clicking on the button generates the element with dummy text | ||
# find("button.woofmark-command-#{element}").click() | ||
# # these keys are called to deselect the previous elements | ||
# find("div.wk-wysiwyg").native.send_key(:arrow_left, :enter) | ||
# end | ||
|
||
# click_on "Save" | ||
|
||
# # assert that the features have worked and that the correct wiki elements are displayed | ||
# page.assert_selector("strong", text: "strong text") | ||
# page.assert_selector("h1", text: "Heading Text") | ||
# page.assert_selector("em", text: "emphasized text") | ||
# page.assert_selector("code", text: "code goes here") | ||
# end | ||
|
||
# test "check markdown editor features are functional" do | ||
# visit "/wiki/wiki-page-path" | ||
# find("a[data-original-title='Edit this wiki page.']").click() | ||
|
||
# # test the following features | ||
# ["**strong text**", "_emphasized text_", "`code goes here`", "# Heading Text"].each do |element| | ||
# find("#text-input").native.send_keys(element) | ||
# find("#text-input").native.send_keys(:enter) | ||
# end | ||
|
||
# find("a#publish").click() | ||
|
||
# # assert that the features have worked and that the correct wiki elements are displayed | ||
# page.assert_selector("strong", text: "strong text") | ||
# page.assert_selector("h1", text: "Heading Text") | ||
# page.assert_selector("em", text: "emphasized text") | ||
# page.assert_selector("code", text: "code goes here") | ||
# end | ||
end |
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