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

Frontend Challenge #32

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5b26c64
feat: initial boilerplate
186412 Feb 15, 2023
80ce1ab
style: linting
186412 Feb 16, 2023
ff43503
feat: package.json
186412 Feb 16, 2023
867a143
feat: added title and google fonts
186412 Feb 16, 2023
4d41ef6
feat: added content component
186412 Feb 16, 2023
d137964
style: added custom color palette
186412 Feb 16, 2023
291b83d
feat: added page title component
186412 Feb 16, 2023
e7d31bd
feat: added icon button component
186412 Feb 16, 2023
d393888
feat: added router
186412 Feb 16, 2023
8404e14
feat: added top bar
186412 Feb 16, 2023
690357a
feat: added default layout component
186412 Feb 16, 2023
db0a5fa
feat: assets
186412 Feb 16, 2023
bff1832
feat: added transcriptions view
186412 Feb 16, 2023
0713a63
feat: added 404 view
186412 Feb 16, 2023
dc766d4
feat: added layout to main app component
186412 Feb 16, 2023
058765f
chore: cleanups
186412 Feb 16, 2023
1580280
feat: added sass
186412 Feb 16, 2023
40e65cb
feat: added main flex classes
186412 Feb 16, 2023
705e062
feat: added checkbox
186412 Feb 16, 2023
dd146fb
feat: added input component
186412 Feb 16, 2023
3609f9f
feat: added item component
186412 Feb 16, 2023
4e23b6e
style: checkbox styling
186412 Feb 17, 2023
4238b64
feat: converted input to textarea
186412 Feb 17, 2023
bf07c05
feat: added vuex pkg
186412 Feb 17, 2023
cf6c95c
feat: added store
186412 Feb 18, 2023
f6072b0
feat: remove textarea rows and make it auto grow
186412 Feb 18, 2023
c407603
feat: general vue fixes
186412 Feb 18, 2023
dd2b2e8
feat: dynamic content
186412 Feb 18, 2023
5b6f309
feat: input component improvements
186412 Feb 18, 2023
9141144
feat: POST request
186412 Feb 18, 2023
fd6cdf2
feat: 404 page definition
186412 Feb 18, 2023
c98c9aa
feat: added default page component
186412 Feb 18, 2023
9ff8a81
style: linting
186412 Feb 18, 2023
e725af6
feat: accessibility options
186412 Feb 20, 2023
28ff167
feat: toggle button
186412 Feb 20, 2023
476c6fd
feat: accessibility options improvements
186412 Feb 20, 2023
431fb90
test: unit testing
186412 Feb 21, 2023
4610f94
fix: key warning
186412 Feb 21, 2023
8b4b7ad
fix: typo
186412 Feb 21, 2023
c661426
test: e2e tests
186412 Feb 21, 2023
2d5fe30
chore: readme
186412 Feb 22, 2023
f390943
Merge pull request #1 from 186412/dev
186412 Feb 22, 2023
f9c75a6
feat: added key to list item
186412 Feb 22, 2023
b00b2c0
Merge pull request #2 from 186412/dev
186412 Feb 22, 2023
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
29 changes: 29 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
*.local

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

coverage
81 changes: 81 additions & 0 deletions CHALLENGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
## Challenge

Our goal is to understand:

- How knowledgeable you are
- How well you structure your app
- How well can you visually reproduce a mockup

Some restrictions:

- Use the Vue javascript framework and its Component system
- Don't use a UI framework like Bootstrap

Your challenge will consist of the following:

You'll have to build a small web app that is able to **fetch data** from an endpoint we provide, **list the data** from the endpoint, allow **editing the data**, **adding and removing** rows, and then **pushing the data** to another endpoint.

Please fork this repo and commit your changes to the fork.

Here is a preview of what we are expecting:

![Sample](_README_assets/sample.png)

Keep in mind that we may ask you about some of the decisions you made while building the app.

## Important information to complete the challenge

### Data source

