diff --git a/app/furniture/section_navigation/section_navigation.rb b/app/furniture/section_navigation/section_navigation.rb index c123a15b4..515c89186 100644 --- a/app/furniture/section_navigation/section_navigation.rb +++ b/app/furniture/section_navigation/section_navigation.rb @@ -1,6 +1,7 @@ class SectionNavigation class SectionNavigation < Furniture location(parent: :room) + default_scope { where(furniture_kind: "section_navigation") } def rooms space.rooms.where.not(id: space.entrance_id) diff --git a/app/furniture/section_navigation/section_navigations/_section_navigation.html.erb b/app/furniture/section_navigation/section_navigations/_section_navigation.html.erb index 4cc32b6f5..759e7e24a 100644 --- a/app/furniture/section_navigation/section_navigations/_section_navigation.html.erb +++ b/app/furniture/section_navigation/section_navigations/_section_navigation.html.erb @@ -1,10 +1,7 @@
<% policy_scope(section_navigation.rooms).each do |room| %> - <%= link_to [room.space, room], class: "no-underline" do %> - <%= render CardComponent.new( - data: { access_level: room.access_level, slug: room.slug, model: "room", id: room.id }, - classes: "group self-stretch hover:bg-orange-50" - ) do %> + <%= link_to polymorphic_path(room.location), class: "no-underline" do %> + <%= render CardComponent.new(classes: "group self-stretch hover:bg-orange-50") do %>

<%= room.name %> diff --git a/app/views/rooms/_room.html.erb b/app/views/rooms/_room.html.erb index eb97b554d..af2c9ac43 100644 --- a/app/views/rooms/_room.html.erb +++ b/app/views/rooms/_room.html.erb @@ -4,10 +4,4 @@ <%= render room.gizmos.rank(:slot) %>

- -
- <% policy_scope(room.space.rooms).each do |room| %> - <%= render partial: 'spaces/room_card', locals: { room: room } %> - <% end %> -
diff --git a/app/views/spaces/_room_card.html.erb b/app/views/spaces/_room_card.html.erb deleted file mode 100644 index 1eb57f5db..000000000 --- a/app/views/spaces/_room_card.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -<%= link_to [room.space, room], class: "no-underline" do %> - <%= render CardComponent.new( - data: { access_level: room.access_level, slug: room.slug, model: "room", id: room.id }, - classes: "group self-stretch hover:bg-orange-50" - ) do %> -
-

- <%= room.name %> -

