@@ -19,14 +19,14 @@ test.describe('Dev Overlay', () => {
19
19
test ( 'dev overlay exists in the page' , async ( { page, astro } ) => {
20
20
await page . goto ( astro . resolveUrl ( '/' ) ) ;
21
21
22
- const devOVerlay = page . locator ( 'astro-dev-overlay ' ) ;
22
+ const devOVerlay = page . locator ( 'astro-dev-toolbar ' ) ;
23
23
await expect ( devOVerlay ) . toHaveCount ( 1 ) ;
24
24
} ) ;
25
25
26
26
test ( 'shows plugin name on hover' , async ( { page, astro } ) => {
27
27
await page . goto ( astro . resolveUrl ( '/' ) ) ;
28
28
29
- const overlay = page . locator ( 'astro-dev-overlay ' ) ;
29
+ const overlay = page . locator ( 'astro-dev-toolbar ' ) ;
30
30
const pluginButton = overlay . locator ( 'button[data-plugin-id="astro"]' ) ;
31
31
const pluginButtonTooltip = pluginButton . locator ( '.item-tooltip' ) ;
32
32
await pluginButton . hover ( ) ;
@@ -37,14 +37,14 @@ test.describe('Dev Overlay', () => {
37
37
test ( 'can open Astro plugin' , async ( { page, astro } ) => {
38
38
await page . goto ( astro . resolveUrl ( '/' ) ) ;
39
39
40
- const overlay = page . locator ( 'astro-dev-overlay ' ) ;
40
+ const overlay = page . locator ( 'astro-dev-toolbar ' ) ;
41
41
const pluginButton = overlay . locator ( 'button[data-plugin-id="astro"]' ) ;
42
42
await pluginButton . click ( ) ;
43
43
44
44
const astroPluginCanvas = overlay . locator (
45
- 'astro-dev-overlay -plugin-canvas[data-plugin-id="astro"]'
45
+ 'astro-dev-toolbar -plugin-canvas[data-plugin-id="astro"]'
46
46
) ;
47
- const astroWindow = astroPluginCanvas . locator ( 'astro-dev-overlay -window' ) ;
47
+ const astroWindow = astroPluginCanvas . locator ( 'astro-dev-toolbar -window' ) ;
48
48
await expect ( astroWindow ) . toHaveCount ( 1 ) ;
49
49
await expect ( astroWindow ) . toBeVisible ( ) ;
50
50
@@ -56,18 +56,18 @@ test.describe('Dev Overlay', () => {
56
56
test ( 'xray shows highlights and tooltips' , async ( { page, astro } ) => {
57
57
await page . goto ( astro . resolveUrl ( '/' ) ) ;
58
58
59
- const overlay = page . locator ( 'astro-dev-overlay ' ) ;
59
+ const overlay = page . locator ( 'astro-dev-toolbar ' ) ;
60
60
const pluginButton = overlay . locator ( 'button[data-plugin-id="astro:xray"]' ) ;
61
61
await pluginButton . click ( ) ;
62
62
63
63
const xrayCanvas = overlay . locator (
64
- 'astro-dev-overlay -plugin-canvas[data-plugin-id="astro:xray"]'
64
+ 'astro-dev-toolbar -plugin-canvas[data-plugin-id="astro:xray"]'
65
65
) ;
66
- const xrayHighlight = xrayCanvas . locator ( 'astro-dev-overlay -highlight' ) ;
66
+ const xrayHighlight = xrayCanvas . locator ( 'astro-dev-toolbar -highlight' ) ;
67
67
await expect ( xrayHighlight ) . toBeVisible ( ) ;
68
68
69
69
await xrayHighlight . hover ( ) ;
70
- const xrayHighlightTooltip = xrayHighlight . locator ( 'astro-dev-overlay -tooltip' ) ;
70
+ const xrayHighlightTooltip = xrayHighlight . locator ( 'astro-dev-toolbar -tooltip' ) ;
71
71
await expect ( xrayHighlightTooltip ) . toBeVisible ( ) ;
72
72
73
73
// Toggle plugin off
@@ -76,21 +76,41 @@ test.describe('Dev Overlay', () => {
76
76
await expect ( xrayHighlightTooltip ) . not . toBeVisible ( ) ;
77
77
} ) ;
78
78
79
+ test ( 'xray shows no islands message when there are none' , async ( { page, astro } ) => {
80
+ await page . goto ( astro . resolveUrl ( '/xray-no-islands' ) ) ;
81
+
82
+ const overlay = page . locator ( 'astro-dev-toolbar' ) ;
83
+ const pluginButton = overlay . locator ( 'button[data-plugin-id="astro:xray"]' ) ;
84
+ await pluginButton . click ( ) ;
85
+
86
+ const xrayCanvas = overlay . locator (
87
+ 'astro-dev-toolbar-plugin-canvas[data-plugin-id="astro:xray"]'
88
+ ) ;
89
+ const auditHighlight = xrayCanvas . locator ( 'astro-dev-toolbar-highlight' ) ;
90
+ await expect ( auditHighlight ) . not . toBeVisible ( ) ;
91
+
92
+ const xrayWindow = xrayCanvas . locator ( 'astro-dev-toolbar-window' ) ;
93
+ await expect ( xrayWindow ) . toHaveCount ( 1 ) ;
94
+ await expect ( xrayWindow ) . toBeVisible ( ) ;
95
+
96
+ await expect ( xrayWindow . locator ( 'astro-dev-toolbar-icon[icon=lightbulb]' ) ) . toBeVisible ( ) ;
97
+ } ) ;
98
+
79
99
test ( 'audit shows higlights and tooltips' , async ( { page, astro } ) => {
80
100
await page . goto ( astro . resolveUrl ( '/' ) ) ;
81
101
82
- const overlay = page . locator ( 'astro-dev-overlay ' ) ;
102
+ const overlay = page . locator ( 'astro-dev-toolbar ' ) ;
83
103
const pluginButton = overlay . locator ( 'button[data-plugin-id="astro:audit"]' ) ;
84
104
await pluginButton . click ( ) ;
85
105
86
106
const auditCanvas = overlay . locator (
87
- 'astro-dev-overlay -plugin-canvas[data-plugin-id="astro:audit"]'
107
+ 'astro-dev-toolbar -plugin-canvas[data-plugin-id="astro:audit"]'
88
108
) ;
89
- const auditHighlight = auditCanvas . locator ( 'astro-dev-overlay -highlight' ) ;
109
+ const auditHighlight = auditCanvas . locator ( 'astro-dev-toolbar -highlight' ) ;
90
110
await expect ( auditHighlight ) . toBeVisible ( ) ;
91
111
92
112
await auditHighlight . hover ( ) ;
93
- const auditHighlightTooltip = auditHighlight . locator ( 'astro-dev-overlay -tooltip' ) ;
113
+ const auditHighlightTooltip = auditHighlight . locator ( 'astro-dev-toolbar -tooltip' ) ;
94
114
await expect ( auditHighlightTooltip ) . toBeVisible ( ) ;
95
115
96
116
// Toggle plugin off
@@ -99,22 +119,88 @@ test.describe('Dev Overlay', () => {
99
119
await expect ( auditHighlightTooltip ) . not . toBeVisible ( ) ;
100
120
} ) ;
101
121
122
+ test ( 'audit shows no issues message when there are no issues' , async ( { page, astro } ) => {
123
+ await page . goto ( astro . resolveUrl ( '/audit-no-warning' ) ) ;
124
+
125
+ const overlay = page . locator ( 'astro-dev-toolbar' ) ;
126
+ const pluginButton = overlay . locator ( 'button[data-plugin-id="astro:audit"]' ) ;
127
+ await pluginButton . click ( ) ;
128
+
129
+ const auditCanvas = overlay . locator (
130
+ 'astro-dev-toolbar-plugin-canvas[data-plugin-id="astro:audit"]'
131
+ ) ;
132
+ const auditHighlight = auditCanvas . locator ( 'astro-dev-toolbar-highlight' ) ;
133
+ await expect ( auditHighlight ) . not . toBeVisible ( ) ;
134
+
135
+ const auditWindow = auditCanvas . locator ( 'astro-dev-toolbar-window' ) ;
136
+ await expect ( auditWindow ) . toHaveCount ( 1 ) ;
137
+ await expect ( auditWindow ) . toBeVisible ( ) ;
138
+
139
+ await expect ( auditWindow . locator ( 'astro-dev-toolbar-icon[icon=check-circle]' ) ) . toBeVisible ( ) ;
140
+ } ) ;
141
+
102
142
test ( 'can open Settings plugin' , async ( { page, astro } ) => {
103
143
await page . goto ( astro . resolveUrl ( '/' ) ) ;
104
144
105
- const overlay = page . locator ( 'astro-dev-overlay ' ) ;
145
+ const overlay = page . locator ( 'astro-dev-toolbar ' ) ;
106
146
const pluginButton = overlay . locator ( 'button[data-plugin-id="astro:settings"]' ) ;
107
147
await pluginButton . click ( ) ;
108
148
109
149
const settingsPluginCanvas = overlay . locator (
110
- 'astro-dev-overlay -plugin-canvas[data-plugin-id="astro:settings"]'
150
+ 'astro-dev-toolbar -plugin-canvas[data-plugin-id="astro:settings"]'
111
151
) ;
112
- const settingsWindow = settingsPluginCanvas . locator ( 'astro-dev-overlay -window' ) ;
152
+ const settingsWindow = settingsPluginCanvas . locator ( 'astro-dev-toolbar -window' ) ;
113
153
await expect ( settingsWindow ) . toHaveCount ( 1 ) ;
114
154
await expect ( settingsWindow ) . toBeVisible ( ) ;
115
155
116
156
// Toggle plugin off
117
157
await pluginButton . click ( ) ;
118
158
await expect ( settingsWindow ) . not . toBeVisible ( ) ;
119
159
} ) ;
160
+
161
+ test ( 'Opening a plugin closes the currently opened plugin' , async ( { page, astro } ) => {
162
+ await page . goto ( astro . resolveUrl ( '/' ) ) ;
163
+
164
+ const overlay = page . locator ( 'astro-dev-toolbar' ) ;
165
+ let pluginButton = overlay . locator ( 'button[data-plugin-id="astro:settings"]' ) ;
166
+ await pluginButton . click ( ) ;
167
+
168
+ const settingsPluginCanvas = overlay . locator (
169
+ 'astro-dev-toolbar-plugin-canvas[data-plugin-id="astro:settings"]'
170
+ ) ;
171
+ const settingsWindow = settingsPluginCanvas . locator ( 'astro-dev-toolbar-window' ) ;
172
+ await expect ( settingsWindow ) . toHaveCount ( 1 ) ;
173
+ await expect ( settingsWindow ) . toBeVisible ( ) ;
174
+
175
+ // Click the astro plugin
176
+ pluginButton = overlay . locator ( 'button[data-plugin-id="astro"]' ) ;
177
+ await pluginButton . click ( ) ;
178
+
179
+ const astroPluginCanvas = overlay . locator (
180
+ 'astro-dev-toolbar-plugin-canvas[data-plugin-id="astro"]'
181
+ ) ;
182
+ const astroWindow = astroPluginCanvas . locator ( 'astro-dev-toolbar-window' ) ;
183
+ await expect ( astroWindow ) . toHaveCount ( 1 ) ;
184
+ await expect ( astroWindow ) . toBeVisible ( ) ;
185
+
186
+ await expect ( settingsWindow ) . not . toBeVisible ( ) ;
187
+ } ) ;
188
+
189
+ test ( 'Settings plugin contains message on disabling the overlay' , async ( { page, astro } ) => {
190
+ await page . goto ( astro . resolveUrl ( '/' ) ) ;
191
+
192
+ const overlay = page . locator ( 'astro-dev-toolbar' ) ;
193
+ let pluginButton = overlay . locator ( 'button[data-plugin-id="astro:settings"]' ) ;
194
+ await pluginButton . click ( ) ;
195
+
196
+ const settingsPluginCanvas = overlay . locator (
197
+ 'astro-dev-toolbar-plugin-canvas[data-plugin-id="astro:settings"]'
198
+ ) ;
199
+ const settingsWindow = settingsPluginCanvas . locator ( 'astro-dev-toolbar-window' ) ;
200
+ await expect ( settingsWindow ) . toHaveCount ( 1 ) ;
201
+ await expect ( settingsWindow ) . toBeVisible ( ) ;
202
+
203
+ const hideOverlay = settingsWindow . getByRole ( 'heading' , { name : 'Hide overlay' } ) ;
204
+ await expect ( hideOverlay ) . toBeVisible ( ) ;
205
+ } ) ;
120
206
} ) ;
0 commit comments