diff --git a/ui/.browserslistrc b/jam-ui/.browserslistrc similarity index 100% rename from ui/.browserslistrc rename to jam-ui/.browserslistrc diff --git a/jam-ui/.env.development b/jam-ui/.env.development new file mode 100644 index 000000000..03d0588a9 --- /dev/null +++ b/jam-ui/.env.development @@ -0,0 +1,2 @@ +REACT_APP_LEGACY_BASE_URL=http://www.jamkazam.local:4000/ +REACT_APP_API_BASE_URL=http://www.jamkazam.local:4000/api \ No newline at end of file diff --git a/ui/.eslintrc.json b/jam-ui/.eslintrc.json similarity index 100% rename from ui/.eslintrc.json rename to jam-ui/.eslintrc.json diff --git a/ui/.gitignore b/jam-ui/.gitignore similarity index 100% rename from ui/.gitignore rename to jam-ui/.gitignore diff --git a/ui/.gitlab-ci.yml b/jam-ui/.gitlab-ci.yml similarity index 100% rename from ui/.gitlab-ci.yml rename to jam-ui/.gitlab-ci.yml diff --git a/ui/.prettierrc b/jam-ui/.prettierrc similarity index 100% rename from ui/.prettierrc rename to jam-ui/.prettierrc diff --git a/ui/README.md b/jam-ui/README.md similarity index 100% rename from ui/README.md rename to jam-ui/README.md diff --git a/jam-ui/cypress.json b/jam-ui/cypress.json new file mode 100644 index 000000000..db361ab92 --- /dev/null +++ b/jam-ui/cypress.json @@ -0,0 +1,6 @@ +{ + "baseUrl": "http://beta.jamkazam.local:3000", + "env": { + "apiBaseUrl": "http://www.jamkazam.local:4000/api" + } +} diff --git a/jam-ui/cypress/fixtures/example.json b/jam-ui/cypress/fixtures/example.json new file mode 100644 index 000000000..02e425437 --- /dev/null +++ b/jam-ui/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} diff --git a/jam-ui/cypress/fixtures/people.json b/jam-ui/cypress/fixtures/people.json new file mode 100644 index 000000000..7e8d7e384 --- /dev/null +++ b/jam-ui/cypress/fixtures/people.json @@ -0,0 +1,163 @@ +{ + "musicians": [ + { + "id": "1", + "first_name": "Test", + "last_name": "User", + "name": "Test User", + "city": "City", + "state": "NC", + "country": "US", + "online": false, + "musician": true, + "photo_url": null, + "biography": "", + "full_score": null, + "instruments": [], + "followings": [], + "is_friend": false, + "is_following": false, + "pending_friend_request": false, + "friend_count": 0, + "follow_count": 0, + "recording_count": 0, + "session_count": 0, + "audio_latency": null + }, + { + "id": "a09f9a7e-afb7-489d-870d-e13a336e0b97", + "first_name": "Seth", + "last_name": "Call", + "name": "Seth Call", + "city": "Austin", + "state": "TX", + "country": "US", + "online": false, + "musician": true, + "photo_url": null, + "biography": "", + "full_score": null, + "instruments": [ + { "instrument_id": "acoustic guitar", "description": "Acoustic Guitar", "proficiency_level": 3, "priority": 1 } + ], + "followings": [], + "is_friend": false, + "is_following": false, + "pending_friend_request": false, + "friend_count": 0, + "follow_count": 0, + "recording_count": 0, + "session_count": 0, + "audio_latency": null + }, + { + "id": "3dfca858-0e7c-4ad4-993a-c39421d93853", + "first_name": "Peter", + "last_name": "Walker", + "name": "Peter Walker", + "city": "Austin", + "state": "TX", + "country": "US", + "online": false, + "musician": true, + "photo_url": null, + "biography": "", + "full_score": null, + "instruments": [ + { "instrument_id": "acoustic guitar", "description": "Acoustic Guitar", "proficiency_level": 3, "priority": 1 } + ], + "followings": [], + "is_friend": false, + "is_following": false, + "pending_friend_request": false, + "friend_count": 0, + "follow_count": 0, + "recording_count": 0, + "session_count": 0, + "audio_latency": null + }, + { + "id": "963d5268-66b6-463a-a3ee-c97f274fc23f", + "first_name": "Peter", + "last_name": "Walker", + "name": "Peter Walker", + "city": "Austin", + "state": "TX", + "country": "US", + "online": false, + "musician": true, + "photo_url": null, + "biography": "", + "full_score": null, + "instruments": [ + { "instrument_id": "acoustic guitar", "description": "Acoustic Guitar", "proficiency_level": 3, "priority": 1 } + ], + "followings": [], + "is_friend": false, + "is_following": false, + "pending_friend_request": false, + "friend_count": 0, + "follow_count": 0, + "recording_count": 0, + "session_count": 0, + "audio_latency": null + }, + { + "id": "feb671a3-1821-48f0-bc14-aa26cf98bb25", + "first_name": "David", + "last_name": "Wilson", + "name": "David Wilson", + "city": "Austin", + "state": "TX", + "country": "US", + "online": false, + "musician": true, + "photo_url": null, + "biography": "", + "full_score": null, + "instruments": [ + { "instrument_id": "acoustic guitar", "description": "Acoustic Guitar", "proficiency_level": 3, "priority": 1 } + ], + "followings": [], + "is_friend": false, + "is_following": false, + "pending_friend_request": false, + "friend_count": 0, + "follow_count": 0, + "recording_count": 0, + "session_count": 0, + "audio_latency": null + }, + { + "id": "b1ddadd0-0263-47c4-bf91-e7767f386970", + "first_name": "Oswald", + "last_name": "Becca", + "name": "Oswald Becca", + "city": "Austin", + "state": "TX", + "country": "US", + "online": false, + "musician": true, + "photo_url": null, + "biography": "", + "full_score": null, + "instruments": [ + { "instrument_id": "acoustic guitar", "description": "Acoustic Guitar", "proficiency_level": 3, "priority": 1 } + ], + "followings": [], + "is_friend": false, + "is_following": false, + "pending_friend_request": false, + "friend_count": 0, + "follow_count": 0, + "recording_count": 0, + "session_count": 0, + "audio_latency": null + } + ], + "page_count": 1, + "my_audio_latency": 5, + "filter_json": "{\"id\":\"68dcc055-cb5d-40d6-8ed4-66772d1a1a31\",\"user_id\":\"27bd4a30-d1b8-4eea-8454-01a104d59381\",\"foreign_key1_id\":null,\"data_blob\":{\"sort_order\":\"latency\",\"instruments\":[],\"genres\":[],\"concert_gigs\":\"-1\",\"interests\":\"any\",\"studio_sessions\":\"-1\",\"ages\":[],\"skill_level\":\"-1\"}}", + "description": "Current Search: Sort = Latency to Me", + "is_blank_filter": false +} diff --git a/jam-ui/cypress/integration/1-getting-started/todo.spec.js b/jam-ui/cypress/integration/1-getting-started/todo.spec.js new file mode 100644 index 000000000..4768ff923 --- /dev/null +++ b/jam-ui/cypress/integration/1-getting-started/todo.spec.js @@ -0,0 +1,143 @@ +/// + +// Welcome to Cypress! +// +// This spec file contains a variety of sample tests +// for a todo list app that are designed to demonstrate +// the power of writing tests in Cypress. +// +// To learn more about how Cypress works and +// what makes it such an awesome testing tool, +// please read our getting started guide: +// https://on.cypress.io/introduction-to-cypress + +describe('example to-do app', () => { + beforeEach(() => { + // Cypress starts out with a blank slate for each test + // so we must tell it to visit our website with the `cy.visit()` command. + // Since we want to visit the same URL at the start of all our tests, + // we include it in our beforeEach function so that it runs before each test + cy.visit('https://example.cypress.io/todo') + }) + + it('displays two todo items by default', () => { + // We use the `cy.get()` command to get all elements that match the selector. + // Then, we use `should` to assert that there are two matched items, + // which are the two default items. + cy.get('.todo-list li').should('have.length', 2) + + // We can go even further and check that the default todos each contain + // the correct text. We use the `first` and `last` functions + // to get just the first and last matched elements individually, + // and then perform an assertion with `should`. + cy.get('.todo-list li').first().should('have.text', 'Pay electric bill') + cy.get('.todo-list li').last().should('have.text', 'Walk the dog') + }) + + it('can add new todo items', () => { + // We'll store our item text in a variable so we can reuse it + const newItem = 'Feed the cat' + + // Let's get the input element and use the `type` command to + // input our new list item. After typing the content of our item, + // we need to type the enter key as well in order to submit the input. + // This input has a data-test attribute so we'll use that to select the + // element in accordance with best practices: + // https://on.cypress.io/selecting-elements + cy.get('[data-test=new-todo]').type(`${newItem}{enter}`) + + // Now that we've typed our new item, let's check that it actually was added to the list. + // Since it's the newest item, it should exist as the last element in the list. + // In addition, with the two default items, we should have a total of 3 elements in the list. + // Since assertions yield the element that was asserted on, + // we can chain both of these assertions together into a single statement. + cy.get('.todo-list li') + .should('have.length', 3) + .last() + .should('have.text', newItem) + }) + + it('can check off an item as completed', () => { + // In addition to using the `get` command to get an element by selector, + // we can also use the `contains` command to get an element by its contents. + // However, this will yield the