Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files bin and landing page #110

Merged
merged 12 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
NEXTAUTH_URL=http://localhost:8080
NEXTAUTH_SECRET="secret"

NEXT_PUBLIC_ALEPH_CHANNEL=TEST

NEXT_PUBLIC_GITCLONE_DIR=repositories
NEXT_PUBLIC_GITHUB_CLIENT_ID="your OAuth client id"
NEXT_PUBLIC_GITHUB_CLIENT_SECRET="your OAuth client secret"
NEXTAUTH_URL=http://localhost:8080
NEXTAUTH_SECRET="secret"
35 changes: 10 additions & 25 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
parser: "@typescript-eslint/parser"

parserOptions:
ecmaVersion: 6
project: tsconfig.json
ecmaVersion: latest
project:
- tsconfig.json
- cypress/tsconfig.json

env:
node: true
Expand All @@ -16,32 +18,15 @@ extends:
- plugin:@next/next/recommended
- prettier

plugins:
- prettier

globals:
"cy": true

rules:
prettier/prettier: warn

react/react-in-jsx-scope: 0
react/jsx-filename-extension: 0
react/no-unescaped-entities: 0
react/jsx-props-no-spreading: 0
react/require-default-props: 0
react/no-children-prop: 0
react/react-in-jsx-scope: off
react/jsx-filename-extension: off

react-hooks/exhaustive-deps: off

no-alert: 0
no-console: 0
no-nested-ternary: 0
max-classes-per-file: 0
class-methods-use-this: 0
no-console: off

import/prefer-default-export: 0
class-methods-use-this: off

"@typescript-eslint/no-non-null-assertion": off
"@typescript-eslint/no-unused-vars": ["warn", { ignoreRestSiblings: true }]
"@typescript-eslint/no-use-before-define": 0
"@typescript-eslint/ban-ts-comment": off
"@typescript-eslint/no-use-before-define": off
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ description: File a bug report
title: "[Bug]: "
labels: ["bug", "triage"]
assignees:
- adrienfort # Update it
- EdenComp
- lucas-louis
- SloWayyy
body:
- type: markdown
attributes:
Expand Down
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ description: File a feature request
title: "[Feature]: "
labels: ["feature", "triage"]
assignees:
- adrienfort # Update it
- EdenComp
- lucas-louis
- SloWayyy
body:
- type: markdown
attributes:
Expand Down
23 changes: 0 additions & 23 deletions .github/milestone_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@

[Explain here the objective of the milestone]

### Timeline

#### Duration

- [ ] 1 week
- [ ] 2 weeks
- [ ] 3 weeks

#### Date

- Start date : [dd/mm/yyyy]
- End date : [dd/mm/yyyy]

### Checklist

- [ ] Clear objective
Expand All @@ -37,13 +24,3 @@
- [ ] Release created
- [ ] Tasks archived
- [ ] Branches cleared

### Questions

**Was this objective fulfilled on time ?**

[Answer this question]

**If not, why ?**

[Answer this question if needed, otherwise delete it]
16 changes: 12 additions & 4 deletions .github/workflows/end-to-end-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Create IPC docker image
run: docker build . -t ipc:latest
- name: Create env file
run: |
touch .env
echo NEXT_PUBLIC_ALEPH_CHANNEL=${{ secrets.NEXT_PUBLIC_ALEPH_CHANNEL }} >> .env
echo NEXT_PUBLIC_GITCLONE_DIR=${{ secrets.NEXT_PUBLIC_GITCLONE_DIR }} >> .env
echo NEXT_PUBLIC_GITHUB_CLIENT_ID=${{ secrets.NEXT_PUBLIC_GITHUB_CLIENT_ID }} >> .env
echo NEXT_PUBLIC_GITHUB_CLIENT_SECRET=${{ secrets.NEXT_PUBLIC_GITHUB_CLIENT_SECRET }} >> .env
echo NEXTAUTH_URL=${{ secrets.NEXTAUTH_URL }} >> .env
echo NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} >> .env

- name: Run cypress
uses: cypress-io/github-action@v4
with:
start: docker run -p 8080:8080 ipc:latest
start: docker compose up
wait-on: "http://localhost:8080"
wait-on-timeout: 300

