Skip to content

Commit

Permalink
Dev setup (WebKit#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
flashdesignory authored Jan 30, 2023
1 parent dbff607 commit 42b6dd8
Show file tree
Hide file tree
Showing 7 changed files with 681 additions and 17 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ jobs:
env:
BROWSER: ${{ matrix.browser }}
steps:
- uses: actions/checkout@v3

- name: Run test
- name: Checkout Branch
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.13.0
- name: Install
run: |
echo "Running in $BROWSER"
npm install
- name: Run tests
run: |
echo "Running in $BROWSER"
node tests/run.mjs
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
engine-strict = true
28 changes: 28 additions & 0 deletions Development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Development Environment

## Prerequisite
Node is required for local development.
We recommend using a Node version manager ([nvm](https://github.com/nvm-sh/nvm) for example) to ensure a stable development environment is used.
Below are the required node / npm versions:
```sh
"node": ">18.13.0",
"npm": ">8.19.3"
````

## Installation
In your working directory, open terminal and paste the following commands:
```sh
git clone https://github.com/WebKit/Speedometer.git
cd Speedometer
npm install
````
## Run Development Server
1. In your terminal run:
```sh
npm run dev
````
2. Open your browser of choice and navigate to [http://127.0.0.1:7000](http://127.0.0.1:7000)

## Local Server
Speedometer uses [http-server](https://github.com/http-party/http-server), which is a static HTTP server. Meaning it does not provide hot-reloading. By default, the dev script disables caching and local changes can be viewed by simply refreshing your browser window. Additional options of the http-server can be found [here](https://github.com/http-party/http-server#available-options).
24 changes: 24 additions & 0 deletions Testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Testing

Speedometer uses [Selenium](https://www.selenium.dev/) for testing of the application itself.
Tests are located in the ``/tests`` folder.

[Sinon](https://sinonjs.org/): Standalone test spies, stubs and mocks for JavaScript.
[Mocha](https://mochajs.org/): Testing framework.

## Local Testing

To run this locally you'll need the browsers installed along with the corresponding driver:
- [chromedriver](https://chromedriver.chromium.org/getting-started)
- [geckodriver](https://github.com/mozilla/geckodriver/releases)
- [safaridriver](https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari).

Once installed you can run the following scripts:
````bash
npm run test:chrome
npm run test:firefox
npm run test:safari
````

## Automated Testing
Currently Speedometer's tests run automatically, when pushing to the main branch or when opening a pr.
Loading

0 comments on commit 42b6dd8

Please sign in to comment.