diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..e560466 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,33 @@ +// Copied from https://create-react-app.dev/docs/setting-up-your-editor +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Chrome", + "type": "chrome", + "request": "launch", + "url": "http://localhost:3000", + "webRoot": "${workspaceFolder}/src", + "sourceMapPathOverrides": { + "webpack:///src/*": "${webRoot}/*" + } + } + ] +} + +// Initial +// { +// // Use IntelliSense to learn about possible attributes. +// // Hover to view descriptions of existing attributes. +// // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +// "version": "0.2.0", +// "configurations": [ +// { +// "type": "pwa-chrome", +// "request": "launch", +// "name": "Launch Chrome against localhost", +// "url": "http://localhost:8080", +// "webRoot": "${workspaceFolder}" +// } +// ] +// } \ No newline at end of file diff --git a/cypress.json b/cypress.json index 210949c..beebe97 100644 --- a/cypress.json +++ b/cypress.json @@ -1,3 +1,3 @@ { - "baseUrl": "http://localhost:3001" -} + "baseUrl": "http://localhost:3002" +} \ No newline at end of file diff --git a/cypress/.eslintrc.json b/cypress/.eslintrc.json new file mode 100644 index 0000000..b677df5 --- /dev/null +++ b/cypress/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "plugin:cypress/recommended" + ] +} \ No newline at end of file diff --git a/cypress/fixtures/profile.json b/cypress/fixtures/profile.json deleted file mode 100644 index b6c355c..0000000 --- a/cypress/fixtures/profile.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "id": 8739, - "name": "Jane", - "email": "jane@example.com" -} \ No newline at end of file diff --git a/cypress/fixtures/users.json b/cypress/fixtures/users.json deleted file mode 100644 index 79b699a..0000000 --- a/cypress/fixtures/users.json +++ /dev/null @@ -1,232 +0,0 @@ -[ - { - "id": 1, - "name": "Leanne Graham", - "username": "Bret", - "email": "Sincere@april.biz", - "address": { - "street": "Kulas Light", - "suite": "Apt. 556", - "city": "Gwenborough", - "zipcode": "92998-3874", - "geo": { - "lat": "-37.3159", - "lng": "81.1496" - } - }, - "phone": "1-770-736-8031 x56442", - "website": "hildegard.org", - "company": { - "name": "Romaguera-Crona", - "catchPhrase": "Multi-layered client-server neural-net", - "bs": "harness real-time e-markets" - } - }, - { - "id": 2, - "name": "Ervin Howell", - "username": "Antonette", - "email": "Shanna@melissa.tv", - "address": { - "street": "Victor Plains", - "suite": "Suite 879", - "city": "Wisokyburgh", - "zipcode": "90566-7771", - "geo": { - "lat": "-43.9509", - "lng": "-34.4618" - } - }, - "phone": "010-692-6593 x09125", - "website": "anastasia.net", - "company": { - "name": "Deckow-Crist", - "catchPhrase": "Proactive didactic contingency", - "bs": "synergize scalable supply-chains" - } - }, - { - "id": 3, - "name": "Clementine Bauch", - "username": "Samantha", - "email": "Nathan@yesenia.net", - "address": { - "street": "Douglas Extension", - "suite": "Suite 847", - "city": "McKenziehaven", - "zipcode": "59590-4157", - "geo": { - "lat": "-68.6102", - "lng": "-47.0653" - } - }, - "phone": "1-463-123-4447", - "website": "ramiro.info", - "company": { - "name": "Romaguera-Jacobson", - "catchPhrase": "Face to face bifurcated interface", - "bs": "e-enable strategic applications" - } - }, - { - "id": 4, - "name": "Patricia Lebsack", - "username": "Karianne", - "email": "Julianne.OConner@kory.org", - "address": { - "street": "Hoeger Mall", - "suite": "Apt. 692", - "city": "South Elvis", - "zipcode": "53919-4257", - "geo": { - "lat": "29.4572", - "lng": "-164.2990" - } - }, - "phone": "493-170-9623 x156", - "website": "kale.biz", - "company": { - "name": "Robel-Corkery", - "catchPhrase": "Multi-tiered zero tolerance productivity", - "bs": "transition cutting-edge web services" - } - }, - { - "id": 5, - "name": "Chelsey Dietrich", - "username": "Kamren", - "email": "Lucio_Hettinger@annie.ca", - "address": { - "street": "Skiles Walks", - "suite": "Suite 351", - "city": "Roscoeview", - "zipcode": "33263", - "geo": { - "lat": "-31.8129", - "lng": "62.5342" - } - }, - "phone": "(254)954-1289", - "website": "demarco.info", - "company": { - "name": "Keebler LLC", - "catchPhrase": "User-centric fault-tolerant solution", - "bs": "revolutionize end-to-end systems" - } - }, - { - "id": 6, - "name": "Mrs. Dennis Schulist", - "username": "Leopoldo_Corkery", - "email": "Karley_Dach@jasper.info", - "address": { - "street": "Norberto Crossing", - "suite": "Apt. 950", - "city": "South Christy", - "zipcode": "23505-1337", - "geo": { - "lat": "-71.4197", - "lng": "71.7478" - } - }, - "phone": "1-477-935-8478 x6430", - "website": "ola.org", - "company": { - "name": "Considine-Lockman", - "catchPhrase": "Synchronised bottom-line interface", - "bs": "e-enable innovative applications" - } - }, - { - "id": 7, - "name": "Kurtis Weissnat", - "username": "Elwyn.Skiles", - "email": "Telly.Hoeger@billy.biz", - "address": { - "street": "Rex Trail", - "suite": "Suite 280", - "city": "Howemouth", - "zipcode": "58804-1099", - "geo": { - "lat": "24.8918", - "lng": "21.8984" - } - }, - "phone": "210.067.6132", - "website": "elvis.io", - "company": { - "name": "Johns Group", - "catchPhrase": "Configurable multimedia task-force", - "bs": "generate enterprise e-tailers" - } - }, - { - "id": 8, - "name": "Nicholas Runolfsdottir V", - "username": "Maxime_Nienow", - "email": "Sherwood@rosamond.me", - "address": { - "street": "Ellsworth Summit", - "suite": "Suite 729", - "city": "Aliyaview", - "zipcode": "45169", - "geo": { - "lat": "-14.3990", - "lng": "-120.7677" - } - }, - "phone": "586.493.6943 x140", - "website": "jacynthe.com", - "company": { - "name": "Abernathy Group", - "catchPhrase": "Implemented secondary concept", - "bs": "e-enable extensible e-tailers" - } - }, - { - "id": 9, - "name": "Glenna Reichert", - "username": "Delphine", - "email": "Chaim_McDermott@dana.io", - "address": { - "street": "Dayna Park", - "suite": "Suite 449", - "city": "Bartholomebury", - "zipcode": "76495-3109", - "geo": { - "lat": "24.6463", - "lng": "-168.8889" - } - }, - "phone": "(775)976-6794 x41206", - "website": "conrad.com", - "company": { - "name": "Yost and Sons", - "catchPhrase": "Switchable contextually-based project", - "bs": "aggregate real-time technologies" - } - }, - { - "id": 10, - "name": "Clementina DuBuque", - "username": "Moriah.Stanton", - "email": "Rey.Padberg@karina.biz", - "address": { - "street": "Kattie Turnpike", - "suite": "Suite 198", - "city": "Lebsackbury", - "zipcode": "31428-2261", - "geo": { - "lat": "-38.2386", - "lng": "57.2232" - } - }, - "phone": "024-648-3804", - "website": "ambrose.net", - "company": { - "name": "Hoeger LLC", - "catchPhrase": "Centralized empowering task-force", - "bs": "target end-to-end models" - } - } -] \ No newline at end of file diff --git a/cypress/integration/Designer.spec.js b/cypress/integration/Designer.spec.js new file mode 100644 index 0000000..aec641f --- /dev/null +++ b/cypress/integration/Designer.spec.js @@ -0,0 +1,15 @@ +describe('/designer', function () { + beforeEach(() => { + cy.login(); + }) + + afterEach(() => { + cy.logout(); + }) + + it('has place holder header', () => { + cy.visit('/designer'); + cy.contains('h1', 'Designer'); + }) + +}) \ No newline at end of file diff --git a/cypress/integration/Developer.spec.js b/cypress/integration/Developer.spec.js new file mode 100644 index 0000000..e8d1229 --- /dev/null +++ b/cypress/integration/Developer.spec.js @@ -0,0 +1,15 @@ +describe('/developer', function () { + beforeEach(() => { + cy.login(); + }) + + afterEach(() => { + cy.logout(); + }) + + it('has place holder header', () => { + cy.visit('/developer'); + cy.contains('h1', 'Developer'); + }) + +}) \ No newline at end of file diff --git a/cypress/integration/Home.spec.js b/cypress/integration/Home.spec.js new file mode 100644 index 0000000..561a0d3 --- /dev/null +++ b/cypress/integration/Home.spec.js @@ -0,0 +1,15 @@ +describe('/', function () { + beforeEach(() => { + cy.login(); + }) + + afterEach(() => { + cy.logout(); + }) + + it('has place holder header', () => { + cy.visit('/'); + cy.contains('h1', 'Home'); + }) + +}) \ No newline at end of file diff --git a/cypress/integration/Login.spec.js b/cypress/integration/Login.spec.js new file mode 100644 index 0000000..9f5ab0f --- /dev/null +++ b/cypress/integration/Login.spec.js @@ -0,0 +1,55 @@ +/* eslint-disable jest/valid-expect */ +describe('/login', function () { + beforeEach(() => { + cy.clearLocalStorage() + cy.visit('/login') + }) + + it('greets with powered by aquarium', () => { + cy.contains('h6', 'Powered by Aquarium') + }) + + it('requires username', () => { + cy.get('form').contains('SIGN IN').click() + cy.get('p').should('contain', 'Invalid login/password combination') + }) + + it('requires password, enter submits form', () => { + cy.get('[data-test=username]').type('maggie{enter}') + cy.get('p').should('contain', 'Invalid login/password combination') + }) + + it('requires valid username and password', () => { + cy.get('[data-test=username]').type('marikoa') + cy.get('[data-test=password]').type('invalid') + cy.get('form').contains('SIGN IN').click() + cy.get('p').should('contain', 'Invalid login/password combination') + }) + + it('navigates to / on successful login', () => { + cy.window() + .then((win) => { + // eslint-disable-next-line no-unused-expressions + expect(win.localStorage.token).to.be.undefined + }) + + cy.get('[data-test=username]').type('marikoa') + cy.get('[data-test=password]').type('MtXzwmLYTDq5Gucr') + cy.get('form').contains('SIGN IN').click() + cy.url().should('eq', 'http://localhost:3002/aquarium/v3/') + + + let token + + cy.window() + .then((win) => { + token = win.localStorage.token + }) + .then(() => { + // eslint-disable-next-line no-unused-expressions + expect(token).to.exist + }) + }) + + // TODO: test localstorage for token after login +}) \ No newline at end of file diff --git a/cypress/integration/Logout.spec.js b/cypress/integration/Logout.spec.js new file mode 100644 index 0000000..2ce62f0 --- /dev/null +++ b/cypress/integration/Logout.spec.js @@ -0,0 +1,29 @@ +/* eslint-disable jest/valid-expect */ +describe('/logout', function () { + beforeEach(() => { + cy.login() + }) + + it('has place holder header', () => { + cy.visit('/logout') + + let token + + cy.window() + .then((win) => { + token = win.localStorage.token + }) + .then(() => { + // eslint-disable-next-line no-unused-expressions + expect(token).to.exist + }) + cy.contains('button', 'SIGN OUT').click() + cy.url().should('contain', '/aquarium/v3/login') + cy.window() + .then((win) => { + // eslint-disable-next-line no-unused-expressions + expect(win.localStorage.token).to.be.undefined + }) + }) + +}) \ No newline at end of file diff --git a/cypress/integration/Manager.spec.js b/cypress/integration/Manager.spec.js new file mode 100644 index 0000000..9f865b3 --- /dev/null +++ b/cypress/integration/Manager.spec.js @@ -0,0 +1,15 @@ +describe('/manager', function () { + beforeEach(() => { + cy.login(); + }) + + afterEach(() => { + cy.logout(); + }) + + it('has place holder header', () => { + cy.visit('/manager'); + cy.contains('h1', 'Manager'); + }) + +}) \ No newline at end of file diff --git a/cypress/integration/Plan.spec.js b/cypress/integration/Plan.spec.js new file mode 100644 index 0000000..195d6ce --- /dev/null +++ b/cypress/integration/Plan.spec.js @@ -0,0 +1,15 @@ +describe('/plan', function () { + beforeEach(() => { + cy.login(); + }) + + afterEach(() => { + cy.logout(); + }) + + it('has place holder header', () => { + cy.visit('/plan'); + cy.contains('h1', 'Plan'); + }) + +}) \ No newline at end of file diff --git a/cypress/integration/Samples.spec.js b/cypress/integration/Samples.spec.js new file mode 100644 index 0000000..2f2208a --- /dev/null +++ b/cypress/integration/Samples.spec.js @@ -0,0 +1,15 @@ +describe('/samples', function () { + beforeEach(() => { + cy.login(); + }) + + afterEach(() => { + cy.logout(); + }) + + it('has place holder header', () => { + cy.visit('/samples'); + cy.contains('h1', 'Samples'); + }) + +}) \ No newline at end of file diff --git a/cypress/integration/examples/actions.spec.js b/cypress/integration/examples/actions.spec.js deleted file mode 100644 index ef430ed..0000000 --- a/cypress/integration/examples/actions.spec.js +++ /dev/null @@ -1,299 +0,0 @@ -/// - -context('Actions', () => { - beforeEach(() => { - cy.visit('https://example.cypress.io/commands/actions') - }) - - // https://on.cypress.io/interacting-with-elements - - it('.type() - type into a DOM element', () => { - // https://on.cypress.io/type - cy.get('.action-email') - .type('fake@email.com').should('have.value', 'fake@email.com') - - // .type() with special character sequences - .type('{leftarrow}{rightarrow}{uparrow}{downarrow}') - .type('{del}{selectall}{backspace}') - - // .type() with key modifiers - .type('{alt}{option}') //these are equivalent - .type('{ctrl}{control}') //these are equivalent - .type('{meta}{command}{cmd}') //these are equivalent - .type('{shift}') - - // Delay each keypress by 0.1 sec - .type('slow.typing@email.com', { delay: 100 }) - .should('have.value', 'slow.typing@email.com') - - cy.get('.action-disabled') - // Ignore error checking prior to type - // like whether the input is visible or disabled - .type('disabled error checking', { force: true }) - .should('have.value', 'disabled error checking') - }) - - it('.focus() - focus on a DOM element', () => { - // https://on.cypress.io/focus - cy.get('.action-focus').focus() - .should('have.class', 'focus') - .prev().should('have.attr', 'style', 'color: orange;') - }) - - it('.blur() - blur off a DOM element', () => { - // https://on.cypress.io/blur - cy.get('.action-blur').type('About to blur').blur() - .should('have.class', 'error') - .prev().should('have.attr', 'style', 'color: red;') - }) - - it('.clear() - clears an input or textarea element', () => { - // https://on.cypress.io/clear - cy.get('.action-clear').type('Clear this text') - .should('have.value', 'Clear this text') - .clear() - .should('have.value', '') - }) - - it('.submit() - submit a form', () => { - // https://on.cypress.io/submit - cy.get('.action-form') - .find('[type="text"]').type('HALFOFF') - - cy.get('.action-form').submit() - .next().should('contain', 'Your form has been submitted!') - }) - - it('.click() - click on a DOM element', () => { - // https://on.cypress.io/click - cy.get('.action-btn').click() - - // You can click on 9 specific positions of an element: - // ----------------------------------- - // | topLeft top topRight | - // | | - // | | - // | | - // | left center right | - // | | - // | | - // | | - // | bottomLeft bottom bottomRight | - // ----------------------------------- - - // clicking in the center of the element is the default - cy.get('#action-canvas').click() - - cy.get('#action-canvas').click('topLeft') - cy.get('#action-canvas').click('top') - cy.get('#action-canvas').click('topRight') - cy.get('#action-canvas').click('left') - cy.get('#action-canvas').click('right') - cy.get('#action-canvas').click('bottomLeft') - cy.get('#action-canvas').click('bottom') - cy.get('#action-canvas').click('bottomRight') - - // .click() accepts an x and y coordinate - // that controls where the click occurs :) - - cy.get('#action-canvas') - .click(80, 75) // click 80px on x coord and 75px on y coord - .click(170, 75) - .click(80, 165) - .click(100, 185) - .click(125, 190) - .click(150, 185) - .click(170, 165) - - // click multiple elements by passing multiple: true - cy.get('.action-labels>.label').click({ multiple: true }) - - // Ignore error checking prior to clicking - cy.get('.action-opacity>.btn').click({ force: true }) - }) - - it('.dblclick() - double click on a DOM element', () => { - // https://on.cypress.io/dblclick - - // Our app has a listener on 'dblclick' event in our 'scripts.js' - // that hides the div and shows an input on double click - cy.get('.action-div').dblclick().should('not.be.visible') - cy.get('.action-input-hidden').should('be.visible') - }) - - it('.rightclick() - right click on a DOM element', () => { - // https://on.cypress.io/rightclick - - // Our app has a listener on 'contextmenu' event in our 'scripts.js' - // that hides the div and shows an input on right click - cy.get('.rightclick-action-div').rightclick().should('not.be.visible') - cy.get('.rightclick-action-input-hidden').should('be.visible') - }) - - it('.check() - check a checkbox or radio element', () => { - // https://on.cypress.io/check - - // By default, .check() will check all - // matching checkbox or radio elements in succession, one after another - cy.get('.action-checkboxes [type="checkbox"]').not('[disabled]') - .check().should('be.checked') - - cy.get('.action-radios [type="radio"]').not('[disabled]') - .check().should('be.checked') - - // .check() accepts a value argument - cy.get('.action-radios [type="radio"]') - .check('radio1').should('be.checked') - - // .check() accepts an array of values - cy.get('.action-multiple-checkboxes [type="checkbox"]') - .check(['checkbox1', 'checkbox2']).should('be.checked') - - // Ignore error checking prior to checking - cy.get('.action-checkboxes [disabled]') - .check({ force: true }).should('be.checked') - - cy.get('.action-radios [type="radio"]') - .check('radio3', { force: true }).should('be.checked') - }) - - it('.uncheck() - uncheck a checkbox element', () => { - // https://on.cypress.io/uncheck - - // By default, .uncheck() will uncheck all matching - // checkbox elements in succession, one after another - cy.get('.action-check [type="checkbox"]') - .not('[disabled]') - .uncheck().should('not.be.checked') - - // .uncheck() accepts a value argument - cy.get('.action-check [type="checkbox"]') - .check('checkbox1') - .uncheck('checkbox1').should('not.be.checked') - - // .uncheck() accepts an array of values - cy.get('.action-check [type="checkbox"]') - .check(['checkbox1', 'checkbox3']) - .uncheck(['checkbox1', 'checkbox3']).should('not.be.checked') - - // Ignore error checking prior to unchecking - cy.get('.action-check [disabled]') - .uncheck({ force: true }).should('not.be.checked') - }) - - it('.select() - select an option in a