- name: Get screenshots
uses: actions/upload-artifact@v1
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"useTabs": true,
"bracketSpacing": true,
"parser": "typescript"
}
}
16 changes: 2 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,11 @@ FROM node:16-alpine

WORKDIR /app

# Install dependencies
COPY package.json .
COPY yarn.lock .
RUN yarn --frozen-lockfile;

# Copy source (see .dockerignore)
COPY . .

# Add env variables
ENV NEXT_PUBLIC_ALEPH_CHANNEL=TEST
ENV NEXTAUTH_URL="http://localhost:8080"
ENV NEXTAUTH_SECRET = $(openssl rand -base64 32)
ENV NEXT_PUBLIC_GITCLONE_DIR="repositories"
ENV NEXT_PUBLIC_GITHUB_CLIENT_ID="your OAuth client id"
ENV NEXT_PUBLIC_GITHUB_CLIENT_SECRET="your OAuth client secret"
# Install dependencies
RUN yarn --frozen-lockfile

RUN yarn build

Expand All @@ -28,8 +18,6 @@ RUN mv .next/static .next/standalone/.next/

WORKDIR /app/.next/standalone

EXPOSE 8080

ENV PORT 8080

CMD ["node", "server.js"]
15 changes: 5 additions & 10 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { defineConfig } from 'cypress';

export default defineConfig({
watchForFileChanges: false,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://localhost:8080',
},
})
watchForFileChanges: false,
e2e: {
baseUrl: 'http://localhost:8080',
},
});
54 changes: 13 additions & 41 deletions cypress/e2e/features/files.cy.ts
Original file line number Diff line number Diff line change
@@ -1,56 +1,28 @@
let dashboardSpecMnemonic = '';

describe('Create account for File tests', () => {
it('Connect', () => {
cy.visit('/signup');
cy.get('#ipc-signup-credentials-signup-button').click();
cy.get('#ipc-signup-text-area')
.invoke('val')
.then((input) => {
dashboardSpecMnemonic = input as string;
});
cy.get('#ipc-modal-close-button').click();
});
});

