Skip to content

Commit dd90002

Browse files
authored
Merge pull request #337 from smalruby/fix-integration-test
test: wait to hide loader
2 parents 6b56f5e + d41df9b commit dd90002

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

test/integration/localization.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const {
99
getDriver,
1010
getLogs,
1111
loadUri,
12+
notExistsByXpath,
1213
rightClickText,
1314
scope
1415
} = new SeleniumHelper();
@@ -33,6 +34,7 @@ describe('Localization', () => {
3334

3435
test('Switching languages', async () => {
3536
await loadUri(uri);
37+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
3638

3739
// Add a sprite to make sure it stays when switching languages
3840
await clickXpath('//button[@aria-label="Choose a Sprite"]');
@@ -64,6 +66,7 @@ describe('Localization', () => {
6466
// Regression test for #4476, blocks in wrong language when loaded with locale
6567
test('Loading with locale shows correct blocks', async () => {
6668
await loadUri(`${uri}?locale=de`);
69+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
6770
await clickText('Fühlen'); // Sensing category in German
6871
await new Promise(resolve => setTimeout(resolve, 1000)); // wait for blocks to scroll
6972
await clickText('Antwort'); // Find the "answer" block in German
@@ -74,6 +77,7 @@ describe('Localization', () => {
7477
// test for #5445
7578
test('Loading with locale shows correct translation for string length block parameter', async () => {
7679
await loadUri(`${uri}?locale=ja`);
80+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
7781
await clickText('演算'); // Operators category in Japanese
7882
await new Promise(resolve => setTimeout(resolve, 1000)); // wait for blocks to scroll
7983
await clickText('の長さ', scope.blocksTab); // Click "length <apple>" block
@@ -85,6 +89,7 @@ describe('Localization', () => {
8589
// Regression test for ENA-142, monitor can lag behind language selection
8690
test('Monitor labels update on locale change', async () => {
8791
await loadUri(uri);
92+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
8893
await clickXpath(FILE_MENU_XPATH);
8994
await clickText('Load from your computer');
9095
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');

test/integration/sprites.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const {
1010
getDriver,
1111
getLogs,
1212
loadUri,
13+
notExistsByXpath,
1314
rightClickText,
1415
scope
1516
} = new SeleniumHelper();
@@ -29,6 +30,7 @@ describe('Working with sprites', () => {
2930

3031
test('Adding a sprite through the library', async () => {
3132
await loadUri(uri);
33+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
3234
await clickText('Costumes');
3335
await clickXpath('//button[@aria-label="Choose a Sprite"]');
3436
await clickText('Apple', scope.modal); // Closes modal
@@ -51,6 +53,7 @@ describe('Working with sprites', () => {
5153

5254
test('Adding a sprite by paint button', async () => {
5355
await loadUri(uri);
56+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
5457
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
5558
await driver.actions().mouseMove(el)
5659
.perform();
@@ -63,6 +66,7 @@ describe('Working with sprites', () => {
6366

6467
test('Deleting only sprite does not crash', async () => {
6568
await loadUri(uri);
69+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
6670
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for scroll animation
6771
await rightClickText('Sprite1', scope.spriteTile);
6872
await clickText('delete', scope.spriteTile);
@@ -74,6 +78,7 @@ describe('Working with sprites', () => {
7478

7579
test('Deleting by x button on sprite tile', async () => {
7680
await loadUri(uri);
81+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
7782
await new Promise(resolve => setTimeout(resolve, 1000)); // Wait for scroll animation
7883
await clickXpath('//*[@aria-label="Delete"]'); // Only visible close button is on the sprite
7984
// Confirm that the stage has been switched to
@@ -84,6 +89,7 @@ describe('Working with sprites', () => {
8489

8590
test('Adding a sprite by uploading a png', async () => {
8691
await loadUri(uri);
92+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
8793
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
8894
await driver.actions().mouseMove(el)
8995
.perform();
@@ -99,6 +105,7 @@ describe('Working with sprites', () => {
99105
// Enable when this is fixed issues/3608
100106
test('Adding a sprite by uploading an svg (gh-3608)', async () => {
101107
await loadUri(uri);
108+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
102109
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
103110
await driver.actions().mouseMove(el)
104111
.perform();
@@ -117,6 +124,7 @@ describe('Working with sprites', () => {
117124

118125
test('Adding a sprite by uploading a gif', async () => {
119126
await loadUri(uri);
127+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
120128
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
121129
await driver.actions().mouseMove(el)
122130
.perform();
@@ -139,6 +147,7 @@ describe('Working with sprites', () => {
139147

140148
test('Adding a letter sprite through the Letters filter in the library', async () => {
141149
await loadUri(uri);
150+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
142151
await driver.manage()
143152
.window()
144153
.setSize(1244, 768); // Letters filter not visible at 1024 width
@@ -154,6 +163,7 @@ describe('Working with sprites', () => {
154163
test('Use browser back button to close library', async () => {
155164
await driver.get('https://www.google.com');
156165
await loadUri(uri);
166+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
157167
await clickText('Costumes');
158168
await clickXpath('//button[@aria-label="Choose a Sprite"]');
159169
const abbyElement = await findByText('Abby'); // Should show editor for new costume
@@ -178,6 +188,7 @@ describe('Working with sprites', () => {
178188
path.resolve(__dirname, '../fixtures/100-100.svg')
179189
];
180190
await loadUri(uri);
191+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
181192
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
182193
await driver.actions().mouseMove(el)
183194
.perform();
@@ -194,6 +205,7 @@ describe('Working with sprites', () => {
194205

195206
test('Load a sprite3 with a missing svg costume', async () => {
196207
await loadUri(uri);
208+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
197209
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
198210
await driver.actions().mouseMove(el)
199211
.perform();
@@ -207,6 +219,7 @@ describe('Working with sprites', () => {
207219

208220
test('Load a sprite3 with a currupt svg costume', async () => {
209221
await loadUri(uri);
222+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
210223
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
211224
await driver.actions().mouseMove(el)
212225
.perform();
@@ -220,6 +233,7 @@ describe('Working with sprites', () => {
220233

221234
test('Load a scratch3 corrupt svg as a sprite', async () => {
222235
await loadUri(uri);
236+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
223237
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
224238
await driver.actions().mouseMove(el)
225239
.perform();
@@ -233,6 +247,7 @@ describe('Working with sprites', () => {
233247

234248
test('Load a sprite2 with a missing svg costume', async () => {
235249
await loadUri(uri);
250+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
236251
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
237252
await driver.actions().mouseMove(el)
238253
.perform();
@@ -246,6 +261,7 @@ describe('Working with sprites', () => {
246261

247262
test('Load a sprite2 with a currupt svg costume', async () => {
248263
await loadUri(uri);
264+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
249265
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
250266
await driver.actions().mouseMove(el)
251267
.perform();
@@ -259,6 +275,7 @@ describe('Working with sprites', () => {
259275

260276
test('Load a corrupt scratch2 svg as a sprite', async () => {
261277
await loadUri(uri);
278+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
262279
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
263280
await driver.actions().mouseMove(el)
264281
.perform();
@@ -272,6 +289,7 @@ describe('Working with sprites', () => {
272289

273290
test('Load a sprite3 with a missing bmp costume', async () => {
274291
await loadUri(uri);
292+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
275293
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
276294
await driver.actions().mouseMove(el)
277295
.perform();
@@ -285,6 +303,7 @@ describe('Working with sprites', () => {
285303

286304
test('Load a sprite3 with a currupt bmp costume', async () => {
287305
await loadUri(uri);
306+
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
288307
const el = await findByXpath('//button[@aria-label="Choose a Sprite"]');
289308
await driver.actions().mouseMove(el)
290309
.perform();

0 commit comments

Comments
 (0)