Skip to content

Commit

Permalink
Merge branch 'master' into Feature#5214
Browse files Browse the repository at this point in the history
  • Loading branch information
jalajk3004 authored Jan 15, 2025
2 parents ab185b0 + 0b16788 commit b3761cf
Show file tree
Hide file tree
Showing 18 changed files with 1,700 additions and 1,701 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/percy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: "Percy Visual Tests"

on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

jobs:
percy-tests:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:16-alpine
ports:
- "5432:5432"
env:
POSTGRES_DB: rails_test
POSTGRES_USER: rails
POSTGRES_PASSWORD: password
redis:
image: redis:alpine
ports: ["6379:6379"]
options: --entrypoint redis-server

env:
RAILS_ENV: test
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"

steps:
- name: Check out code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"

- name: Install Percy CLI
run: npm install --save-dev @percy/cli

- name: Install Gems
run: bundle install

- name: Prepare DB
run: |
bin/rails db:schema:load
bin/rails data:migrate
- name: Configure keys
run: |
openssl genrsa -out config/private.pem 2048
openssl rsa -in config/private.pem -outform PEM -pubout -out config/public.pem
- name: Configure keys
run: |
openssl genrsa -out config/private.pem 2048
openssl rsa -in config/private.pem -outform PEM -pubout -out config/public.pem
- name: Build assets (if needed)
run: yarn run build

- name: Run tests with Percy
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
run: npx percy exec -- bundle exec rspec
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,5 @@ node_modules
# ignore rbs collection
.gem_rbs_collection

# Ignore vendor folder generated in Gitpod Environment
vendor/

# Ignore .vscode/settings.json
.vscode/settings.json
17 changes: 0 additions & 17 deletions .gitpod.Dockerfile

This file was deleted.

3 changes: 0 additions & 3 deletions .gitpod.vscode.settings

This file was deleted.

47 changes: 0 additions & 47 deletions .gitpod.yml

This file was deleted.

1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ group :test do
gem "simplecov-lcov"
gem "undercover"
gem "undercover-checkstyle"
gem "percy-capybara"
end

