Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,31 @@ jobs:
bundler-cache: true
rubygems: latest

- name: Install Ruby dependencies
run: |
gem install bundler
bundle install

- name: Run tests
run: bundle exec rake test

- name: Install Node dependencies
run: |
npm install -g yarn
yarn install --frozen-lockfile

- name: Install Playwright Browsers
run: yarn playwright install --with-deps

- name: Run e2e tests
run: yarn test

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30

- name: Run linter
run: bundle exec rake standard
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.DS_Store
node_modules
/app/assets/builds/*
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
dist
test/public/js/ruby_ui*
60 changes: 59 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,59 @@ PATH
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
base64 (0.2.0)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
concurrent-ruby (1.3.4)
cuprite (0.15.1)
capybara (~> 3.0)
ferrum (~> 0.15.0)
ferrum (0.15)
addressable (~> 2.5)
concurrent-ruby (~> 1.1)
webrick (~> 1.7)
websocket-driver (~> 0.7)
json (2.8.0)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
lru_redux (1.1.0)
matrix (0.4.2)
mini_mime (1.1.5)
minitest (5.25.1)
mustermann (3.0.3)
ruby2_keywords (~> 0.0.1)
nio4r (2.7.4)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
parallel (1.26.3)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
phlex (2.0.0.beta2)
public_suffix (6.0.1)
puma (6.4.3)
nio4r (~> 2.0)
racc (1.8.1)
rack (3.1.8)
rack-protection (4.0.0)
base64 (>= 0.1.0)
rack (>= 3.0.0, < 4)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rainbow (3.1.1)
rake (13.2.1)
regexp_parser (2.9.2)
Expand All @@ -41,6 +82,13 @@ GEM
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
sinatra (4.0.0)
mustermann (~> 3.0)
rack (>= 3.0.0, < 4)
rack-protection (= 4.0.0)
rack-session (>= 2.0.0, < 3)
tilt (~> 2.0)
standard (1.41.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
Expand All @@ -55,16 +103,26 @@ GEM
rubocop-performance (~> 1.22.0)
tailwind_merge (0.13.2)
lru_redux (~> 1.1)
tilt (2.4.0)
unicode-display_width (2.6.0)
webrick (1.9.0)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)

PLATFORMS
arm64-darwin-24
ruby
x86_64-linux

DEPENDENCIES
cuprite
minitest (~> 5.0)
puma
rake (~> 13.0)
ruby_ui!
sinatra
standard (~> 1.0)

BUNDLED WITH
Expand Down
12 changes: 12 additions & 0 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as esbuild from "esbuild";

await esbuild.build({
entryPoints: ["lib/ruby_ui/index.js"],
bundle: true,
minify: false,
sourcemap: true,
target: ["es2015"],
outfile: "dist/ruby_ui_js.min.js",
format: "iife",
globalName: "RubyUI",
});
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"description": "Stimulus controllers for ruby_ui Component Library",
"homepage": "https://ruby_ui.dev",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "node esbuild.config.mjs",
"test": "playwright test"
},
"keywords": [
"ruby_ui",
Expand Down Expand Up @@ -34,6 +35,10 @@
"tippy.js": "^6.3.7"
},
"devDependencies": {
"globals": "^15.8.0"
"@playwright/test": "^1.48.2",
"@types/node": "^22.9.0",
"esbuild": "^0.24.0",
"globals": "^15.8.0",
"playwright": "^1.48.2"
}
}
79 changes: 79 additions & 0 deletions playwright.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// @ts-check
const { defineConfig, devices } = require("@playwright/test");

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config({ path: path.resolve(__dirname, '.env') });

/**
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
testDir: "./test/ruby_ui",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
// headless: false,
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
},

/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},

{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},

{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},

/* Test against mobile viewports. */
// {
// name: 'Mobile Chrome',
// use: { ...devices['Pixel 5'] },
// },
// {
// name: 'Mobile Safari',
// use: { ...devices['iPhone 12'] },
// },

/* Test against branded browsers. */
// {
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
],

/* Run your local dev server before starting the tests */
webServer: {
command: "ruby test/test_server.rb",
url: "http://127.0.0.1:4567",
reuseExistingServer: !process.env.CI,
},
});
3 changes: 3 additions & 0 deletions ruby_ui.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "rake", "~> 13.0"
s.add_development_dependency "standard", "~> 1.0"
s.add_development_dependency "minitest", "~> 5.0"
s.add_development_dependency "sinatra"
s.add_development_dependency "puma"
s.add_development_dependency "cuprite"
end
Empty file.
71 changes: 71 additions & 0 deletions test/public/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
:root {
--background: 0 0% 100%;
--foreground: 240 10% 3.9%;
--card: 0 0% 100%;
--card-foreground: 240 10% 3.9%;
--popover: 0 0% 100%;
--popover-foreground: 240 10% 3.9%;
--primary: 240 5.9% 10%;
--primary-foreground: 0 0% 98%;
--secondary: 240 4.8% 95.9%;
--secondary-foreground: 240 5.9% 10%;
--muted: 240 4.8% 95.9%;
--muted-foreground: 240 3.8% 46.1%;
--accent: 240 4.8% 95.9%;
--accent-foreground: 240 5.9% 10%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 0 0% 98%;
--border: 240 5.9% 90%;
--input: 240 5.9% 90%;
--ring: 240 5.9% 10%;
--radius: 0.5rem;

/* ruby_ui especific */
--warning: 38 92% 50%;
--warning-foreground: 0 0% 100%;
--success: 87 100% 37%;
--success-foreground: 0 0% 100%;
}

.dark {
--background: 240 10% 3.9%;
--foreground: 0 0% 98%;
--card: 240 10% 3.9%;
--card-foreground: 0 0% 98%;
--popover: 240 10% 3.9%;
--popover-foreground: 0 0% 98%;
--primary: 0 0% 98%;
--primary-foreground: 240 5.9% 10%;
--secondary: 240 3.7% 15.9%;
--secondary-foreground: 0 0% 98%;
--muted: 240 3.7% 15.9%;
--muted-foreground: 240 5% 64.9%;
--accent: 240 3.7% 15.9%;
--accent-foreground: 0 0% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 0% 98%;
--border: 240 3.7% 15.9%;
--input: 240 3.7% 15.9%;
--ring: 240 4.9% 83.9%;

/* ruby_ui especific */
--warning: 38 92% 50%;
--warning-foreground: 0 0% 100%;
--success: 84 81% 44%;
--success-foreground: 0 0% 100%;
}

* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
font-feature-settings:
"rlig" 1,
"calt" 1;

/* docs specific */
/* https://css-tricks.com/snippets/css/system-font-stack/ */
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
Loading