Skip to content

Commit

Permalink
Merge pull request #407 from COS301-SE-2024/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Keanumrc authored Sep 21, 2024
2 parents 818f433 + 0f0529e commit a588928
Show file tree
Hide file tree
Showing 163 changed files with 21,771 additions and 17,368 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ services:
env_file:
- ./query-builder-backend/.env
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"

redis:
image: redis:latest
Expand Down
122 changes: 61 additions & 61 deletions query-builder-app/cypress/e2e/auth.cy.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
import '@testing-library/cypress/add-commands';

describe('Authentication component', () => {

beforeEach(() => {
cy.viewport(1920, 1080);
cy.visit('/');
});

it('should render sign up form', () => {
cy.contains('Create an account').click();
cy.get('.sign-up-container').should('be.visible');
});

it('should render sign in form', () => {
cy.get('.sign-in-container').should('be.visible');
});

it('should toggle between sign up and sign in forms', () => {
cy.get('.sign-up-container').should('not.be.visible');
cy.get('.sign-in-container').should('be.visible');
cy.contains('Create an account').click();
cy.get('.sign-in-container').should('not.be.visible');
cy.get('.sign-up-container').should('be.visible');
cy.contains('Log in').click();
cy.get('.sign-up-container').should('not.be.visible');
cy.get('.sign-in-container').should('be.visible');
});

it('should validate sign up form inputs', () => {
cy.contains('Create an account').click();
cy.get('.sign-up-container').findByLabelText('First Name').type('John');
cy.get('.sign-up-container').findByLabelText('Last Name').type('Doe');
cy.get('.sign-up-container')
.findByLabelText('Email')
.type('johndoe@example.com');
cy.get('.sign-up-container').findByLabelText('Password').type('password');
cy.get('.sign-up-container').find('button').should('not.be.disabled');
});

it('should validate sign in form inputs', () => {
cy.get('.sign-in-container')
.findByLabelText('Email')
.type('johndoe@example.com');
cy.get('.sign-in-container').findByLabelText('Password').type('password');

cy.get('.sign-in-container').find('button').should('not.be.disabled');
});

it('should submit sign in form', () => {
cy.get('.sign-in-container')
.findByLabelText('Email')
.type(Cypress.env('test_username'), {log: false});
cy.get('.sign-in-container').findByLabelText('Password').type(Cypress.env('test_password'), {log: false});

cy.contains('Login').click();

cy.url().should('eq', 'http://localhost:3000/');
});

});
import '@testing-library/cypress/add-commands';

describe('Authentication component', () => {

beforeEach(() => {
cy.viewport(1920, 1080);
cy.visit('/');
});

it('should render sign up form', () => {
cy.contains('Create an account').click();
cy.get('.sign-up-container').should('be.visible');
});

it('should render sign in form', () => {
cy.get('.sign-in-container').should('be.visible');
});

it('should toggle between sign up and sign in forms', () => {
cy.get('.sign-up-container').should('not.be.visible');
cy.get('.sign-in-container').should('be.visible');
cy.contains('Create an account').click();
cy.get('.sign-in-container').should('not.be.visible');
cy.get('.sign-up-container').should('be.visible');
cy.contains('Log in').click();
cy.get('.sign-up-container').should('not.be.visible');
cy.get('.sign-in-container').should('be.visible');
});

it('should validate sign up form inputs', () => {
cy.contains('Create an account').click();
cy.get('.sign-up-container').findByLabelText('First Name').type('John');
cy.get('.sign-up-container').findByLabelText('Last Name').type('Doe');
cy.get('.sign-up-container')
.findByLabelText('Email')
.type('johndoe@example.com');
cy.get('.sign-up-container').findByLabelText('Password').type('password');
cy.get('.sign-up-container').find('button').should('not.be.disabled');
});

it('should validate sign in form inputs', () => {
cy.get('.sign-in-container')
.findByLabelText('Email')
.type('johndoe@example.com');
cy.get('.sign-in-container').findByLabelText('Password').type('password');

cy.get('.sign-in-container').find('button').should('not.be.disabled');
});

it('should submit sign in form', () => {
cy.get('.sign-in-container')
.findByLabelText('Email')
.type(Cypress.env('test_username'), {log: false});
cy.get('.sign-in-container').findByLabelText('Password').type(Cypress.env('test_password'), {log: false});

cy.contains('Login').click();

cy.url().should('eq', 'http://localhost:3000/', {timeout: 10000});
});

});
6 changes: 4 additions & 2 deletions query-builder-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"react-icons": "^5.2.1",
"react-phone-number-input": "^3.4.3",
"react-router-dom": "v5",
"reactflow": "^11.11.4"
"reactflow": "^11.11.4",
"uuid": "^10.0.0"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.5.0",
Expand All @@ -61,6 +62,7 @@
"@types/node": "^20.14.7",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^10.0.0",
"@vitest/coverage-v8": "^1.6.0",
"cypress": "^13.12.0",
"eslint": "^8.57.0",
Expand All @@ -76,4 +78,4 @@
"typescript-eslint": "^7.13.1",
"vitest": "^1.6.0"
}
}
}
Loading

0 comments on commit a588928

Please sign in to comment.