Fetch the data from this endpoint [http://www.mocky.io/v2/5ae1c5792d00004d009d7e5c](http://www.mocky.io/v2/5ae1c5792d00004d009d7e5c)

Using Mocky should produce no cross origin errors and should work fine for this challenge. If you do find issues, it's OK to copy the JSON into your preferred method to then provide the data to the app.

### Assets, measurements, and other details

Inside this repository you'll find a folder named `assets-for-challenge`. Inside this folder you can find all the icons we expect you to use, in multiple formats, use what you think is best.

## Detailed comments on each element

![Elements Numbered](_README_assets/challenge-elements-numbered.png)

**Functionality**

The app should let the user do the following:

- **1** - _Get data_ button. When the user **clicks on this button**, your app will **get the data from the URL** in [Data source](#Data source) and fill the list
- **2** - _Upload data_ button. When the user **clicks on this button**, your app will **make a POST request to the same url** as the _Get data_ button. You should send the latest information on the list using the same structure as you have received it.
- **3** - _Custom checkbox_. When the user **clicks on the checkbox**, it will become checked. It will not have any other functionality.
- **4** - _Add line_ button. When the user **clicks on this button**, a **new row will be added to the list** and the user should be able to **write text in both fields**.
- **5** - _Delete row_ button. This button should be **visible only when hovering** each row item. When the user **clicks on this button**, your app will **remove that row** from the list.
- **6** - List _item title_ **This title should be editable**.
- **7** - List _item content_. **This content should be editable**.
- **8** - _App title_. No functionality.
- **9** - _Person icon_ linked to each row. No functionality.

Notes:

- Don't worry about the blank state before loading the content.

**Style Attributes**

These are some and useful details about some of the elements

- **3** - The checkbox is 16px wide and 16px high. The purple color is `#859EFF`
- **6** - The font-family of the _item title_ is `Montserrat`, the weight is `SemiBold`, the size is `16px`, and the color is `#566074`
- **7** - The font-family of the _item content_ is `Open Sans`, the weight is `Regular`, the size is `16px`, and the color is `#778195`
- **8** - The font-family of the _app title_ is `Montserrat`, the weight is `Medium`, the size is `18px`, and the color is `#414C5E`

The data above is enough to complete challenge. We also include the source Sketch file in the repository, in case you want to check the original file. You can find it in `_README_assets/Challenge.sketch`

## Typography

- You can find [Montserrat on Google Fonts](https://fonts.google.com/specimen/Montserrat)
- You can find [Open Sans on Google Fonts](https://fonts.google.com/specimen/Open+Sans)

## Bonus points:

- Keeping in mind accessibility
- Adding tests to your components and app
- Using a store (Vuex) to manage the application data
- Using vue-router to prepare the app for a future where it would have multiple routes
160 changes: 81 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,81 @@
# Frontend Challenge

Our goal is to understand:
- How knowledgeable you are
- How well you structure your app
- How well can you visually reproduce a mockup

Some restrictions:
- Use the Vue javascript framework and its Component system
- Don't use a UI framework like Bootstrap

Your challenge will consist of the following:

You'll have to build a small web app that is able to **fetch data** from an endpoint we provide, **list the data** from the endpoint, allow **editing the data**, **adding and removing** rows, and then **pushing the data** to another endpoint.

Please fork this repo and commit your changes to the fork.

Here is a preview of what we are expecting:

![Sample](_README_assets/sample.png)

Keep in mind that we may ask you about some of the decisions you made while building the app.

## Important information to complete the challenge

### Data source

Fetch the data from this endpoint [http://www.mocky.io/v2/5ae1c5792d00004d009d7e5c](http://www.mocky.io/v2/5ae1c5792d00004d009d7e5c)

Using Mocky should produce no cross origin errors and should work fine for this challenge. If you do find issues, it's OK to copy the JSON into your preferred method to then provide the data to the app.

### Assets, measurements, and other details

Inside this repository you'll find a folder named `assets-for-challenge`. Inside this folder you can find all the icons we expect you to use, in multiple formats, use what you think is best.

## Detailed comments on each element

![Elements Numbered](_README_assets/challenge-elements-numbered.png)

**Functionality**

The app should let the user do the following:

- **1** - _Get data_ button. When the user **clicks on this button**, your app will **get the data from the URL** in [Data source](#Data source) and fill the list
- **2** - _Upload data_ button. When the user **clicks on this button**, your app will **make a POST request to the same url** as the _Get data_ button. You should send the latest information on the list using the same structure as you have received it.
- **3** - _Custom checkbox_. When the user **clicks on the checkbox**, it will become checked. It will not have any other functionality.
- **4** - _Add line_ button. When the user **clicks on this button**, a **new row will be added to the list** and the user should be able to **write text in both fields**.
- **5** - _Delete row_ button. This button should be **visible only when hovering** each row item. When the user **clicks on this button**, your app will **remove that row** from the list.
- **6** - List _item title_ **This title should be editable**.
- **7** - List _item content_. **This content should be editable**.
- **8** - _App title_. No functionality.
- **9** - _Person icon_ linked to each row. No functionality.

Notes:

- Don't worry about the blank state before loading the content.

**Style Attributes**

These are some and useful details about some of the elements

- **3** - The checkbox is 16px wide and 16px high. The purple color is `#859EFF`
- **6** - The font-family of the _item title_ is `Montserrat`, the weight is `SemiBold`, the size is `16px`, and the color is `#566074`
- **7** - The font-family of the _item content_ is `Open Sans`, the weight is `Regular`, the size is `16px`, and the color is `#778195`
- **8** - The font-family of the _app title_ is `Montserrat`, the weight is `Medium`, the size is `18px`, and the color is `#414C5E`

The data above is enough to complete challenge. We also include the source Sketch file in the repository, in case you want to check the original file. You can find it in `_README_assets/Challenge.sketch`

## Typography

- You can find [Montserrat on Google Fonts](https://fonts.google.com/specimen/Montserrat)
- You can find [Open Sans on Google Fonts](https://fonts.google.com/specimen/Open+Sans)

## Bonus points:

- Keeping in mind accessibility
- Adding tests to your components and app
- Using a store (Vuex) to manage the application data
- Using vue-router to prepare the app for a future where it would have multiple routes
# frontend-challenge

## Project Setup

```sh
npm install
```

### Compile and Hot-Reload for Development

```sh
npm run dev
```

### Run Unit Tests with [Vitest](https://vitest.dev/)

```sh
npm run test:unit
```

### Run Unit Tests and check its code coverage

```sh
npm run test:coverage
```

### Run End-to-End Tests with [Cypress](https://www.cypress.io/)

```sh
npm run dev
npm run test:e2e # or `npm run test:e2e:head` for headless testing
```

## Main features covered

Besides the application itself, below are the features that were also covered during this challenge:

1. **Responsiveness design**: desktop and mobile.
2. **Accessibility options**: implementation of two modes, _elder mode_ and _color blindness mode_. When the user activates the _elder mode_, the font-size of the application increases. While selecting _color blindness mode_ helps color-blind users to better identify text boxes.
3. **404 Page**: to illustrate the use of vue-router.
4. **Empty state page**: to give an indication to the user when there are no transcriptions created.
5. **Unit testing**.
6. **E2E testing with Cypress**.

## Notes

### Code coverage result

| File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
| -------------------------------- | ------- | -------- | ------- | ------- | ----------------- |
| All files | 99.77 | 95.65 | 100 | 99.77 |
| components/accessibility-options | 100 | 100 | 100 | 100 |
| AccessibilityOptions.vue | 100 | 100 | 100 | 100 |
| components/checkbox | 100 | 100 | 100 | 100 |
| Checkbox.vue | 100 | 100 | 100 | 100 |
| components/content | 100 | 100 | 100 | 100 |
| Content.vue | 100 | 100 | 100 | 100 |
| components/default-page | 100 | 100 | 100 | 100 |
| DefaultPage.vue | 100 | 100 | 100 | 100 |
| components/icon-button | 100 | 100 | 100 | 100 |
| IconButton.vue | 100 | 100 | 100 | 100 |
| components/input | 97.29 | 80 | 100 | 97.29 |
| Input.vue | 97.29 | 80 | 100 | 97.29 | 35-36 |
| components/layout | 100 | 100 | 100 | 100 |
| Layout.vue | 100 | 100 | 100 | 100 |
| components/list-item | 100 | 100 | 100 | 100 |
| Item.vue | 100 | 100 | 100 | 100 |
| components/list-item/item-body | 100 | 100 | 100 | 100 |
| ItemBody.vue | 100 | 100 | 100 | 100 |
| components/list-item/item-title | 100 | 100 | 100 | 100 |
| ItemTitle.vue | 100 | 100 | 100 | 100 |
| components/modal | 100 | 100 | 100 | 100 |
| Modal.vue | 100 | 100 | 100 | 100 |
| components/page-title | 100 | 100 | 100 | 100 |
| PageTitle.vue | 100 | 100 | 100 | 100 |
| components/toggle-button | 100 | 100 | 100 | 100 |
| ToggleButton.vue | 100 | 100 | 100 | 100 |
| components/top-bar | 100 | 100 | 100 | 100 |
| TopBar.vue | 100 | 100 | 100 | 100 |
| shared/utils | 100 | 100 | 100 | 100 |
| accessibilityOptions.js | 100 | 100 | 100 | 100 |
Binary file removed _README_assets/Challenge.sketch
Binary file not shown.
Binary file removed _README_assets/challenge-elements-numbered.png
Binary file not shown.
Binary file removed _README_assets/sample.png
Binary file not shown.
Binary file removed assets-for-challenge/[email protected]
Binary file not shown.
Binary file removed assets-for-challenge/[email protected]
Binary file not shown.
Binary file removed assets-for-challenge/[email protected]
Binary file not shown.
Binary file removed assets-for-challenge/[email protected]
Binary file not shown.
Binary file removed assets-for-challenge/[email protected]
Binary file not shown.
Binary file removed assets-for-challenge/[email protected]
Binary file not shown.
Binary file removed assets-for-challenge/[email protected]
Binary file not shown.
Binary file removed assets-for-challenge/[email protected]
Binary file not shown.
Binary file removed assets-for-challenge/[email protected]
Binary file not shown.
Binary file removed assets-for-challenge/[email protected]
Binary file not shown.
8 changes: 8 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
specPattern: "cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}",
baseUrl: "http://localhost:5173",
},
});
8 changes: 8 additions & 0 deletions cypress/e2e/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
},
"include": ["./**/*", "../support/**/*"]
}
35 changes: 35 additions & 0 deletions cypress/e2e/views/NotFoundView.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
describe("NotFoundView", () => {
beforeEach(() => {
cy.visit("/no/path");
});

it("contains 404 string", () => {
// Assert
cy.contains(
"span",
"Ah, the dreaded 404. Let's get you back on track."
);
});

it("contains take me home button", () => {
// Assert
cy.contains("button", "Take Me Home");
});

it("contains accessibility options", () => {
// Assert
cy.get('[data-test="accessibility-icon"]').should(
"have.attr",
"alt",
"accessibility-icon"
);
});

it("should be redirected to home page", () => {
// Act
cy.contains("button", "Take Me Home").click();

// Assert
cy.url().should("eq", "http://localhost:5173/");
});
});
Loading