| 
									
										
										
										
											2021-06-14 23:44:43 +05:30
										 |  |  | // ***********************************************
 | 
					
						
							|  |  |  | // 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) => {});
 | 
					
						
							| 
									
										
										
										
											2020-09-03 14:21:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | Cypress.Commands.add('login', () => { | 
					
						
							| 
									
										
										
										
											2022-01-18 16:52:49 +02:00
										 |  |  |   cy.visit(`${Cypress.env('API_LOCATION')}/signin`); | 
					
						
							| 
									
										
										
										
											2021-06-24 12:50:36 +03:00
										 |  |  |   cy.contains('Welcome back'); | 
					
						
							| 
									
										
										
										
											2020-09-03 14:21:16 +03:00
										 |  |  | }); | 
					
						
							| 
									
										
										
										
											2020-11-22 00:09:38 +06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-15 15:51:27 +01:00
										 |  |  | Cypress.Commands.add('toggleAll', () => { | 
					
						
							|  |  |  |   cy.visit('/settings'); | 
					
						
							|  |  |  |   // cy.get('input[name="isLocked"]').click();
 | 
					
						
							|  |  |  |   // cy.get('input[name="name"]').click();
 | 
					
						
							|  |  |  |   cy.get('#privacy-settings') | 
					
						
							|  |  |  |     .find('.toggle-not-active') | 
					
						
							|  |  |  |     .each(element => { | 
					
						
							|  |  |  |       return new Cypress.Promise(resolve => { | 
					
						
							|  |  |  |         cy.wrap(element).click().should('have.class', 'toggle-active'); | 
					
						
							|  |  |  |         resolve(); | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   cy.get('#honesty-policy').find('button').click().wait(300); | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-22 00:09:38 +06:00
										 |  |  | Cypress.Commands.add('resetUsername', () => { | 
					
						
							|  |  |  |   cy.visit('/settings'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   cy.get('@usernameInput') | 
					
						
							|  |  |  |     .clear({ force: true }) | 
					
						
							|  |  |  |     .type('developmentuser', { force: true }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-16 02:02:52 -06:00
										 |  |  |   cy.contains('Username is available'); | 
					
						
							| 
									
										
										
										
											2020-11-22 00:09:38 +06:00
										 |  |  | 
 | 
					
						
							|  |  |  |   cy.get('@usernameInput').type('{enter}', { force: true, release: false }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   cy.contains('Account Settings for developmentuser').should('be.visible'); | 
					
						
							|  |  |  | }); |