describe('Upload a file modal in Dashboard', () => {
describe('File tests', () => {
const fixtureFile = 'upload_test_file.txt';
const emptyFixtureFile = 'upload_empty_file.txt';

beforeEach(() => {
cy.visit('/login');
cy.get('#ipc-login-text-area').click().type(dashboardSpecMnemonic);
cy.get('#ipc-login-credentials-button').click();
cy.get('#ipc-dashboard-drawer-button').click({ force: true });
cy.get('.ipc-new-elem-button').click();
cy.get('#ipc-upload-button').click({ force: true });
it('Signup for file tests', () => {
cy.signup();
});

it('Good number of buttons after upload', () => {
cy.get('#ipc-dashboard-upload-file').attachFile(fixtureFile);
cy.get('#ipc-dashboard-upload-file-modal-button').click();
cy.wait(20000);
cy.get('button').should('have.length', 19);
cy.uploadFile(fixtureFile);

cy.get('#chakra-toast-portal').contains('File uploaded');
});

it('Good number of buttons after failed upload', () => {
cy.get('#ipc-dashboard-upload-file').attachFile(emptyFixtureFile, { allowEmpty: true });
cy.get('#ipc-dashboard-upload-file-modal-button').click();
cy.wait(20000);
cy.get('button').should('have.length', 21);
});
});
cy.uploadFile(emptyFixtureFile, { allowEmpty: true });

describe('Download a file in Dashboard', () => {
beforeEach(() => {
cy.visit('/login');
cy.get('#ipc-login-text-area').click().type(dashboardSpecMnemonic);
cy.get('#ipc-login-credentials-button').click();
cy.get('.ipc-file-popover-button').click();
cy.get('#ipc-dashboard-download-button').click();
cy.get('#chakra-toast-portal').contains('Invalid file');
cy.get('#ipc-modal-close-button').click();
});

it('Good content for downloaded file', () => {
cy.readFile('./cypress/downloads/upload_test_file.txt').should('eq', 'This is an upload test file');
cy.get('.ipc-file-popover-button').click({ force: true });
cy.get('#ipc-dashboard-download-button').click({ force: true });
cy.readFile(`./cypress/downloads/${fixtureFile}`).should('eq', 'This is an upload test file');
cy.get('#chakra-toast-portal').contains('File downloaded');
});
});
34 changes: 6 additions & 28 deletions cypress/e2e/features/programs.cy.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,15 @@
describe('Create account for Dashboard tests', () => {
it('Connect', () => {
cy.visit('/signup');
cy.get('#ipc-signup-credentials-signup-button').click();
cy.get('#ipc-signup-text-area')
.invoke('val')
.then((input) => {
dashboardSpecMnemonic = input as string;
});
cy.get('#ipc-modal-close-button').click();
});
});

describe('Deploy a program modal for Dashboard', () => {
describe('Programs', () => {
const fixtureFile = 'upload_test_program.zip';

beforeEach(() => {
cy.visit('/login');
cy.get('#ipc-login-text-area').click().type(dashboardSpecMnemonic);
cy.get('#ipc-login-credentials-button').click();
it("Signup for program tests", () => {
cy.signup();
});

it('Good program deployment', () => {
cy.get('#ipc-dashboard-drawer-button').click({ force: true });
cy.get('.ipc-new-elem-button').click();
cy.get('#ipc-deploy-button').click({ force: true }).wait(2500);
});

it('Good number of buttons after deployment', () => {
cy.get('#ipc-dashboard-deploy-program').attachFile(fixtureFile);
cy.get('#ipc-dashboard-deploy-program-modal-button').click();
cy.wait(20000);
cy.get('button').should('have.length', 14);
});

it('Good number of buttons after closing modal', () => {
cy.get('#ipc-modal-close-button').click();
cy.get('button').should('have.length', 12);
});
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('Good front for Home', () => {
it('Go to home', () => {
cy.visit('');
describe('Good front for Connection', () => {
it('Go to connection', () => {
cy.visit('/connection');
});

it('Good title', () => {
Expand All @@ -24,19 +24,19 @@ describe('Good front for Home', () => {
});
});

describe('Signup Button front in Home', () => {
it('Go to home', () => {
cy.visit('');
describe('Signup Button front in Connection', () => {
it('Go to connection', () => {
cy.visit('/connection');
});

it('Good URL redirect for create account button', () => {
cy.get('#ipc-home-create-account-button').click().url().should('eq', `${Cypress.config().baseUrl}/signup`);
});
});

describe('Login Button front in Home', () => {
it('Go to home', () => {
cy.visit('');
describe('Login Button front in Connection', () => {
it('Go to connection', () => {
cy.visit('/connection');
});

it('Good URL redirect for login button', () => {
Expand Down
14 changes: 2 additions & 12 deletions cypress/e2e/front/dashboard.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
let dashboardSpecMnemonic = '';

describe('Create account for Dashboard tests', () => {
it('Connect', () => {
cy.visit('/signup');
Expand Down Expand Up @@ -51,10 +53,6 @@ describe('Good Upload file modal front in Dashboard', () => {
cy.get('header').should('contain', 'Upload a file');
});

it('Good number of buttons', () => {
cy.get('button').should('have.length', 14);
});

it('Good number of input', () => {
cy.get('input[type=file]').should('have.length', 1);
});
Expand Down Expand Up @@ -82,10 +80,6 @@ describe('Good Deploy program modal front in Dashboard', () => {
cy.get('header').should('contain', 'Deploy a program');
});

it('Good number of buttons', () => {
cy.get('button').should('have.length', 14);
});

it('Good number of input', () => {
cy.get('input[type=file]').should('have.length', 1);
});
Expand Down Expand Up @@ -113,10 +107,6 @@ describe('Good Create folder modal front in Dashboard', () => {
cy.get('header').should('contain', 'Create a folder');
});

it('Good number of buttons', () => {
cy.get('button').should('have.length', 14);
});

it('Good number of input', () => {
cy.get('input[type=text]').should('have.length', 1);
});
Expand Down
Loading