Introduce e2e test
This commit is contained in:
		
							parent
							
								
									77456ae0bc
								
							
						
					
					
						commit
						b81ff340b1
					
				
					 18 changed files with 805 additions and 32 deletions
				
			
		
							
								
								
									
										5
									
								
								cypress/fixtures/example.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								cypress/fixtures/example.json
									
										
									
									
									
										Normal file
									
								
							|  | @ -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" | ||||
| } | ||||
							
								
								
									
										69
									
								
								cypress/integration/basic.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								cypress/integration/basic.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,69 @@ | |||
| describe('Basic', () => { | ||||
| 	before(() => { | ||||
| 		cy.request('POST', '/api/reset-db'); | ||||
| 	}); | ||||
| 
 | ||||
| 	beforeEach(() => { | ||||
| 		cy.reload(true); | ||||
| 	}); | ||||
| 
 | ||||
|   it('successfully loads', () => { | ||||
|     cy.visit('/'); | ||||
|   }); | ||||
| 
 | ||||
| 	it('setup instance', () => { | ||||
|     cy.visit('/'); | ||||
| 
 | ||||
| 		cy.get('[data-cy-admin-username] input').type('admin'); | ||||
| 
 | ||||
| 		cy.get('[data-cy-admin-password] input').type('admin1234'); | ||||
| 
 | ||||
| 		cy.get('[data-cy-admin-ok]').click(); | ||||
|   }); | ||||
| 
 | ||||
| 	it('signup', () => { | ||||
|     cy.visit('/'); | ||||
| 
 | ||||
| 		cy.get('[data-cy-signup]').click(); | ||||
| 
 | ||||
| 		cy.get('[data-cy-signup-username] input').type('alice'); | ||||
| 
 | ||||
| 		cy.get('[data-cy-signup-password] input').type('alice1234'); | ||||
| 	 | ||||
| 		cy.get('[data-cy-signup-password-retype] input').type('alice1234'); | ||||
| 
 | ||||
| 		cy.get('[data-cy-signup-submit]').click(); | ||||
|   }); | ||||
| 
 | ||||
| 	it('signin', () => { | ||||
|     cy.visit('/'); | ||||
| 
 | ||||
| 		cy.get('[data-cy-signin]').click(); | ||||
| 
 | ||||
| 		cy.get('[data-cy-signin-username] input').type('alice'); | ||||
| 
 | ||||
| 		// Enterキーでサインインできるかの確認も兼ねる
 | ||||
| 		cy.get('[data-cy-signin-password] input').type('alice1234{enter}'); | ||||
|   }); | ||||
| 
 | ||||
| 	it('note', () => { | ||||
|     cy.visit('/'); | ||||
| 
 | ||||
| 		//#region TODO: この辺はUI操作ではなくAPI操作でログインする
 | ||||
| 		cy.get('[data-cy-signin]').click(); | ||||
| 
 | ||||
| 		cy.get('[data-cy-signin-username] input').type('alice'); | ||||
| 
 | ||||
| 		// Enterキーでサインインできるかの確認も兼ねる
 | ||||
| 		cy.get('[data-cy-signin-password] input').type('alice1234{enter}'); | ||||
| 		//#endregion
 | ||||
| 
 | ||||
| 		cy.get('[data-cy-open-post-form]').click(); | ||||
| 
 | ||||
| 		cy.get('[data-cy-post-form-text]').type('Hello, Misskey!'); | ||||
| 
 | ||||
| 		cy.get('[data-cy-open-post-form-submit]').click(); | ||||
| 
 | ||||
| 		// TODO: 投稿した文字列が画面内にあるか(=タイムラインに流れてきたか)のテスト
 | ||||
|   }); | ||||
| }); | ||||
							
								
								
									
										22
									
								
								cypress/plugins/index.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								cypress/plugins/index.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | |||
| /// <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} | ||||
|  */ | ||||
| // eslint-disable-next-line no-unused-vars
 | ||||
| module.exports = (on, config) => { | ||||
|   // `on` is used to hook into various events Cypress emits
 | ||||
|   // `config` is the resolved Cypress config
 | ||||
| } | ||||
							
								
								
									
										25
									
								
								cypress/support/commands.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								cypress/support/commands.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -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) => { ... })
 | ||||
							
								
								
									
										20
									
								
								cypress/support/index.js
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								cypress/support/index.js
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,20 @@ | |||
| // ***********************************************************
 | ||||
| // 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')
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue