Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/integration/localization.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
getDriver,
getLogs,
loadUri,
notExistsByXpath,
rightClickText,
scope
} = new SeleniumHelper();
Expand All @@ -33,6 +34,7 @@ describe('Localization', () => {

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

// Add a sprite to make sure it stays when switching languages
await clickXpath('//button[@aria-label="Choose a Sprite"]');
Expand Down Expand Up @@ -64,6 +66,7 @@ describe('Localization', () => {
// Regression test for #4476, blocks in wrong language when loaded with locale
test('Loading with locale shows correct blocks', async () => {
await loadUri(`${uri}?locale=de`);
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
await clickText('Fühlen'); // Sensing category in German
await new Promise(resolve => setTimeout(resolve, 1000)); // wait for blocks to scroll
await clickText('Antwort'); // Find the "answer" block in German
Expand All @@ -74,6 +77,7 @@ describe('Localization', () => {
// test for #5445
test('Loading with locale shows correct translation for string length block parameter', async () => {
await loadUri(`${uri}?locale=ja`);
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
await clickText('演算'); // Operators category in Japanese
await new Promise(resolve => setTimeout(resolve, 1000)); // wait for blocks to scroll
await clickText('の長さ', scope.blocksTab); // Click "length <apple>" block
Expand All @@ -85,6 +89,7 @@ describe('Localization', () => {
// Regression test for ENA-142, monitor can lag behind language selection
test('Monitor labels update on locale change', async () => {
await loadUri(uri);
await notExistsByXpath('//*[div[contains(@class, "loader_background")]]');
await clickXpath(FILE_MENU_XPATH);
await clickText('Load from your computer');
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
Expand Down
19 changes: 19 additions & 0 deletions test/integration/sprites.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const {
getDriver,
getLogs,
loadUri,
notExistsByXpath,
rightClickText,
scope
} = new SeleniumHelper();
Expand All @@ -29,6 +30,7 @@ describe('Working with sprites', () => {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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