-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
1,676 additions
and
11,853 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
module.exports = { | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
sourceType: 'module', | ||
createDefaultProgram: true | ||
}, | ||
ignorePatterns: ['cypress', 'node_modules', 'dist', 'public'], | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier/@typescript-eslint', | ||
'plugin:prettier/recommended', | ||
'plugin:prettier/recommended' | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
browser: true | ||
}, | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
'@typescript-eslint/no-explicit-any': 'off' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"baseUrl": "http://localhost:3001", | ||
"fixturesFolder": false, | ||
"video": false, | ||
"pluginsFile": "cypress/plugins/index.ts", | ||
"supportFile": "cypress/support/index.ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
ignorePatterns: ['!**/*'], | ||
extends: ['../.eslintrc.js'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts'], | ||
parserOptions: { | ||
project: ['./tsconfig.json'], | ||
tsconfigRootDir: __dirname | ||
} | ||
} | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
describe('Log In', () => { | ||
beforeEach(() => cy.visit('/login')); | ||
|
||
it('should successfully logs in', () => { | ||
// we can submit form using "cy.submit" command | ||
// https://on.cypress.io/submit | ||
cy.get('input[name=user]').type('admin'); | ||
cy.get('input[name=password]').type('admin'); | ||
cy.get('button[type=submit]').click(); | ||
|
||
// we should be in | ||
cy.url().should('include', '/'); | ||
cy.get('a.get-started-btn').should('contain', 'Log out admin'); | ||
}); | ||
|
||
it('should displays errors on login', function () { | ||
// alias this request so we can wait on it later | ||
cy.intercept('POST', '/login').as('postLogin'); | ||
|
||
// incorrect username on password | ||
cy.get('input[name=user]').type('jane.lae'); | ||
cy.get('input[name=password]').type('password123{enter}'); | ||
|
||
// we should always explicitly check if the status equals 401 | ||
cy.wait('@postLogin').its('response.statusCode').should('eq', 401); | ||
|
||
// and still be on the same URL | ||
cy.url().should('include', '/login'); | ||
}); | ||
|
||
it('can stub the XHR to force it to fail', function () { | ||
// alias this request so we can wait on it later | ||
cy.intercept('POST', '/login', { statusCode: 503, delay: 5000 }).as( | ||
'postLogin' | ||
); | ||
|
||
// incorrect username on password | ||
cy.get('input[name=user]').type('admin'); | ||
cy.get('input[name=password]').type('admin{enter}'); | ||
|
||
// we should always explicitly check if the status equals 401 | ||
cy.wait('@postLogin').its('response.statusCode').should('eq', 503); | ||
|
||
// and still be on the same URL | ||
cy.url().should('include', '/login'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// cypress/plugins/index.ts | ||
|
||
/// <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) | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export default ( | ||
_on: Cypress.PluginEvents, | ||
_config: Cypress.PluginConfigOptions | ||
) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// *********************************************** | ||
// 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) => { ... }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// *********************************************************** | ||
// 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"isolatedModules": false, | ||
"target": "es5", | ||
"lib": ["es5", "dom"], | ||
"types": ["cypress"] | ||
}, | ||
"include": ["**/*", "../src/**/*"] | ||
} |
Oops, something went wrong.