-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
e1f9f9e
commit 9e31053
Showing
19 changed files
with
1,893 additions
and
6 deletions.
There are no files selected for viewing
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 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 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,27 @@ | ||
import { defineConfig } from 'cypress' | ||
|
||
export default defineConfig({ | ||
projectId: 'j2456e', | ||
e2e: { | ||
baseUrl: 'http://localhost:5173', | ||
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}', | ||
supportFile: 'cypress/support/e2e.ts', | ||
viewportWidth: 1280, | ||
viewportHeight: 720, | ||
experimentalFetchPolyfill: true, | ||
retries: { | ||
runMode: 2, | ||
openMode: 0, | ||
}, | ||
}, | ||
env: { | ||
API_URL: 'http://localhost:8000', | ||
}, | ||
component: { | ||
devServer: { | ||
framework: 'react', | ||
bundler: 'webpack', | ||
}, | ||
}, | ||
nodeOptions: ['--loader', 'ts-node/esm'], | ||
}) |
Binary file not shown.
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 @@ | ||
// TODO: Change when implemented. | ||
|
||
describe('Login Page', () => { | ||
it('should load the login page and submit form', () => { | ||
cy.visit('/login') | ||
|
||
cy.get('input[placeholder="Type your nickname or email..."]').type( | ||
'test@example.com', | ||
) | ||
cy.get('input[placeholder="Type your password..."]').type('password') | ||
|
||
cy.get('button').contains('Login').click() | ||
|
||
cy.log('Form submitted') | ||
}) | ||
|
||
it('should trigger social logins', () => { | ||
cy.visit('/login') | ||
|
||
cy.get('button').contains('Google').click() | ||
cy.get('button').contains('Facebook').click() | ||
cy.get('button').contains('Twitter').click() | ||
}) | ||
}) |
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,9 @@ | ||
const apiUrl = Cypress.env('API_URL') | ||
|
||
Cypress.Commands.add('login', (email: string, password: string) => { | ||
cy.request({ | ||
method: 'POST', | ||
url: `${apiUrl}/auth/login`, | ||
body: { email, password }, | ||
}).then((resp) => resp.body.data.message) | ||
}) |
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,31 @@ | ||
// *********************************************************** | ||
// This example support/e2e.ts 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. | ||
// | ||
// More info: https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') | ||
|
||
// Set global configurations or behaviors here | ||
|
||
// Example: Ignore uncaught exceptions that aren't relevant to the test | ||
Cypress.on('uncaught:exception', (err, runnable) => { | ||
// Prevent Cypress from failing the test on uncaught exceptions | ||
// Example: Ignore errors caused by third-party libraries or ads | ||
console.log('Caught exception: ', err) | ||
|
||
// return false to prevent the test from failing | ||
return false | ||
}) |
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,11 @@ | ||
declare namespace Cypress { | ||
interface Chainable { | ||
/** | ||
* Custom command to log in a user. | ||
* | ||
* @param email - The email of the user | ||
* @param password - The password of the user | ||
*/ | ||
login(email: string, password: string): Chainable<void> | ||
} | ||
} |
Oops, something went wrong.