# testing
/coverage
+/cypress/videos
+/cypress/screenshots
# production
/build
--- /dev/null
+{
+ "baseUrl": "https://localhost:3000/",
+ "chromeWebSecurity": false
+}
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+describe('Login tests', function() {
+ before(function() {
+ this.email = `account_${Math.random()}@example.com`
+ this.password = Math.random()
+ this.firstName = 'Test'
+ this.lastName = 'User'
+ })
+
+ beforeEach(function() {
+ cy.visit('/')
+ cy.contains('Please log in')
+ cy.get('button').contains('Log in').click()
+ cy.url().should('contain', "/users/sign_in")
+ })
+
+ it('register a new user', function() {
+ cy.get('a[role=button]').contains('Sign up for a new account').click()
+ cy.url().should('contain', '/users/sign_up')
+ cy.get('input[name="user[first_name]"]').type(this.firstName)
+ cy.get('input[name="user[last_name]"]').type(this.lastName)
+ cy.get('input[name="user[email]"]').type(this.email)
+ cy.get('input[name="user[password]"]').type(this.password)
+ cy.get('input[name="user[password_confirmation]"]').type(this.password)
+ cy.get('input[type=submit]').contains('Sign up').click()
+ cy.url().should('contain', '/projects/')
+ cy.get('button[title="Account Management"]').click()
+ cy.get('ul[role=menu] > li[role=menuitem]').contains(`${this.firstName} ${this.lastName}`)
+ })
+
+ it('logs in successfully', function() {
+ cy.get('input[type=email]').type(this.email)
+ cy.get('input[type=password]').type(this.password)
+ cy.get('input[type=submit]').contains('Sign in').click()
+ cy.url().should('contain', '/projects/')
+ cy.get('button[title="Account Management"]').click()
+ cy.get('ul[role=menu] > li[role=menuitem]').contains(`${this.firstName} ${this.lastName}`)
+ })
+
+ it('fails to log in with incorrect password', function() {
+ cy.get('input[type=email]').type(this.email)
+ cy.get('input[type=password]').type('incorrect')
+ cy.get('input[type=submit]').contains('Sign in').click()
+ cy.url().should('contain', "/users/sign_in")
+ cy.get('div.alert').contains('Invalid email or password')
+ })
+})
\ No newline at end of file
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+/// <reference types="cypress" />
+// ***********************************************************
+// This example plugins/index.js can be used to load plugins
+//
+// You can change the location of this file or turn off loading
+// the plugins file with the 'pluginsFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/plugins-guide
+// ***********************************************************
+
+// This function is called when a project is opened or re-opened (e.g. due to
+// the project's config changing)
+
+/**
+ * @type {Cypress.PluginConfig}
+ */
+module.exports = (on, config) => {
+ // `on` is used to hook into various events Cypress emits
+ // `config` is the resolved Cypress config
+}
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+// ***********************************************
+// This example commands.js shows you how to
+// create various custom commands and overwrite
+// existing commands.
+//
+// For more comprehensive examples of custom
+// commands please read more here:
+// https://on.cypress.io/custom-commands
+// ***********************************************
+//
+//
+// -- This is a parent command --
+// Cypress.Commands.add("login", (email, password) => { ... })
+//
+//
+// -- This is a child command --
+// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
+//
+//
+// -- This is a dual command --
+// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
+//
+//
+// -- This will overwrite an existing command --
+// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
--- /dev/null
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+// ***********************************************************
+// This example support/index.js is processed and
+// loaded automatically before your test files.
+//
+// This is a great place to put global configuration and
+// behavior that modifies Cypress.
+//
+// You can change the location of this file or turn off
+// automatically serving support files with the
+// 'supportFile' configuration option.
+//
+// You can read more here:
+// https://on.cypress.io/configuration
+// ***********************************************************
+
+// Import commands.js using ES2015 syntax:
+import './commands'
+
+// Alternatively you can use CommonJS syntax:
+// require('./commands')
"acceptance-tests",
"webpack",
"jest",
+ "cypress",
"src/setupTests.ts",
"**/*.test.tsx"
]