Skip to content
Open
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
33 changes: 33 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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}"
// }
// ]
// }
4 changes: 2 additions & 2 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"baseUrl": "http://localhost:3001"
}
"baseUrl": "http://localhost:3002"
}
5 changes: 5 additions & 0 deletions cypress/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"plugin:cypress/recommended"
]
}
5 changes: 0 additions & 5 deletions cypress/fixtures/profile.json

This file was deleted.

232 changes: 0 additions & 232 deletions cypress/fixtures/users.json

This file was deleted.

15 changes: 15 additions & 0 deletions cypress/integration/Designer.spec.js
Original file line number Diff line number Diff line change
@@ -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');
})

})
15 changes: 15 additions & 0 deletions cypress/integration/Developer.spec.js
Original file line number Diff line number Diff line change
@@ -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');
})

})
15 changes: 15 additions & 0 deletions cypress/integration/Home.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('/', function () {
beforeEach(() => {
cy.login();
})

afterEach(() => {
cy.logout();
})

it('has place holder header', () => {
cy.visit('/');
cy.contains('h1', 'Home');
})

})
55 changes: 55 additions & 0 deletions cypress/integration/Login.spec.js
Original file line number Diff line number Diff line change
@@ -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
})
Loading