Skip to content

Commit e94103c

Browse files
fix: add e2e tests
1 parent 82af608 commit e94103c

File tree

4 files changed

+103
-15
lines changed

4 files changed

+103
-15
lines changed
Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11
import React from 'react';
22

33
const style = {
4-
background: '#800',
4+
background: '#ff4444',
55
color: '#fff',
6-
padding: 12,
6+
padding: '12px 24px',
7+
border: 'none',
8+
borderRadius: '6px',
9+
fontSize: '16px',
10+
fontWeight: '600',
11+
cursor: 'pointer',
12+
transition: 'all 0.2s ease',
13+
boxShadow: '0 2px 4px rgba(0,0,0,0.2)',
714
};
815

9-
const Button = () => <button style={style}>App 1 Button</button>;
16+
const Button = () => (
17+
<button
18+
style={style}
19+
onMouseEnter={(e) => {
20+
e.target.style.transform = 'translateY(-2px)';
21+
e.target.style.boxShadow = '0 4px 8px rgba(0,0,0,0.2)';
22+
e.target.style.background = '#ff5555';
23+
}}
24+
onMouseLeave={(e) => {
25+
e.target.style.transform = 'translateY(0)';
26+
e.target.style.boxShadow = '0 2px 4px rgba(0,0,0,0.2)';
27+
e.target.style.background = '#ff4444';
28+
}}
29+
>
30+
App 1 Button
31+
</button>
32+
);
1033

1134
export default Button;

runtime-plugins/control-sharing/app2/src/App.js

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,56 @@ import React from 'react';
33

44
const RemoteButton = React.lazy(() => import('app1/Button'));
55

6+
const containerStyle = {
7+
maxWidth: '1200px',
8+
margin: '0 auto',
9+
padding: '2rem',
10+
fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
11+
backgroundColor: '#f8f9fa',
12+
minHeight: '100vh',
13+
};
14+
15+
const headerStyle = {
16+
background: 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
17+
padding: '2rem',
18+
borderRadius: '12px',
19+
color: 'white',
20+
marginBottom: '2rem',
21+
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
22+
textAlign: 'center',
23+
};
24+
25+
const buttonContainerStyle = {
26+
display: 'flex',
27+
gap: '1rem',
28+
justifyContent: 'center',
29+
marginBottom: '2rem',
30+
flexWrap: 'wrap',
31+
};
32+
633
const App = () => (
7-
<div>
8-
<h1>Share Control Panel</h1>
9-
<h2>App 2</h2>
10-
<LocalButton />
11-
<React.Suspense fallback="Loading Button">
12-
<RemoteButton />
13-
</React.Suspense>
34+
<div style={containerStyle}>
35+
<div style={headerStyle}>
36+
<h1 style={{ margin: '0 0 0.5rem 0', fontSize: '2.5rem' }}>Share Control Panel</h1>
37+
<h2 style={{ margin: '0', opacity: '0.9', fontWeight: '400' }}>App 2</h2>
38+
</div>
39+
40+
<div style={buttonContainerStyle}>
41+
<LocalButton />
42+
<React.Suspense fallback={
43+
<div style={{
44+
padding: '12px 24px',
45+
background: '#f0f0f0',
46+
borderRadius: '6px',
47+
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.05)',
48+
color: '#666'
49+
}}>
50+
Loading Button...
51+
</div>
52+
}>
53+
<RemoteButton />
54+
</React.Suspense>
55+
</div>
1456
</div>
1557
);
1658

runtime-plugins/control-sharing/app2/src/Button.js

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,34 @@ import React from 'react';
22
import * as lodash from 'lodash';
33

44
const style = {
5-
background: '#00c',
5+
background: '#4444ff',
66
color: '#fff',
7-
padding: 12,
7+
padding: '12px 24px',
8+
border: 'none',
9+
borderRadius: '6px',
10+
fontSize: '16px',
11+
fontWeight: '600',
12+
cursor: 'pointer',
13+
transition: 'all 0.2s ease',
14+
boxShadow: '0 2px 4px rgba(0,0,0,0.2)',
815
};
916

10-
const Button = () => <button style={style}>App 2 Button - lodash {lodash.VERSION}</button>;
17+
const Button = () => (
18+
<button
19+
style={style}
20+
onMouseEnter={(e) => {
21+
e.target.style.transform = 'translateY(-2px)';
22+
e.target.style.boxShadow = '0 4px 8px rgba(0,0,0,0.2)';
23+
e.target.style.background = '#5555ff';
24+
}}
25+
onMouseLeave={(e) => {
26+
e.target.style.transform = 'translateY(0)';
27+
e.target.style.boxShadow = '0 2px 4px rgba(0,0,0,0.2)';
28+
e.target.style.background = '#4444ff';
29+
}}
30+
>
31+
App 2 Button - lodash {lodash.VERSION}
32+
</button>
33+
);
1134

1235
export default Button;

runtime-plugins/control-sharing/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"clean": "pnpm --filter control-sharing_app* --parallel clean",
1515
"legacy:start": "pnpm --filter control-sharing_app* --parallel legacy:start",
1616
"legacy:build": "pnpm --filter control-sharing_app* --parallel legacy:build",
17-
"e2e:ci": "pnpm start & wait-on tcp:3001 && wait-on tcp:3002 && sleep 5 && npx cypress run --config-file ../../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome",
18-
"legacy:e2e:ci": "pnpm legacy:start & wait-on tcp:3001 && wait-on tcp:3002 && sleep 5 && npx cypress run --config-file ../../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome"
17+
"e2e:ci": "pnpm start > /dev/null 2>&1 & wait-on tcp:3001 && wait-on tcp:3002 && sleep 5 && npx cypress run --config-file ../../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome",
18+
"legacy:e2e:ci": "pnpm legacy:start > /dev/null 2>&1 & wait-on tcp:3001 && wait-on tcp:3002 && sleep 5 && npx cypress run --config-file ../../cypress-e2e/config/cypress.config.ts --config '{\"supportFile\": \"../../cypress-e2e/support/e2e.ts\"}' --spec \"./e2e/*.cy.ts\" --browser=chrome"
1919
},
2020
"devDependencies": {
2121
"wait-on": "7.2.0"

0 commit comments

Comments
 (0)