Skip to content

Commit a60c5ac

Browse files
authored
add support for orchestrate to run sc tunnel, web server, and tests (#93)
1 parent a3b8b22 commit a60c5ac

File tree

6 files changed

+81
-0
lines changed

6 files changed

+81
-0
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
artifacts
2+
sc-orchestrate.log
3+
servier-orchestrate.log

.sauce/config.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: v1alpha
2+
kind: imagerunner
3+
sauce:
4+
region: us-west-1
5+
suites:
6+
- name: Demo App Tests
7+
workload: webdriver
8+
image: mikedonovan1987/sample-app-web-orchestrate:0.0.2
9+
imagePullAuth:
10+
user: $DOCKER_USERNAME
11+
token: $DOCKER_PASSWORD
12+
# artifacts:
13+
# - "/sample-app-web/sc-orchestrate.log"
14+
# - "/sample-app-web/server-orchestrate.log"
15+
entrypoint: ./orchestrate.sh
16+
17+
# artifacts:
18+
# download:
19+
# when: always
20+
# match:
21+
# - "*"
22+
# directory: ./artifacts

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM node:14
2+
3+
# install sauce connect
4+
RUN curl -LO https://saucelabs.com/downloads/sc-4.8.2-linux.tar.gz
5+
RUN tar xvf ./sc-4.8.2-linux.tar.gz
6+
ENV PATH="$HOME/sc-4.8.2-linux/bin:$PATH"
7+
8+
# web app
9+
WORKDIR /sample-app-web
10+
COPY . .
11+
RUN npm install

orchestrate.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY --region us-west --tunnel-name mdonovan2010_tunnel_name &> sc-orchestrate.log &
4+
5+
npm run start &> server-orchestrate.log &
6+
7+
npm run test.e2e.sauce.us-orchestrate

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"test.e2e.local": "wdio test/e2e/configs/wdio.local.chrome.conf.js",
6060
"test.e2e.sauce.eu": "REGION=eu wdio test/e2e/configs/wdio.saucelabs.conf.js",
6161
"test.e2e.sauce.us": "wdio test/e2e/configs/wdio.saucelabs.conf.js",
62+
"test.e2e.sauce.us-orchestrate": "wdio test/e2e/configs/wdio.saucelabs-orchestrate.conf.js",
6263
"test.lint": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}\"",
6364
"test.storybook.ci": "screener-storybook --conf test/visual/storybook/ci.config.js",
6465
"test.storybook.desktop": "screener-storybook --conf test/visual/storybook/desktop.config.js",
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const BUILD_PREFIX = process.env.BUILD_PREFIX ? `GitHub Actions-` : '';
2+
const {config} = require('./wdio.shared.conf');
3+
const defaultBrowserSauceOptions = {
4+
build: `${BUILD_PREFIX}Sauce Demo App build-${new Date().getTime()}`,
5+
screenResolution: '1600x1200',
6+
};
7+
8+
// =========================
9+
// Sauce RDC specific config
10+
// =========================
11+
config.user = process.env.SAUCE_USERNAME;
12+
config.key = process.env.SAUCE_ACCESS_KEY;
13+
// If you run your tests on Sauce Labs you can specify the region you want to run your tests
14+
// in via the `region` property. Available short handles for regions are `us` (default) and `eu`.
15+
// These regions are used for the Sauce Labs VM cloud and the Sauce Labs Real Device Cloud.
16+
// If you don't provide the region, it defaults to `us`.
17+
config.region = process.env.REGION || 'us';
18+
19+
// ============
20+
// Capabilities
21+
// ============
22+
config.capabilities = [
23+
/**
24+
* Desktop browsers
25+
*/
26+
{
27+
browserName: 'chrome',
28+
platformName: 'Windows 10',
29+
browserVersion: 'latest',
30+
'sauce:options': {
31+
...defaultBrowserSauceOptions,
32+
tunnelIdentifier: "mdonovan2010_tunnel_name"
33+
},
34+
},
35+
];
36+
37+
exports.config = config;

0 commit comments

Comments
 (0)