Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

chore: initial version #1

Merged
merged 1 commit into from
Feb 4, 2020
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
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REACT_APP_VERSION=$npm_package_version
GENERATE_SOURCEMAP=false
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src/__tests__/cypress
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
build/
node_modules/
scripts/
wip/

.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

package-lock.json*
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 100,
"trailingComma": "none",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
The MIT License (MIT)

Copyright (c) ARK Ecosystem <info@ark.io>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# ARK Messenger 💬

A fully anonymous and secure chat service proof of concept that utilizes many of the benefits that the ARK blockchain has to offer.

Website: [arkmessenger.io](http://www.arkmessenger.io)

## Installation

Clone the ARK Messenger repository and cd into it:

```
git clone https://github.com/ArkEcosystem/poc-ark-messenger.git
cd poc-ark-messenger
```

Install all dependencies:

```
npm install
```

Run the application:

```
npm start
```

By running the application in a development environment, it expects the blockchain to run locally on port `4003`. You can change this behavior by editing the `nodes` value in `./src/config.ts`

## Tests

Run Jest tests with:

```
npm run test:jest
```

Run Cypress tests with:

```
npm run test:cypress
```

## Credits

This project exists thanks to all the people who [contribute](../../contributors).

## License

[MIT](LICENSE) © [ARK Ecosystem](https://ark.io)
11 changes: 11 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"baseUrl": "http://localhost:3000",
"pluginsFile": "src/__tests__/cypress/plugins/index.js",
"supportFile": "src/__tests__/cypress/support/index.js",
"integrationFolder": "src/__tests__/cypress/integration",
"fixturesFolder": "src/__tests__/cypress/fixtures",
"screenshotsFolder": "src/__tests__/cypress/screenshots",
"videosFolder": "src/__tests__/cypress/videos",
"viewportHeight": 1080,
"viewportWidth": 1920
}
79 changes: 79 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"name": "ark-messenger-client",
"version": "0.8.0",
"description": "A decentralized chat application built on ARK.",
"license": "MIT",
"contributors": [
"Lemii <lemiidelegate@gmail.com>"
],
"homepage": "https://www.arkmessenger.io",
"repository": {
"type": "git",
"url": "https://github.com/ArkEcosystem/poc-ark-messenger.git"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test:jest": "react-scripts test",
"test:cypress": "cypress open",
"eject": "react-scripts eject"
},
"dependencies": {
"@arkecosystem/core-transactions": "^2.6.0-next.9",
"@arkecosystem/crypto": "^2.6.0-next.5",
"@fortawesome/fontawesome-svg-core": "^1.2.25",
"@fortawesome/free-regular-svg-icons": "^5.12.0",
"@fortawesome/free-solid-svg-icons": "^5.11.2",
"@fortawesome/react-fontawesome": "^0.1.7",
"animate.css": "^3.7.2",
"axios": "^0.19.0",
"bip39": "^3.0.2",
"bootstrap": "^4.4.1",
"crypto-browserify": "^3.12.0",
"jquery": "^3.4.1",
"markdown-to-jsx": "^6.10.3",
"node-sass": "^4.13.0",
"popper.js": "^1.16.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-modal": "^3.11.1",
"react-router-dom": "^5.1.2",
"react-scripts": "3.3.0",
"react-spinners": "^0.6.1",
"typescript": "~3.7.2"
},
"devDependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/bytebuffer": "^5.0.40",
"@types/jest": "^24.0.0",
"@types/markdown-to-jsx": "^6.9.1",
"@types/node": "^12.0.0",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
"@types/react-modal": "^3.10.4",
"@types/react-router-dom": "^5.1.3",
"cypress": "^3.8.3"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"jest": {
"watchPathIgnorePatterns": [
"src/__tests__/cypress/*"
]
}
}
Binary file added public/favicon.ico
Binary file not shown.
40 changes: 40 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="A decentralized chat application built on ARK." />
<link rel="apple-touch-icon" href="logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>ARK Messenger</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file added public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
2 changes: 2 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
4 changes: 4 additions & 0 deletions src/__tests__/cypress/helpers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const createRandomString = () =>
Math.random()
.toString(36)
.substring(7);
56 changes: 56 additions & 0 deletions src/__tests__/cypress/integration/channels.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
describe('Channels', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole __tests__ folder should be moved up to the top-level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@faustbrian The project is bootstrapped with Create React App and requires the __tests__ folder to be placed inside the src folder. If you move the folder to the root it will create all kinds of problems and would need quite some extra work to get it working properly. Worst case scenario an eject is necessary, and this would not work well with the goals set out for this project.

beforeEach(() => {
const userPassphrase =
'clay harbor enemy utility margin pretty hub comic piece aerobic umbrella acquire';

cy.visit('/login');

cy.get('input[name=passphrase').type(userPassphrase);

cy.get('button').click();

cy.wait(3000);
});

describe('Create Channel', () => {
it('should create and join a new channel', () => {
cy.get('#create-button').click();

cy.wait(500);

cy.get('#create').contains('Channel ID');

cy.get('#create').contains('Passphrase');

cy.wait(3000);

cy.get('#join-button-2').click();

cy.url().should('not.eq', Cypress.config('baseUrl') + '/channels');

cy.get('#page-content-wrapper').contains('No messages');
});
});

describe('Join Channel', () => {
it('should accept input', () => {
const pw = 'somepassphrase';

cy.get('input[name=passphrase')
.type(pw)
.should('have.value', pw);
});

it('should join the channel', () => {
const pw = 'road mesh portion rich damp grain defense away pill curious dynamic moment';

cy.get('input[name=passphrase')
.type(pw)
.should('have.value', pw);

cy.get('#join-button').click();

cy.url().should('eq', Cypress.config('baseUrl') + '/chat/AJAkJNx1Xpb9cPVWb3hdkXqwvyeBYcoUW7');
});
});
});
57 changes: 57 additions & 0 deletions src/__tests__/cypress/integration/chat.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { createRandomString as r } from '../helpers';

describe('Chat', () => {
beforeEach(() => {
const userPassphrase =
'clay harbor enemy utility margin pretty hub comic piece aerobic umbrella acquire';
const channelPassphrase =
'limb tobacco green tower time source piano icon run barely pigeon curve';

cy.visit('/login');

cy.get('input[name=passphrase]').type(userPassphrase);

cy.get('button').click();

cy.get('input[name=passphrase]').type(channelPassphrase);

cy.get('#join-button').click();
});

describe('Chat', () => {
it('should accept input', () => {
const text = 'some text';

cy.get('textarea[name=message]')
.type(text)
.should('have.value', text);
});

it("should send a message to the channel by pressing the 'Enter' key", () => {
const randomText = 'Random text: ' + r();

cy.get('textarea[name=message]')
.type(randomText)
.should('have.value', randomText)
.type('{enter}');

cy.wait(5000);

cy.get('#page-content-wrapper').contains(randomText);
});

it("should send a message to the channel by clicking the 'Send' button", () => {
const randomText = 'Random text: ' + r();

cy.get('textarea[name=message]')
.type(randomText)
.should('have.value', randomText);

cy.get('#send-button').click();

cy.wait(5000);

cy.get('#page-content-wrapper').contains(randomText);
});
});
});
Loading