group :development do
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ GEM
parser (3.3.4.0)
ast (~> 2.4.1)
racc
percy-capybara (5.0.0)
capybara (>= 3)
pg (1.5.3)
pg (1.5.3-x64-mingw32)
pg_search (2.3.6)
Expand Down Expand Up @@ -977,6 +979,7 @@ DEPENDENCIES
opentelemetry-instrumentation-redis
opentelemetry-instrumentation-sidekiq
opentelemetry-sdk (~> 1.2)
percy-capybara
pg (~> 1.5.3)
pg_search
premailer-rails (~> 1.11, >= 1.11.1)
Expand Down
1 change: 0 additions & 1 deletion SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ There are several ways to run your own instance of CircuitVerse:
| Method | Operating System | Documentation |
| --- | --- | --- |
| GitHub Codespaces | Any | [Click Here](https://github.com/CircuitVerse/CircuitVerse/tree/master/installation_docs/remote_development.md#github-codespaces) |
| Gitpod Cloud Environment | Any | [Click Here](https://github.com/CircuitVerse/CircuitVerse/tree/master/installation_docs/remote_development.md#gitpod-cloud-environment) |
| Native Setup | Linux | [Click Here](https://github.com/CircuitVerse/CircuitVerse/tree/master/installation_docs/manual/linux.md) |
| Native Setup | Mac | [Click Here](https://github.com/CircuitVerse/CircuitVerse/tree/master/installation_docs/manual/mac.md) |
| Docker Development Environment | Windows | [Click Here](https://github.com/CircuitVerse/CircuitVerse/tree/master/installation_docs/docker.md#windows) |
Expand Down
29 changes: 18 additions & 11 deletions app/component/footer_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,30 @@
<div class="container footer-container">
<div class="row">
<div class="col-12 col-sm-12 col-md-3 col-lg-3 footer-column">
<div class="row">
<a href="/">
<%= image_tag("CircuitVerse.png", class: "footer-logo", alt: "CircuitVerse Logo") %>
</a>
<div class="row align-items-center">
<!-- Added inline style here to shift logo more to the left -->
<div class="col-auto" style="margin-left: -10px;">
<a href="/">
<%= image_tag("CircuitVerse.png", class: "footer-logo", alt: "CircuitVerse Logo") %>
</a>
</div>
<div class="col-auto text-start">
<p class="mt-3 footer-social-icon-text">
<%= t("layout.footer.social_icon_text") %>
</p>
<%= render(SocialLinksComponent.new) %>
</div>
</div>
<div class="row">
<div class="col-12 text-start">
<p class="mt-3 footer-social-icon-text"><%= t("layout.footer.social_icon_text") %></p>
<%= render(SocialLinksComponent.new) %>
</div>
</div>
</div>

<%= render(FooterLinksComponent.new(@current_user)) %>

<div class="col-12 col-sm-12 col-md-5 col-lg-5 footer-column">
<div class="row">
<div class="col-6 footer-sponsor-logo-div">
<small class="text-start footer-sponsor-logo-text"><%= t("layout.footer.sponsor_logo_text.incubated_from") %></small>
<small class="text-start footer-sponsor-logo-text">
<%= t("layout.footer.sponsor_logo_text.incubated_from") %>
</small>
<a href="http://zense.co.in/" rel="noopener" target="_blank">
<%= image_tag("footer/zense.png", class: "footer-sponsor-logo", alt: "Zense Logo") %>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
<div class="modal-footer" data-bs-dismiss="modal">
<%= link_to "#",
method: :delete,
method: :put,
remote: true,
class: "btn btn-danger",
id: "projects-comment-delete-button" do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/commontator/comments/_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<% del_string = is_deleted ? 'undelete' : 'delete' %>
<% unless is_deleted %>
<%= link_to '#',
data: is_deleted ? {} : { toggle: "modal", target: "#deletecommentModal", href: commontator.polymorphic_path([del_string.to_sym, comment]) },
data: is_deleted ? {} : { bs_toggle: "modal", bs_target: "#deletecommentModal", href: commontator.polymorphic_path([del_string.to_sym, comment]) },
class: "del_string btn delete-action" do %>
<%= image_tag("SVGs/deleteGroup.svg", alt: "Delete Comment") %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion code-of-conduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Harassment may include but not limited to the following:
- Unwelcome sexual attention

## Reporting and Enforcement
- If you are the subject of, or witness to any violations of this Code of Conduct, inform us @ <[email protected]>.
- If you are the subject of, or witness to any violations of this Code of Conduct, inform us at <[email protected]>.
- The project lead’s word is final. If the community chooses to question the wisdom of the actions of a committer, the project lead can review their decisions, and either uphold or reverse them.

Portions derived from the [Slack Developer Community Code of Conduct][1], [The Ada Initiative][2], [geekfeminism.org][3], [Drupal Events][4], and [Code of Conduct Contributor Covenant][6].
Expand Down
2 changes: 0 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@
config.vapid_private_key = ENV["VAPID_PRIVATE_KEY"] || "FkEMkOQHvMybUlCGH-DsOljTJlLzYGb3xEYsFY5Roxk="

Rails.application.configure do
# Whitelist gitpod domain in dev envionment
config.hosts << /.*\.gitpod\.io\Z/
config.hosts << /.*\Z/ # Whitelist everything in Dev
end

Expand Down
20 changes: 0 additions & 20 deletions installation_docs/remote_development.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,4 @@ If you required to restart the server

---

### Gitpod Cloud Environment
[Gitpod](https://www.gitpod.io/) is a free platform that allows you to develop CircuitVerse in a cloud VS Code environment.

**Steps to setup**
1. Fork current repository
2. Open the forked repository and navigate to `installation_docs/remote_development.md`
3. Click on the `Open in Gitpod` button below
[![Open Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/)
4. Login with your GitHub account
5. Click on `New Workspace`
6. Paste URL of your forked repository
7. Click on `Create Workspace`
8. Wait for the workspace to be prepared

If you required to restart the server
- Type `Ctrl+C` in terminal to stop the server
- Run `./bin/dev` to start the server again

---

**Note:** You can also use the same workspace to work on multiple issues. Just make sure you create a new branch for each issue.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@commitlint/cli": "^17.5.0",
"@commitlint/config-conventional": "^17.4.4",
"@jsdoc/salty": "^0.2.9",
"@percy/cli": "^1.30.5",
"canvas": "^2.11.2",
"chokidar": "^3.6.0",
"eslint": "^7.32.0",
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require "support/spec_utils"
require "sunspot/rails/spec_helper"
require "webmock/rspec"
require "percy/capybara"

Coveralls.wear!("rails")
WebMock.disable_net_connect!({
Expand Down
18 changes: 18 additions & 0 deletions spec/system/signin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@

describe "Sign In", type: :system do
before do
# Ensure we're using the headless Selenium driver (so we have a real browser):
driven_by(:selenium_chrome_headless)

# Create a user with FactoryBot for testing sign-in
@user = FactoryBot.create(:user)

# Visit the sign-in page
visit "/users/sign_in"
end

it "does not sign-in when no credentials" do
# Attempt to log in without entering email or password
click_button "Log in"

# Percy snapshot here to see the error state
page.percy_snapshot("Sign In - No Credentials")

expect(page).to have_text("Invalid Email or password.")
end

Expand All @@ -20,20 +29,29 @@
fill_in "Password", with: @user.password
click_button "Log in"

# Percy snapshot after successful sign-in
page.percy_snapshot("Sign In - Success")

expect(page).to have_text("Signed in successfully.")
end

it "does not sign-in when password is empty" do
fill_in "Email", with: @user.email
click_button "Log in"

# Percy snapshot of the invalid password state
page.percy_snapshot("Sign In - Empty Password")

expect(page).to have_text("Invalid Email or password.")
end

it "does not sign-in when email is empty" do
fill_in "Password", with: @user.password
click_button "Log in"

# Percy snapshot of the invalid email state
page.percy_snapshot("Sign In - Empty Email")

expect(page).to have_text("Invalid Email or password.")
end
end
Loading

0 comments on commit b3761cf

Please sign in to comment.