Skip to content

Commit

Permalink
Merge branch 'develop' into feature/nest-server
Browse files Browse the repository at this point in the history
  • Loading branch information
Navaneeth-pk committed Jul 31, 2021
2 parents a2a46bb + f837b31 commit 1f8fe20
Show file tree
Hide file tree
Showing 22 changed files with 497 additions and 70 deletions.
9 changes: 4 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ LOCKBOX_MASTER_KEY=0000000000000000000000000000000000000000000000000000000000000
SECRET_KEY_BASE=replace_with_secret_key_base

# DATABASE CONFIG
PG_HOST=
PG_PORT=
PG_USER=
PG_PASS=
PG_DB=
ORM_LOGGING=
PG_DB=<db name>
PG_USER=<db username>
PG_HOST=<db host>
PG_PASS=<db password>

# Checks every 24 hours to see if a new version of ToolJet is available
CHECK_FOR_UPDATES=check_if_updates_are_available
Expand Down
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/01_bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ labels: 'bug, needs triage'
ToolJet Cloud / Docker / Linux / MacOS ...
-->

### What is the expected behavior?
### What is the expected behaviour?
<!--
Provide a clear description of what you want to happen.
-->

### What is the current behavior?
### What is the current behaviour?
<!--
Provide a clear description of what is the current behavior.
Provide a clear description of what is the current behaviour.
-->

### How to reproduce the issue?
Expand All @@ -29,7 +29,7 @@ labels: 'bug, needs triage'

### Screenshots or Screencast
<!--
Providing relevent Screenshots/ Screencasts would help us to debug the issue quickly.
Providing relevant Screenshots/ Screencasts would help us to debug the issue quickly.
-->

