Skip to content

Commit a731370

Browse files
authored
Merge pull request scratchfoundation#5491 from benjiwheeler/unflakify-blocks-tests
unflakify four blocks integration tests
2 parents f3ced9c + af0088d commit a731370

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

test/integration/blocks.test.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const {
99
findByXpath,
1010
getDriver,
1111
getLogs,
12+
Key,
1213
loadUri,
1314
rightClickText,
1415
scope
@@ -185,6 +186,10 @@ describe('Working with the blocks', () => {
185186
await clickText('costume2', scope.costumesTab);
186187
const el = await findByXpath("//input[@value='costume2']");
187188
await el.sendKeys('newname');
189+
await el.sendKeys(Key.ENTER);
190+
// wait until the updated costume appears in costume item list panel
191+
await findByXpath("//div[contains(@class,'sprite-selector-item_is-selected_')]" +
192+
"//div[contains(text(), 'newname')]");
188193

189194
// Make sure it is updated in the block menu
190195
await clickText('Code');
@@ -193,14 +198,18 @@ describe('Working with the blocks', () => {
193198
await clickText('newname', scope.blocksTab);
194199
});
195200

196-
test.skip('Renaming costume with a special character should not break toolbox', async () => {
201+
test('Renaming costume with a special character should not break toolbox', async () => {
197202
await loadUri(uri);
198203

199204
// Rename the costume
200205
await clickText('Costumes');
201206
await clickText('costume2', scope.costumesTab);
202207
const el = await findByXpath("//input[@value='costume2']");
203208
await el.sendKeys('<NewCostume>');
209+
await el.sendKeys(Key.ENTER);
210+
// wait until the updated costume appears in costume item list panel
211+
await findByXpath("//div[contains(@class,'sprite-selector-item_is-selected_')]" +
212+
"//div[contains(text(), '<NewCostume>')]");
204213

205214
// Make sure it is updated in the block menu
206215
await clickText('Code');
@@ -226,18 +235,24 @@ describe('Working with the blocks', () => {
226235
.perform();
227236
await driver.sleep(500); // Wait for thermometer menu to come up
228237
await clickXpath('//button[@aria-label="Paint"]');
238+
// wait until the new costume appears in costume item list panel
239+
await findByXpath("//div[contains(@class,'sprite-selector-item_is-selected_')]" +
240+
"//div[contains(text(), 'costume3')]");
229241
await clickText('costume3', scope.costumesTab);
230242
// Check that the menu has been updated
231243
await clickText('Code');
232244
await clickText('costume3', scope.blocksTab);
233245
});
234246

235247
// Skipped because it was flakey on travis, but seems to run locally ok
236-
test.skip('Adding a sound DOES update the default sound name in the toolbox', async () => {
248+
test('Adding a sound DOES update the default sound name in the toolbox', async () => {
237249
await loadUri(uri);
238250
await clickText('Sounds');
239251
await clickXpath('//button[@aria-label="Choose a Sound"]');
240252
await clickText('A Bass', scope.modal); // Should close the modal
253+
// wait until the selected sound appears in sounds item list panel
254+
await findByXpath("//div[contains(@class,'sprite-selector-item_is-selected_')]" +
255+
"//div[contains(text(), 'A Bass')]");
241256
await clickText('Code');
242257
await clickText('Sound', scope.blocksTab);
243258
await driver.sleep(500); // Wait for scroll to finish

0 commit comments

Comments
 (0)