Skip to content

Commit 02f1481

Browse files
committed
be more reliable
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com> Change-Id: I564c566f9b74f4c3f61171f1337ef6d206968d50
1 parent a1bd3a5 commit 02f1481

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

cypress_test/integration_tests/desktop/writer/a11y_dialog_spec.js

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ describe(['tagdesktop'], 'Accessibility Writer Tests', function () {
6464
command == '.uno:InsertIndexesEntry' ||
6565
command == '.uno:InsertMultiIndex' ||
6666
command == '.uno:LineNumberingDialog' ||
67+
command == '.uno:OutlineBullet' ||
6768
command == '.uno:PageDialog' ||
6869
command == '.uno:ParagraphDialog' ||
69-
command == '.uno:SpellingAndGrammarDialog') {
70+
command == '.uno:SpellingAndGrammarDialog' ||
71+
command == '.uno:TableDialog') {
7072
cy.log(`Skipping buggy dialog: ${command}`);
7173
return;
7274
}
@@ -76,7 +78,7 @@ describe(['tagdesktop'], 'Accessibility Writer Tests', function () {
7678
win.app.map.sendUnoCommand(command);
7779
});
7880

79-
handleDialog(1, command);
81+
handleDialog(win, 1, command);
8082
});
8183

8284
// triple select to include table, then delete all
@@ -92,7 +94,7 @@ describe(['tagdesktop'], 'Accessibility Writer Tests', function () {
9294
win.app.map.sendUnoCommand('.uno:InsertDropdownContentControl');
9395
win.app.map.sendUnoCommand('.uno:ContentControlProperties');
9496
});
95-
handleDialog(1, '.uno:ContentControlProperties');
97+
handleDialog(win, 1, '.uno:ContentControlProperties');
9698

9799
// Text ReadOnly info dialog
98100
helper.clearAllText();
@@ -102,7 +104,7 @@ describe(['tagdesktop'], 'Accessibility Writer Tests', function () {
102104
win.app.map.sendUnoCommand('.uno:InsertSection?RegionProtect:bool=true');
103105
});
104106
helper.typeIntoDocument('{del}');
105-
handleDialog(1);
107+
handleDialog(win, 1);
106108

107109
cy.get('@console:error').then(spy => {
108110
const a11yValidatorExceptionText = win.app.A11yValidatorException.PREFIX;
@@ -159,38 +161,48 @@ describe(['tagdesktop'], 'Accessibility Writer Tests', function () {
159161
});
160162
});
161163

162-
function handleDialog(level, command) {
164+
function handleDialog(win, level, command) {
163165
getActiveDialog(level)
166+
.then(() => {
167+
return waitLayoutIdle(win);
168+
})
164169
.then(() => {
165170
// Open 'options' subdialogs
166171
if (command == '.uno:EditRegion' ||
167172
command == '.uno:InsertCaptionDialog') {
168173
cy.cGet('#options-button').click();
169-
handleDialog(level + 1);
174+
handleDialog(win, level + 1);
170175
} else if (command == '.uno:InsertIndexesEntry') {
171176
cy.cGet('#new-button').click();
172-
handleDialog(level + 1);
177+
handleDialog(win, level + 1);
173178
} else if (command == '.uno:ContentControlProperties') {
174179
cy.cGet('#add-button').click();
175-
handleDialog(level + 1);
180+
handleDialog(win, level + 1);
176181
}
177182

178-
handleTabsInDialog(level);
183+
handleTabsInDialog(win, level);
179184
closeActiveDialog(level);
180185
});
181186
}
182187

188+
function waitLayoutIdle(win) {
189+
// Wait for all layout tasks and a11y checks to complete
190+
return new Cypress.Promise(resolve => {
191+
win.app.layoutingService.onDrain(resolve);
192+
});
193+
}
194+
183195
function getActiveDialog(level) {
184196
return cy.cGet('.ui-dialog[role="dialog"]')
185197
.should('have.length', level)
186198
.then($dialogs => cy.wrap($dialogs.last()))
187199
}
188200

189-
function handleTabsInDialog(level) {
190-
traverseTabs(() => getActiveDialog(level));
201+
function handleTabsInDialog(win, level) {
202+
traverseTabs(() => getActiveDialog(level), win);
191203
}
192204

193-
function traverseTabs(getContainer, isNested = false) {
205+
function traverseTabs(getContainer, win, isNested = false) {
194206
const TABLIST = '[role="tablist"]';
195207
const TAB = '[role="tab"]';
196208

@@ -223,6 +235,9 @@ describe(['tagdesktop'], 'Accessibility Writer Tests', function () {
223235
.find(TABLIST).eq(tabListIndex)
224236
.find(TAB).eq(index)
225237
.click({ force: true })
238+
.then(() => {
239+
return waitLayoutIdle(win);
240+
})
226241
.then(() => {
227242
return getContainer();
228243
})
@@ -241,7 +256,7 @@ describe(['tagdesktop'], 'Accessibility Writer Tests', function () {
241256
if (!isNested && $nestedTablists.length > 0) {
242257
return traverseTabs(
243258
() => getContainer().find(panelSelector),
244-
true
259+
win, true
245260
);
246261
}
247262
});

0 commit comments

Comments
 (0)