- - -
- <%- end %> -<%- end %> diff --git a/features/harness/Components.js b/features/harness/Components.js index f574c4686..7da80f17e 100644 --- a/features/harness/Components.js +++ b/features/harness/Components.js @@ -1,11 +1,8 @@ import Component from "./Component.js"; -import RoomCardComponent from "./RoomCardComponent.js"; import PersonNavigationComponent from "./PersonNavigationComponent.js"; export { Component }; -export { RoomCardComponent }; export { PersonNavigationComponent }; export default { Component, - RoomCardComponent, PersonNavigationComponent, }; diff --git a/features/harness/RoomCardComponent.js b/features/harness/RoomCardComponent.js deleted file mode 100644 index da832e879..000000000 --- a/features/harness/RoomCardComponent.js +++ /dev/null @@ -1,59 +0,0 @@ -import { By } from "selenium-webdriver"; -import Component from "./Component.js"; -import Room from "../lib/Room.js"; -import RoomPage from "./RoomPage.js"; -import RoomEditPage from "./RoomEditPage.js"; -class RoomCardComponent extends Component { - /** - * @param {ThenableWebDriver} driver - * @param {Room} room - */ - constructor(driver, room = new Room({ name: "" })) { - super(driver); - // TODO: Try to build a room from the passed in Element if undefined - this.room = room; - } - get selector() { - if (this._selector && this._selector.value) { - return this._selector; - } - const selectorParts = ["*[data-model='room']"]; - if (this.room.slug) { - selectorParts.push(`[data-slug="${this.room.slug}"]`); - } - if (this.room.accessLevel) { - selectorParts.push(this.room.accessLevel.attributeSelector); - } - return (this.selector = By.css(selectorParts.join(""))); - } - set selector(value) { - this._selector = value; - } - - /** - * @returns {Promise} - */ - enter() { - return this.enterRoomButton().click(); - } - - /** - * @returns {Component} - */ - enterRoomButton() { - return this.component("*[data-role=enter]"); - } - /** - * @returns {Promise} - */ - configure() { - return this.configureRoomButton().click(); - } - /** - * @returns {Component} - */ - configureRoomButton() { - return this.component(".--configure"); - } -} -export default RoomCardComponent; diff --git a/features/harness/RoomFormComponent.js b/features/harness/RoomFormComponent.js index e3e6c321e..c81296eb7 100644 --- a/features/harness/RoomFormComponent.js +++ b/features/harness/RoomFormComponent.js @@ -1,6 +1,6 @@ import Component from "./Component.js"; import Room from "../lib/Room.js"; -class RoomCardComponent extends Component { +class RoomFormComponent extends Component { /** * @param {ThenableWebDriver} driver * @param {Room} room @@ -18,4 +18,4 @@ class RoomCardComponent extends Component { return this; } } -export default RoomCardComponent; +export default RoomFormComponent; diff --git a/features/harness/SpaceEditPage.js b/features/harness/SpaceEditPage.js index 505b5aa54..46abb969f 100644 --- a/features/harness/SpaceEditPage.js +++ b/features/harness/SpaceEditPage.js @@ -1,7 +1,5 @@ import { ThenableWebDriver } from "selenium-webdriver"; import Page from "./Page.js"; -import Room from "../lib/Room.js"; -import RoomCardComponent from "./RoomCardComponent.js"; import Component from "./Component.js"; class SpaceEditPage extends Page { /** @@ -20,14 +18,6 @@ class SpaceEditPage extends Page { return `/spaces/${this.space.slug}/edit`; } - /** - * @param {Room} room - * @returns {RoomCardComponent} - */ - roomCard(room) { - return new RoomCardComponent(this.driver, room); - } - createRoom({ room }) { return new RoomFormComponent(this.driver) .fillIn(room) diff --git a/features/harness/SpacePage.js b/features/harness/SpacePage.js index 5d1ee9232..6f9f93fd8 100644 --- a/features/harness/SpacePage.js +++ b/features/harness/SpacePage.js @@ -1,7 +1,4 @@ -import assert$0 from "assert"; import Page from "./Page.js"; -import RoomCardComponent from "./RoomCardComponent.js"; -const assert = assert$0.strict; class SpacePage extends Page { constructor(driver, space) { super(driver); @@ -13,23 +10,5 @@ class SpacePage extends Page { path() { return `/spaces/${this.space.slug}`; } - /** - * @param {Room} room - * @returns {RoomCardComponent} - */ - roomCard(room) { - return new RoomCardComponent(this.driver, room); - } - /** - * - * @param {*} filters - * @returns {Promise elements.map((e) => new RoomCardComponent(e))); - } } export default SpacePage; diff --git a/features/rooms/entering-rooms.feature b/features/rooms/entering-rooms.feature deleted file mode 100644 index bda3d561f..000000000 --- a/features/rooms/entering-rooms.feature +++ /dev/null @@ -1,45 +0,0 @@ -Feature: Entering Rooms - In order to interact with other People - I want to enter a Room - - Rooms are where People gather, and can be entered in a number of ways. - - Most frequently, we expect people to enter a Room from their Space - dashboard or by leaving one Room to enter another. - - However, we also want to support Reople entering a Room via - the Room's full URI or from a short URI when a Space has a Branded Domain. - - Background: - Given a "System Test" Space - - @built - Scenario: Entering Room via Room Picker from Space Dashboard - Given the Space Member is on the "System Test" Space Dashboard - When the Space Member taps the "Room 1" Room in the Room Picker - Then the Space Member is placed in the "Room 1" Room - - @built - Scenario: Entering Room via Room Picker from another Room - Given the Space Member is in the "System Test" Space and in the "Room 1" Room - When the Space Member taps the "Room 2" Room in the Room Picker - Then the Space Member is placed in the "Room 2" Room - - @built @unimplemented-steps - Scenario: Entering Room via Slug on a Branded Domain - Given a Space with a Branded Domain - When I visit a Room's using a slug on their Branded Domain - Then I am in the Room - - @built - Scenario: Entering Room via Room full URL - When the Space Member visit the "System Test" Space, "Room 1" Room full URL - Then the Space Member is placed in the "Room 1" Room - - @built @unimplemented-steps - Scenario: Entering Room via back button - Given the Space Member is in the "System Test" Space and in the "Room 1" Room - When the Space Member taps the "Room 2" Room in the Room Picker - And the Space Member is placed in the "Room 2" Room - And the Space Member hit the back button - Then the Space Member is placed in the "Room 1" Room diff --git a/features/steps/deployment_steps.js b/features/steps/deployment_steps.js deleted file mode 100644 index 53099bdd6..000000000 --- a/features/steps/deployment_steps.js +++ /dev/null @@ -1,9 +0,0 @@ -import { Given, When, Then } from "@cucumber/cucumber"; -When("I visit the fresh Convene deployment", function () { - // Write code here that turns the phrase above into concrete actions - return "pending"; -}); -Given("a fresh Convene deployment", function () { - // Write code here that turns the phrase above into concrete actions - return "pending"; -}); diff --git a/features/steps/generic_step.js b/features/steps/generic_step.js deleted file mode 100644 index ac84ddfbc..000000000 --- a/features/steps/generic_step.js +++ /dev/null @@ -1,4 +0,0 @@ -import { When } from "@cucumber/cucumber"; -When("the {actor} hit the back button", async function (actor) { - await this.driver.navigate().back(); -}); diff --git a/features/steps/identification_steps.js b/features/steps/identification_steps.js index f58ea865d..b8f073e2e 100644 --- a/features/steps/identification_steps.js +++ b/features/steps/identification_steps.js @@ -1,7 +1,7 @@ import assert$0 from "assert"; import { Given, When, Then } from "@cucumber/cucumber"; -import { SignInPage, SpacePage, MePage } from "../harness/Pages.js"; -import { Space, Actor } from "../lib/index.js"; +import { SignInPage, MePage } from "../harness/Pages.js"; +import { Actor } from "../lib/index.js"; const assert = assert$0.strict; Given( "an unauthenticated {actor} has requested to be identified to {a} {space} via Email", diff --git a/features/steps/invitation_steps.js b/features/steps/invitation_steps.js index 44d7a80d5..21091bc81 100644 --- a/features/steps/invitation_steps.js +++ b/features/steps/invitation_steps.js @@ -129,20 +129,3 @@ Then( ); }, ); -Then( - "all other Invitations to {actor} for {a} {space} no longer have {a} status of {string}", - /** - * @param {Actor} actor - * @param {Space} space - * @param {string} status - */ - function (actor, _a, space, _a2, status) { - return actor - .signIn(this.driver, space) - .then(() => new MembershipsIndexPage(this.driver, space).visit()) - .then((page) => page.invitations({ to: actor })) - .then((invitations) => - assert(invitations.every((i) => i.status !== status)), - ); - }, -); diff --git a/features/steps/room_steps.js b/features/steps/room_steps.js index 240fd93cd..0b67c4e6c 100644 --- a/features/steps/room_steps.js +++ b/features/steps/room_steps.js @@ -1,20 +1,4 @@ -import { Given, When, Then } from "@cucumber/cucumber"; -import { - SpacePage, - SpaceEditPage, - RoomEditPage, - RoomPage, -} from "../harness/Pages.js"; -import { RoomCardComponent } from "../harness/Components.js"; -import { - Space, - Room, - Actor, - linkParameters, - AccessLevel, -} from "../lib/index.js"; -import assert$0 from "assert"; -const assert = assert$0.strict; +import { Given, Then } from "@cucumber/cucumber"; Given( "{a} {space} with {a} {accessLevel} {room}", async function (_, space, _1, accessLevel, room) { @@ -29,30 +13,7 @@ Given( }, ); -When("the {actor} taps the {room} in the Room Picker", function (actor, room) { - return this.space.roomCard(room).enter(); -}); -Then("the {actor} is placed in the {room}", async function (actor, room) { - const roomPage = new RoomPage(this.driver, room); - assert(await roomPage.hasContent(room.name)); -}); -Then("the {actor} is not placed in the {room}", function (actor, room) { - // Write code here that turns the phrase above into concrete actions - return "pending"; -}); - Then("the {space} has a {room}", function (space, room) { // Write code here that turns the phrase above into concrete actions return "pending"; }); -Then( - "the {actor} does not see the {room}'s Door", - async function (actor, room) { - const card = new RoomCardComponent(this.driver, room); - assert(!(await card.isDisplayed())); - }, -); -Then("{a} {room} is {accessLevel}", async function (_a, room, accessLevel) { - const { space } = linkParameters({ room, accessLevel }); - await new SpacePage(this.driver, space).visit(); -}); diff --git a/features/steps/space_steps.js b/features/steps/space_steps.js index aca2a37fc..d84e5ffb3 100644 --- a/features/steps/space_steps.js +++ b/features/steps/space_steps.js @@ -1,11 +1,11 @@ -import { Given, When, Then } from "@cucumber/cucumber"; -import { RoomPage, SpacePage, SpaceEditPage } from "../harness/Pages.js"; +import { Given, When } from "@cucumber/cucumber"; +import { SpacePage, SpaceEditPage } from "../harness/Pages.js"; import { linkParameters, Actor, Space } from "../lib/index.js"; import appUrl from "../lib/appUrl.js"; import { Api } from "../lib/Api.js"; import AuthenticationMethod from "../lib/AuthenticationMethod.js"; import Membership from "../lib/Membership.js"; -import crypto from "crypto"; + Given("{a} {space}", function (_, space) { this.spaces = this.spaces || {}; return this.api() @@ -49,10 +49,7 @@ Given( ); }, ); -Given("the {actor} is on the {space} Dashboard", async function (actor, space) { - this.space = new SpacePage(this.driver, space); - await this.space.visit(); -}); + When( "{a} {actor} visits {a} {space}", /** @@ -63,41 +60,14 @@ When( * @param {Space} space * @returns */ - function (_a, actor, _a2, space) { + function (_a, _actor, _a2, space) { this.space = new SpacePage(this.driver, space); return this.space.visit(); }, ); -Given( - "the {actor} is in the {space} and in the {room}", - function (actor, space, room) { - this.space = new SpacePage(this.driver, space); - return this.space - .visit() - .then((spacePage) => spacePage.roomCard(room).enter()); - }, -); + When("a {actor} adds a {room}", function (actor, room) { const { space } = linkParameters({ actor, room }); const page = new SpaceEditPage(this.driver, space); return page.visit().then((p) => p.createRoom({ room })); }); -When( - "the {actor} visit the {space}, {room} full URL", - function (actor, space, room) { - this.space = new SpacePage(this.driver, space); - room.space = space; - return new RoomPage(this.driver, room).visit(); - }, -); -Then( - "the {space} is available at the {string} domain", - function (space, string) { - // Write code here that turns the phrase above into concrete actions - return "pending"; - }, -); -Then("there is a {space}", function (space) { - // Write code here that turns the phrase above into concrete actions - return "pending"; -}); diff --git a/features/steps/utility_steps.js b/features/steps/utility_steps.js index 056a46126..b41d77100 100644 --- a/features/steps/utility_steps.js +++ b/features/steps/utility_steps.js @@ -2,19 +2,6 @@ import { When, Then } from "@cucumber/cucumber"; import { SpaceEditPage } from "../harness/Pages.js"; import { Actor, Space } from "../lib/index.js"; -When("a Space Owner adds a Utility to their Space", async function () { - this.actor = new Actor("Space Owner", "space-owner@example.com"); - await this.actor.signIn(this.driver); - this.space = new Space({ name: "System Test" }); - const page = new SpaceEditPage(this.driver, this.space); - await page.visit().then((p) => p.addUtility("stripe")); -}); - -Then("the Space Owner can configure that Utility for their Space", function () { - // Write code here that turns the phrase above into concrete actions - return "pending"; -}); - Then("that Utility can not be used by Furniture in the Space", function () { // Write code here that turns the phrase above into concrete actions return "pending"; diff --git a/spec/furniture/section_navigation/factories.rb b/spec/furniture/section_navigation/factories.rb new file mode 100644 index 000000000..0eb19e905 --- /dev/null +++ b/spec/furniture/section_navigation/factories.rb @@ -0,0 +1,5 @@ +FactoryBot.define do + factory :section_navigation, class: "SectionNavigation::SectionNavigation" do + room + end +end diff --git a/spec/furniture/section_navigation/section_navigation_system_spec.rb b/spec/furniture/section_navigation/section_navigation_system_spec.rb new file mode 100644 index 000000000..00277ab9e --- /dev/null +++ b/spec/furniture/section_navigation/section_navigation_system_spec.rb @@ -0,0 +1,16 @@ +require "rails_helper" +require_relative "factories" + +RSpec.describe SectionNavigation, type: :system do + it "includes a link to every section except the entrance" do + space = create(:space, :with_entrance) + rooms = create_list(:room, 2, space:) + create(:section_navigation, room: space.entrance) + + visit polymorphic_path(space.entrance.location) + + expect(page).to have_link(rooms.first.name, href: polymorphic_path(rooms.first.location)) + expect(page).to have_link(rooms.last.name, href: polymorphic_path(rooms.last.location)) + expect(page).not_to have_link(space.entrance.name, href: polymorphic_path(space.entrance.location)) + end +end