### Please provide any traces or logs that could help here.
Expand Down
9 changes: 8 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,12 @@
"baseUrl": "http://localhost:8082",
"env": {
"apiUrl": "http://localhost:3000"
}
},
"testFiles": [
"auth.spec.js",
"empty-state-dashboard.spec.js",
"dashboard.spec.js",
"apps-page-operations.spec.js"
]

}
4 changes: 4 additions & 0 deletions cypress/fixtures/login-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"email": "dev@tooljet.io",
"password": "password"
}
62 changes: 62 additions & 0 deletions cypress/integration/apps-page-operations.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
describe('Dashboard operations on Apps', () => {

const currentDate = new Date();
const folderName= 'folder '+ currentDate.toJSON();

beforeEach(() => {
//read data from fixtures
cy.fixture('login-data').then(function (testdata) {
cy.login(testdata.email,testdata.password)
})

cy.wait(1000)
cy.get('body').then(($title=>
{
//check if dashboard is in empty state
if($title.text().includes('You haven\'t created any apps yet.'))
{
cy.get('a.btn').eq(0).should('have.text','Create your first app')
.click()
cy.go('back')
}
}))
})

it('should open app in app builder using Edit button', () => {

cy.wait(2000)
cy.get('.badge').contains('Edit').click()
cy.get('title').should('have.text','ToolJet - Dashboard')
});

it('should open app in app viewer using Launch button ', () => {

cy.get('a[target="_blank"]').invoke("removeAttr","target").click()
cy.url().should('include','/applications')

});

it('should be able to add app to a folder', () => {

//Pre-requisite: Create folder
cy.get('a[class="mx-3"]').contains('+ Folder').click()
cy.get('input[placeholder="folder name"]').should('have.attr','placeholder','folder name').type(folderName)
cy.get('.btn').contains('Save').click()

//Steps to select the folder name and add app to folder.
cy.get('span[role="button"]').click()
cy.get('span[role="button"]').contains('Add to folder ').click()
cy.get('input[placeholder="Select folder"]').type(folderName)
cy.get('[data-index="0"] > .select-search__option').click()

});

it('should be able to delete app', () => {
cy.get('td img.svg-icon').eq(0).click()
cy.get('[role="button"]').contains('Delete app').click()
cy.get('.modal-body').should('have.text','The app and the associated data will be permanently deleted, do you want to continue?')
cy.get('.btn').contains('Yes').click()

});

})
33 changes: 23 additions & 10 deletions cypress/integration/dashboard.spec.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
describe('Dashboard', () => {
// we can use these values to log in
const email = 'dev@tooljet.io';
const password = 'password';

beforeEach(() => {
cy.login(email, password);

//read data from fixtures
cy.fixture('login-data').then(function (testdata) {
cy.login(testdata.email,testdata.password)
})

cy.wait(1000)
cy.get('body').then(($title=>
{
//check you are not running tests on empty dashboard state
if($title.text().includes('You haven\'t created any apps yet.'))
{
cy.get('a.btn').eq(0).should('have.text','Create your first app')
.click()
cy.go('back')
}
}))
})

it('site header is visible with nav items', () => {
it('should show site header with nav items', () => {
cy.get('.navbar')
.find('.navbar-nav')
.should('be.visible');
});

it('Users tab should navigate to Users page', () => {
it('should navigate to users page using users tab', () => {
cy.get('.navbar')
.find('.navbar-nav')
.find('li').not('.active')
Expand All @@ -23,7 +36,7 @@ describe('Dashboard', () => {
cy.get('[data-testid="usersTable"]').should('be.visible');
})

it('Apps tab should navigate to Apps page', () => {
it('should navigate to apps page using apps tab', () => {
cy.get('.navbar')
.find('.navbar-nav')
.find('li.active')
Expand All @@ -33,18 +46,18 @@ describe('Dashboard', () => {
cy.get('[data-testid="appsTable"]').should('be.visible');
})

it('should show User avatar and logout the user when user clicks logout', () => {
it('should show user avatar and logout the user when user clicks logout', () => {
cy.get('[data-testid="userAvatarHeader"]').should('be.visible');
// TODO - Add functionality to detect when user hovers over the avatar,
// Issues with hover functionality and hide/show of dom elements
})

it('Application folders list is visible', () => {
it('should show list of application folders', () => {
cy.get('[data-testid="applicationFoldersList"]')
.should('be.visible');
});

it('Count bubble for "All applications should equal number of rows in table', () => {
it('should show correct number of applications in the count bubble of "All Applications" list', () => {
cy.get('[data-testid="allApplicationsCount"]').then(($countBubble) => {
cy.get('[data-testid="appsTable"]')
.wait(500)
Expand Down
43 changes: 43 additions & 0 deletions cypress/integration/empty-state-dashboard.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
describe('Empty state of dashboard', () => {

beforeEach(() => {
//read data from fixtures
cy.fixture('login-data').then(function (testdata)
{
cy.login(testdata.email,testdata.password)
})
})

it('should show empty screen when there are no apps', () => {

cy.wait(1000)
cy.get('body').then(($title=>
{
//if user has not created any app yet
if($title.text().includes('You haven\'t created any apps yet.'))
{
//image for empty state should be visible
cy.get('.empty-img').should('be.visible')

//empty title should be visible
cy.log('Testing empty state dashboard view.')
cy.get('.empty-title').should('be.visible')
.and('have.text','You haven\'t created any apps yet.')

//Read Documentation button should be present and working
cy.get('a.btn').eq(1).should('have.attr','href','https://docs.tooljet.io')
.and('have.text','Read documentation')

//test Create your first app button should be visible and working
cy.get('a.btn').eq(0).should('be.visible')
.and('have.text','Create your first app')
.click()
cy.get('title').should('have.text','ToolJet - Dashboard')
}
else
{
cy.log("User has already created few apps hence this test will be skipped.")
}
}))
})
})
5 changes: 5 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
})
35 changes: 35 additions & 0 deletions deploy/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: '3'

services:
client:
tty: true
stdin_open: true
image: tooljet/tooljet-client-ce:latest
restart: always
depends_on:
- server
volumes:
- logs:/var/log/openresty/
- certs:/etc/resty-auto-ssl/
- fallbackcerts:/etc/fallback-certs
ports:
- 80:80
- 443:443
command: openresty -g "daemon off;"

server:
image: tooljet/tooljet-server-ce:latest
tty: true
stdin_open: true
restart: always
ports:
- 3000
env_file: .env
environment:
RAILS_LOG_TO_STDOUT: "true"
command: ["bundle", "exec", "rails", "s", "-p", "3000", "-b", "0.0.0.0"]

volumes:
certs:
logs:
fallbackcerts:
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
client:
build:
context: ./frontend
dockerfile: ../docker/client.Dockerfile
dockerfile: ../docker/client.Dockerfile.dev
image: tooljet-client:development
volumes:
- ./frontend:/app:delegated
Expand Down
25 changes: 17 additions & 8 deletions docker/client.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pull official base image
FROM node:14.17.0-alpine
FROM node:14.17.0-alpine AS builder

# set working directory
WORKDIR /app
Expand All @@ -12,14 +12,23 @@ ENV NODE_OPTIONS="--max-old-space-size=2048"

# install app dependencies
COPY package.json package-lock.json ./
RUN npm install
RUN npm install react-scripts@3.4.1 -g --silent
RUN npm install --only=production
COPY . .
RUN NODE_ENV=production npm run-script build

# add app
COPY . ./

FROM openresty/openresty:1.19.9.1rc1-buster-fat

# start app
CMD ["npm", "start"]
RUN apt-get update && apt-get -y install --no-install-recommends wget \
gnupg ca-certificates apt-utils curl luarocks \
make build-essential g++ gcc autoconf

EXPOSE 8082
RUN luarocks install lua-resty-auto-ssl

RUN mkdir /etc/resty-auto-ssl /var/log/openresty /var/www /etc/fallback-certs

COPY --from=builder /app/build /var/www

COPY ./config/nginx.conf.template /etc/openresty/nginx.conf.template
COPY ./config/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]
25 changes: 25 additions & 0 deletions docker/client.Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# pull official base image
FROM node:14.17.0-alpine

# set working directory
WORKDIR /app

# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# Fix for heap limit allocation issue
ENV NODE_OPTIONS="--max-old-space-size=2048"

# install app dependencies
COPY package.json package-lock.json ./
RUN npm install
RUN npm install react-scripts@3.4.1 -g --silent

# add app
COPY . ./


# start app
CMD ["npm", "start"]

EXPOSE 8082
Loading

0 comments on commit 1f8fe20

Please sign in to comment.