Skip to content

Commit 27af482

Browse files
authored
IE11 Cross Browser Testing (#612)
* Transpile jest-circus for IE11 * Add ansi-styles * Fix typo * Transpile everything of jest * Fix webpack config * Fix symbol error * Add BrowserStack testing * Fix browserstack local functionality * Path fix * Update test name * Jest set min timeout * test updates * Change port to 3002 to fix BrowserStack * Add BrowserStack badge * Relax timeout for integration tests * Fix formatting * Remove map requirement in worker * Change test to iPhone 6 * Update ios * Increase sleep timeout to make sure everything started * use flows for parallel tests * Run tests in sequence * Fix browser name * Change iPhone and increase max timeout * Skip ios for now
1 parent 9199f6a commit 27af482

File tree

13 files changed

+181
-21
lines changed

13 files changed

+181
-21
lines changed

.circleci/config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,14 @@ jobs:
7272
name: Start Test Server
7373
command: yarn start:test
7474
background: true
75+
- run:
76+
name: Setup BrowserStack local environment
77+
command: ./packages/app/integration-tests/BrowserStackLocal --key $BROWSER_STACK_KEY
78+
background: true
7579
- run:
7680
name: Test Integrations
7781
command: |
78-
sleep 6
82+
sleep 10
7983
yarn test:integrations --ci --testResultsProcessor="jest-junit"
8084
environment:
8185
JEST_JUNIT_OUTPUT: "/tmp/test-results/js-test-results.xml"

README.md

Lines changed: 12 additions & 10 deletions
Large diffs are not rendered by default.

packages/app/config/webpack.common.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,31 @@ module.exports = {
8585
loader: 'happypack/loader',
8686
},
8787

88+
// Transpile node dependencies, node deps are often not transpiled for IE11
89+
{
90+
test: [/\/node_modules\/.*ansi-styles/, /\/node_modules\/.*jest/],
91+
loader: 'babel-loader',
92+
query: {
93+
presets: [
94+
[
95+
'env',
96+
{
97+
targets: {
98+
ie: 11,
99+
},
100+
},
101+
],
102+
'react',
103+
],
104+
plugins: [
105+
'transform-async-to-generator',
106+
'transform-object-rest-spread',
107+
'transform-class-properties',
108+
'transform-runtime',
109+
],
110+
},
111+
},
112+
88113
// `eslint-plugin-vue/lib/index.js` depends on `fs` module we cannot use in browsers, so needs shimming.
89114
{
90115
test: new RegExp(
15.4 MB
Binary file not shown.
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
const webdriver = require('selenium-webdriver');
2+
3+
function getCapabilities(browserInfo) {
4+
return {
5+
...browserInfo,
6+
'browserstack.user': process.env.BROWSER_STACK_USER,
7+
'browserstack.key': process.env.BROWSER_STACK_KEY,
8+
'browserstack.local': 'true',
9+
};
10+
}
11+
12+
function getDriver(capabilities) {
13+
return new webdriver.Builder()
14+
.usingServer('http://hub-cloud.browserstack.com/wd/hub')
15+
.withCapabilities(capabilities)
16+
.build();
17+
}
18+
19+
function testPageWitCapabilities(capabilities) {
20+
const driver = getDriver(getCapabilities(capabilities));
21+
// Test if a sandbox can be loaded on IE11
22+
return driver.get('http://localhost:3002/#new').then(async () => {
23+
const element = webdriver.By.css('h1');
24+
await driver.wait(webdriver.until.elementLocated(element), 60000);
25+
driver.quit();
26+
});
27+
}
28+
29+
describe('browser-tests', () => {
30+
test(
31+
'ie11',
32+
async () => {
33+
// Input capabilities
34+
const capabilities = {
35+
browserName: 'IE',
36+
browser_version: '11.0',
37+
os: 'Windows',
38+
os_version: '10',
39+
resolution: '1024x768',
40+
};
41+
42+
await testPageWitCapabilities(capabilities);
43+
},
44+
130000
45+
);
46+
47+
test.skip(
48+
'ios',
49+
async () => {
50+
// Input capabilities
51+
const capabilities = {
52+
browserName: 'iPhone',
53+
device: 'iPhone SE',
54+
realMobile: 'true',
55+
os_version: '11.2',
56+
};
57+
58+
await testPageWitCapabilities(capabilities);
59+
},
60+
130000
61+
);
62+
63+
test(
64+
'firefox',
65+
async () => {
66+
// Input capabilities
67+
const capabilities = {
68+
browserName: 'Firefox',
69+
browser_version: '58.0',
70+
os: 'Windows',
71+
os_version: '10',
72+
resolution: '1024x768',
73+
};
74+
75+
await testPageWitCapabilities(capabilities);
76+
},
77+
130000
78+
);
79+
80+
test(
81+
'safari',
82+
async () => {
83+
// Input capabilities
84+
const capabilities = {
85+
browserName: 'Safari',
86+
browser_version: '10.0',
87+
os: 'OS X',
88+
os_version: 'Sierra',
89+
resolution: '1024x768',
90+
};
91+
92+
await testPageWitCapabilities(capabilities);
93+
},
94+
130000
95+
);
96+
97+
test(
98+
'android',
99+
async () => {
100+
// Input capabilities
101+
const capabilities = {
102+
browserName: 'android',
103+
device: 'Samsung Galaxy S8',
104+
realMobile: 'true',
105+
os_version: '7.0',
106+
};
107+
108+
await testPageWitCapabilities(capabilities);
109+
},
110+
130000
111+
);
112+
});

packages/app/integration-tests/tests/sandboxes.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ describe('sandboxes', () => {
5757
browser = await browser;
5858
const page = await browser.newPage();
5959
const waitFunction = pageLoaded(page);
60-
page.goto('http://localhost:3001/#' + id, {
60+
page.goto('http://localhost:3002/#' + id, {
6161
timeout: 60000,
6262
});
6363
await waitFunction;

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"recursive-readdir": "^2.2.1",
7676
"rimraf": "^2.6.1",
7777
"run-sequence": "^1.2.2",
78+
"selenium-webdriver": "^4.0.0-alpha.1",
7879
"strip-ansi": "3.0.1",
7980
"style-loader": "^0.18.2",
8081
"sw-precache-webpack-plugin": "^0.11.4",

packages/app/scripts/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function run(port) {
262262
});
263263
}
264264
})
265-
.listen(3001);
265+
.listen(3002);
266266
}
267267
}
268268

packages/app/src/app/pages/Sandbox/Editor/Header/Logo/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import LogoIcon from 'common/components/Logo';
55
import { Container, Title } from './elements';
66

77
export default ({ title }) => (
8-
<Container href="/">
8+
<Container id="logo" href="/">
99
<div style={{ position: 'relative', display: 'flex' }}>
1010
<LogoIcon title="CodeSandbox" width={30} height={30} />
1111
</div>

packages/app/src/app/pages/Sandbox/Editor/Workspace/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ function Workspace({ store }) {
6161
fontWeight: 600,
6262
color: 'rgba(255, 255, 255, 0.3)',
6363
}}
64+
className="codesandbox-version"
6465
>
6566
{VERSION}
6667
</div>

0 commit comments

Comments
 (0)