1
1
<template >
2
2
<div
3
- id =" main-grid "
4
- class =" grid p-12 gap-8 h-full "
3
+ id =" main-pane "
4
+ class =" flex "
5
5
>
6
- <div >
6
+ <div
7
+ id =" inline-spec-list"
8
+ class =" bg-gray-1000 w-128"
9
+ >
7
10
<InlineSpecList :gql =" props.gql" />
8
11
</div >
9
12
10
- <div
11
- id =" runner"
12
- :style =" `width: ${runnerColumnWidth}px`"
13
- class =" relative"
14
- >
15
- <SpecRunnerHeader :gql =" props.gql" />
13
+ <div class =" w-128" >
16
14
<div
17
- :id =" RUNNER_ID"
18
- class =" viewport origin-top-left"
19
- :style =" viewportStyle"
15
+ v-once
16
+ :id =" REPORTER_ID"
20
17
/>
21
- <SnapshotControls :event-manager =" eventManager" />
22
18
</div >
23
19
24
20
<div
25
- v-once
26
- :id =" REPORTER_ID"
27
- />
21
+ ref =" runnerPane"
22
+ class =" relative w-full"
23
+ >
24
+ <div class =" bg-white p-4 border-8 border-blue-300" >
25
+ <SpecRunnerHeader :gql =" props.gql" />
26
+ </div >
27
+
28
+ <div class =" flex justify-center bg-gray-100 h-full p-4" >
29
+ <div
30
+ :id =" RUNNER_ID"
31
+ class =" viewport origin-top-left"
32
+ :style =" viewportStyle"
33
+ />
34
+ </div >
35
+ <SnapshotControls :event-manager =" eventManager" />
36
+ </div >
28
37
</div >
29
38
</template >
30
39
31
40
<script lang="ts" setup>
32
- import { computed , onBeforeUnmount , onMounted , watch } from ' vue'
41
+ import { computed , onBeforeUnmount , onMounted , ref , watch } from ' vue'
33
42
import { REPORTER_ID , RUNNER_ID , getRunnerElement , getReporterElement , empty } from ' ../runner/utils'
34
43
import { gql } from ' @urql/core'
35
44
import type { SpecRunnerFragment } from ' ../generated/graphql'
@@ -47,16 +56,25 @@ fragment SpecRunner on App {
47
56
}
48
57
`
49
58
50
- const runnerColumnWidth = 400
51
59
const eventManager = window .UnifiedRunner .eventManager
52
60
53
61
const autStore = useAutStore ()
54
62
63
+ const runnerPane = ref <HTMLDivElement >()
64
+
55
65
const viewportStyle = computed (() => {
66
+ if (! runnerPane .value ) {
67
+ return
68
+ }
69
+
70
+ const scale = runnerPane .value .clientWidth < autStore .viewportDimensions .width
71
+ ? runnerPane .value .clientWidth / autStore .viewportDimensions .width
72
+ : 1
73
+
56
74
return `
57
75
width: ${autStore .viewportDimensions .width }px;
58
76
height: ${autStore .viewportDimensions .height }px;
59
- transform: scale(${runnerColumnWidth / autStore . viewportDimensions . width }); `
77
+ transform: scale(${scale }); `
60
78
})
61
79
62
80
const props = defineProps <{
@@ -90,17 +108,32 @@ onBeforeUnmount(() => {
90
108
91
109
</script >
92
110
93
- <style scoped>
94
- #main-grid {
95
- grid-template-columns : 1fr 2fr 2fr ;
111
+ <style scoped lang="scss">
112
+ $navbar-width : 80px ;
113
+
114
+ #main-pane {
115
+ /* * There is a "bug" caused by this line:
116
+ https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/cy/actionability.ts#L375
117
+ Basically `scrollIntoView` is applied even outside of the <iframe>,
118
+ scrolling an element "upwards", messing up the UI
119
+ Easiest way to reprodudce is remove the `position: fixed`
120
+ and run the `SpecList.spec.tsx` test in runner-ct
121
+ in CT mode.
122
+ Ideally we should not need `position: fixed`, but I don't see
123
+ a good way to work around this right now.
124
+ */
125
+ position : fixed ;
126
+ left : $navbar-width ;
127
+ height : 100vh ;
128
+ width : calc (100% - #{$navbar-width } );
96
129
}
97
130
98
- .viewport {
99
- border : 2px dotted blue ;
131
+ #inline-spec-list {
132
+ border-right : 2px solid rgb ( 67 73 97 ) ;
100
133
}
101
134
102
- #runner {
103
- border : 1 px solid black ;
135
+ .viewport {
136
+ border : 2 px dotted blue ;
104
137
}
105
138
106
139
#unified-runner {
@@ -109,7 +142,6 @@ onBeforeUnmount(() => {
109
142
110
143
#unified-reporter {
111
144
position : relative ;
112
- width : 300px ;
113
145
height : 100% ;
114
146
}
115
147
0 commit comments