Skip to content

Commit

Permalink
feat:new release (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
wswebcreation authored Feb 25, 2021
1 parent a25eedb commit 33daf62
Show file tree
Hide file tree
Showing 258 changed files with 16,416 additions and 34,686 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

File renamed without changes.
18 changes: 5 additions & 13 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,19 @@ jobs:
with:
node-version: '14.x'

# build current site
- name: Current site
# build site
- name: Site site
working-directory: ./
run: |
ls
yarn
yarn build
# build new site
- name: New site
working-directory: ./new
env:
CI: false
run: |
ls
yarn
yarn build
npm install
npm run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
publish_dir: ./public
cname: www.saucedemo.com
22 changes: 10 additions & 12 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

Expand All @@ -27,19 +25,19 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

# New Site steps
- name: New site - Install dependencies
working-directory: ./new
run: yarn
# Site Testing steps
- name: Install dependencies
working-directory: ./
run: npm install

- name: New site - Run Unit Tests and generate coverage report
working-directory: ./new
run: yarn test.coverage
- name: Run Unit Tests and generate coverage report
working-directory: ./
run: npm run test.coverage

- name: New site - Build and E2E test the new site
working-directory: ./new
- name: Build and E2E test the site
working-directory: ./
env:
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
BUILD_PREFIX: true
run: yarn start & npx wait-on --timeout 60000 http://localhost:3000/new && yarn test.e2e.sauce.us
run: npm run start & npx wait-on --timeout 60000 http://localhost:3000 && npm run test.e2e.sauce.us
22 changes: 18 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
*.log
.project
node_modules
bin
dist
screenshots
.idea
.coverage
storybook-static
.tmp

.eslintcache
build
coverage
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ pipeline {

stage('Build application') {
steps {
sh "npm run serve &"
sh "npx start & npx wait-on --timeout 60000 http://localhost:3000 &"
}
}

stage('Run Functional Tests') {
steps {
sh "npm run test.e2e.sauce.eu ${env.CLI_ARGS}"
sh "npx run test.e2e.sauce.eu ${env.CLI_ARGS}"
}
}
}
Expand Down
67 changes: 6 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,18 @@
# What is this codebase?
This is the Sauce Labs Sample Application which is designed to be used from desktop web browsers

## Notes
The new site has been build to run in a subdirectory `https://www.saucedemo.com/new`. You can find more information in
[this](./new)-folder. You need to go to the folder by running `cd new` and run it from there. The GitHub Workflow will
automatically publish the new site in a sub-directory on `https://www.saucedemo.com/new`.

When we deploy it for the main domain we need to change (based on
[this](https://medium.com/@svinkle/how-to-deploy-a-react-app-to-a-subdirectory-f694d46427c1)):
- [ ] [`homepage.package.json`](./new/package.json) from `"homepage": "https://www.saucedemo.com/new",`
to `"homepage": "https://www.saucedemo.com",`
- [ ] Router in the [`index.js`](./new/src/index.jsx)-file by removing the `basename={'/new'}`
- [ ] Change the [`index.html`](./new/public/index.html)-file from

```js
window.history.replaceState(null, null,
'/new' +
(q.pathname || '') +
(q.query || '') +
l.hash
);

// TO
window.history.replaceState(null, null,
(q.pathname || '') +
(q.query || '') +
l.hash
);
```
- [ ] Remove the comment in the [`404.html`](./new/public/404.html)-file when we deploy to the main directory instead of the
subdirectory
- [ ] Remove the `postbuild`-script and it's files from the [`package.json`](./new/package.json)-file and
[`scripts`](./scripts)-folder
- [ ] Remove the `before`-hook in the [`wdio.shared.conf.js`](./new/test/e2e/configs/wdio.shared.conf.js)-file
- remove the new site references and steps in the [GitHub Workflow](./.github/workflows/github-pages.yml)
- [Setup](#setup)
- [Requirements](#requirements)
- [Build](#build)
- [Test](#test)
- [Deploy](#deploy)

## Setup
### Requirements
To set up the development environment directly on your host computer:

1. You’ll need [Node.js](http://nodejs.org) installed (at least v10.x.x or higher). If you don't have Node installed, we recommend installing [NVM](https://github.com/creationix/nvm) to assist managing multiple active Node.js versions.
1. You’ll need [Node.js](http://nodejs.org) installed (at least v10.x.x or higher). If you don't have Node installed,
we recommend installing [NVM](https://github.com/creationix/nvm) to assist managing multiple active Node.js versions.
1. Fork the project.
1. Clone the project somewhere on your computer

Expand All @@ -66,41 +31,21 @@ To set up the development environment directly on your host computer:

1. Click around - this is the app!
1. Install [OpenJDK 8](https://adoptopenjdk.net/) for running the end-to-end tests

1. Install [Google Chrome](https://www.google.com/chrome/) for running the end-to-end tests

### Setup issues

If you encounter any issues with this build process, e.g.:

```
$ npm run build
> [email protected] build /Users/unlucky-user/sample-app-web
> webpack --mode production
sh: webpack: command not found
```

You have probably hit a dependency conflict issue. To resolve this, do the following in the root of the repository:

1. `npm cache clean --force`
2. `rm -rf node_modules`
3. `npm install`
4. `npm run build`

## Test

### Testing locally

To run the application test suite (which uses Webdriver.io, Selenium, and Chrome) make sure the application is running on [http://localhost:3000/](http://localhost:3000/) (see above steps)
To run the application test suite (which uses Webdriver.io, Selenium, and Chrome) make sure the application is running
on [http://localhost:3000/](http://localhost:3000/) (see above steps)

1. `npm run test.e2e.local`

This will run the application test suite

### Testing on Saucelabs

Running on Sauce Labs uses Environment Variables to authenticate credentials. You can find a guide on how to do this [here.](https://wiki.saucelabs.com/display/DOCS/Best+Practice%3A+Use+Environment+Variables+for+Authentication+Credentials)
Running on Sauce Labs uses Environment Variables to authenticate credentials. You can find a guide on how to do this
[here.](https://wiki.saucelabs.com/display/DOCS/Best+Practice%3A+Use+Environment+Variables+for+Authentication+Credentials)

1. `npm run test.e2e.sauce.us` to run tests on the Sauce Labs in the US Data Center
2. `npm run test.e2e.sayce.edu` to run tests in the EU Data Center
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
presets: [
['@babel/preset-env', {
targets: {
node: 10
node: 12
}
}]
],
Expand Down
23 changes: 0 additions & 23 deletions new/.gitignore

This file was deleted.

121 changes: 0 additions & 121 deletions new/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions new/babel.config.js

This file was deleted.

Loading

0 comments on commit 33daf62

Please sign in to comment.