@@ -16,6 +16,10 @@ import {
1616 insertBlock ,
1717} from '../../utils' ;
1818
19+ const LARGE_IMAGE = 'large-image-36521.jpg' ;
20+ const CORRECT_VIDEO = 'clothes-hanged-to-dry-1295231.mp4' ;
21+ const SELECT_BUTTON = '.media-modal button.media-button-select' ;
22+
1923describe ( 'Story Page' , ( ) => {
2024 beforeAll ( async ( ) => {
2125 await activateExperience ( 'stories' ) ;
@@ -167,4 +171,51 @@ describe( 'Story Page', () => {
167171 return document . querySelector ( selector ) . value ;
168172 } , secondsSelector ) ) . toBe ( '2' ) ;
169173 } ) ;
174+
175+ it ( 'should allow changing the alt attribute for the background image' , async ( ) => {
176+ // Add background image.
177+ await page . waitForSelector ( '.editor-amp-story-page-background' ) ;
178+ await page . click ( '.editor-amp-story-page-background' ) ;
179+ await uploadMedia ( LARGE_IMAGE ) ;
180+ await expect ( page ) . toClick ( SELECT_BUTTON ) ;
181+
182+ // Write assistive text.
183+ const label = await page . waitForXPath ( `//label[contains(text(), 'Assistive Text')]` ) ;
184+ await page . evaluate ( ( lbl ) => {
185+ lbl . click ( ) ;
186+ } , label ) ;
187+ await page . keyboard . type ( 'Hello World' ) ;
188+
189+ // Open preview.
190+ const editorPage = page ;
191+ const previewPage = await openPreviewPage ( editorPage , 'amp-story' ) ;
192+ await previewPage . waitForSelector ( 'amp-img[alt*="Hello World"]' ) ;
193+ } ) ;
194+
195+ /**
196+ * This test is disabled because it does not work on Chromium.
197+ *
198+ * @see https://github.com/ampproject/amp-wp/pull/2874
199+ * @see https://github.com/ampproject/amp-wp/pull/3214
200+ */
201+ // eslint-disable-next-line jest/no-disabled-tests
202+ it . skip ( 'should allow changing the ARIA label for the background video' , async ( ) => {
203+ // Add background video.
204+ await page . waitForSelector ( '.editor-amp-story-page-background' ) ;
205+ await page . click ( '.editor-amp-story-page-background' ) ;
206+ await uploadMedia ( CORRECT_VIDEO ) ;
207+ await expect ( page ) . toClick ( SELECT_BUTTON ) ;
208+
209+ // Write assistive text.
210+ const label = await page . waitForXPath ( `//label[contains(text(), 'Assistive Text')]` ) ;
211+ await page . evaluate ( ( lbl ) => {
212+ lbl . click ( ) ;
213+ } , label ) ;
214+ await page . keyboard . type ( 'Hello World' ) ;
215+
216+ // Open preview.
217+ const editorPage = page ;
218+ const previewPage = await openPreviewPage ( editorPage , 'amp-story' ) ;
219+ await previewPage . waitForXPath ( '//amp-video[contains(@aria-label, "Hello World")]' ) ;
220+ } ) ;
170221} ) ;
0 commit comments