npm install
npm run serve
npm run build
npm run gulp
npm run test
npm run lint npm run lint:fix
npm run format
npm run cy:open
npm run cy:run
In this Project Students will optimize and test a front-end web application called Study Night, a flashcard tool. Using the skills gained throughout this course, they will create tests to ensure product quality, install and configure necessary project dependencies, and optimize and automate the application tasks.
This project includes the prebuilt Study Night application. Students will install and configure VSCode extensions and npm dependencies. They will apply their testing skills by building unit tests with Mocha to verify logic functionality and end-to-end tests with Cypress to validate form and navigation behavior. To complete the project, students will prepare the application for production by optimizing it manually and using tools like Parcel to minify files and compress images, as well as Gulp to automate testing and build processes.
If you are using your local machine you'll need to install Node.js You can follow the instructions below or the ones provided by the Node.js documentation here Node.js
// Mac or Linux
// Open your terminal and enter the following
curl -fsSL https://fnm.vercel.app/install | bash
source ~/.bashrc
fnm use --install-if-missing 20
node -v # This should print the latest supported version
npm -v # This should print the latest supported version
// Windows
// Open PowerShell
winget install Schniz.fnm
fnm env --use-on-cd | Out-String | Invoke-Expression
fnm use --install-if-missing 20
node -v # This should print the latest supported version
npm -v # This should print the latest supported version
- Initialize a
package.jsonfile withnpm init package.jsonshould include a name, version, description, MIT License- Add type : “module” to the
package.json, this will fix any import errors.
- Navigate to VS Code Extensions and search for, then install, ESLint and Prettier.
- In the terminal, run
npm init --save-dev @eslint/config@latestto install ESLint and generate a configuration file for your project. - Restart VS Code to apply the extensions.
- The files
src/Shuffle.js and src/utilityRenderFunctions.jscontain ESLint and formatting errors. Use ESLint and Prettier to fix these issues by only addressing the underlined errors and formatting problems. Avoid making major changes to the logic, as other files depend on these functions and changes could cause errors. - NOTE: No other folders in the src directory need to be changed.
- In the terminal enter
npm i –save-dev gulp, gulp-cli, gulp-shell - Install Parcel
- In the terminal enter
npm i –save-dev parcel
- In the terminal enter
- Configure Gulp
- Create a
gulpfile.js - Import
gulpandgulp-shell. - Create a Gulp task to build and run Parcel as the default task.
- Running
npm run gulpshould build and serve the project. - Visit
http://localhost:1234in your browser to verify the application is working. - Navigate to the
distdirectory to verify that parcel has optimized images, minimize and concatenated files. - Note: Parcel does this automatically no further changes or configuration is necessary here. Do not make changes to the dist file.
- Create a
- Install mocha dependencies by entering
npm i –save-dev mocha chaiin the terminal - Create a directory called test and create a test file called shuffle.jsCreate a describe block for the shuffle function.
- Create at least one test that verifies that the shuffle function shuffles the indexes of an array
- Extra tests for this function are encouraged but not required.
- Return to gulpfile.js and create a new different called test task that will run your new unit test.
- run the test with
npm run gulp test
-
In the terminal, run
npm i --save-devcypress to install Cypress. -
Run
npx cypress opento open Cypress's task runner. -
Select E2E Testing. Cypress will configure and create the necessary files for testing.
-
Create two new specs:
navigation.cy.jsform.cy.js- Note: The scaffold examples provided by Cypress can offer helpful hints if needed. Be sure to remove them when the project is complete
-
Navigate to
cypress/e2e navigation.cy.js- Create a
describeblock for the navigation tests. - Write tests to verify the following:
- Clicking on "Card Set" in the side menu navigates to the page containing the card sets.
- Clicking on "About" in the side menu navigates to the About page.
- Clicking on "Home" in the side menu navigates to the Home page.
- Create a
-
Navigate to
cypress/e2e forms.cy.js -
Create tests to verify the functionality of both the
Create Set Formand theAdd Card Form:- Test the "happy path" for both forms (i.e., valid input and successful submission).
- Test the "unhappy path" where the user submits an empty string for any of the inputs. An error should be rendered in these cases.
-
Navigate to gulpfile.js and create a task that runs cypress tests with
npx cypress run -
Note: Cypress tests require the server to be running. Ensure that you run your Parcel task in a separate terminal before executing the tests.
A Udacity Front-End Web Developer Nanodegree Final Project
Study Night is a flashcard-based web application designed to help students study efficiently.
In this project, the application was optimized for production, automated using Gulp, tested using Mocha and Cypress, and linted with ESLint and Prettier to ensure code quality.
- Interactive Flashcards: Create and study custom flashcards.
- Dynamic Navigation: Seamless page navigation between Home, About, and Card Sets.
- Form Validation: Includes both happy and unhappy path testing for input forms.
- Automated Optimization: Gulp and Parcel automate builds and file optimization.
- Complete Test Coverage: Unit and end-to-end testing for quality assurance.
- Manually Optimized CSS: All selectors simplified and redundant styles removed.
git clone https://github.com/AmeerQatmosh/Study-Night.git
cd Study-Night
### 2. Install Dependencies
```bash
npm install