mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-12-01 03:17:47 -05:00
Merge pull request #6851 from seotts/fix-file-upload-test
Fix project upload test by downloading sb3 to Saucelabs
This commit is contained in:
commit
752ac02c57
1 changed files with 42 additions and 20 deletions
|
@ -39,6 +39,8 @@ let ownedUnsharedScratch2Url = rootUrl + '/projects/' + ownedUnsharedScratch2ID;
|
|||
let username = process.env.SMOKE_USERNAME + '6';
|
||||
let password = process.env.SMOKE_PASSWORD;
|
||||
|
||||
const remote = process.env.SMOKE_REMOTE || false;
|
||||
|
||||
jest.setTimeout(60000);
|
||||
|
||||
let driver;
|
||||
|
@ -189,6 +191,14 @@ describe('www-integration project-creation signed in', () => {
|
|||
await driver.sleep(1000);
|
||||
await signIn(username, password);
|
||||
await findByXpath('//span[contains(@class, "profile-name")]');
|
||||
|
||||
// SauceLabs doesn't have access to the sb3 used in 'load project from file' test
|
||||
// https://support.saucelabs.com/hc/en-us/articles/115003685593-Uploading-Files-to-a-Sauce-Labs-Virtual-Machine-during-a-Test
|
||||
if (remote) {
|
||||
await driver.get('https://github.com/LLK/scratch-www/blob/develop/test/fixtures/project1.sb3');
|
||||
await clickText('Download');
|
||||
await driver.sleep(3000);
|
||||
}
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
|
@ -197,26 +207,6 @@ describe('www-integration project-creation signed in', () => {
|
|||
|
||||
afterAll(async () => await driver.quit());
|
||||
|
||||
test.skip('load project from file', async () => {
|
||||
await clickXpath('//li[@class="link create"]');
|
||||
let gf = await findByXpath('//img[@class="green-flag_green-flag_1kiAo"]');
|
||||
await gf.isDisplayed();
|
||||
await clickText('File');
|
||||
await clickText('Load from your computer');
|
||||
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
|
||||
await input.sendKeys(path.resolve(__dirname, '../fixtures/project1.sb3'));
|
||||
await driver.sleep(200);
|
||||
let alert = await driver.switchTo().alert();
|
||||
await alert.accept();
|
||||
let spriteTile = await findText('project1-sprite');
|
||||
let spriteTileVisible = await spriteTile.isDisplayed();
|
||||
await expect(spriteTileVisible).toBe(true);
|
||||
await driver.sleep(1000);
|
||||
let infoArea = await findByXpath('//div[@class="sprite-info_sprite-info_3EyZh box_box_2jjDp"]');
|
||||
let areaVisible = await infoArea.isDisplayed();
|
||||
await expect(areaVisible).toBe(true);
|
||||
});
|
||||
|
||||
test('make a copy of a project', async () => {
|
||||
await driver.get(ownedUnsharedUrl + '/editor');
|
||||
let gf = await findByXpath('//img[@class="green-flag_green-flag_1kiAo"]');
|
||||
|
@ -245,4 +235,36 @@ describe('www-integration project-creation signed in', () => {
|
|||
let areaVisible = await infoArea.isDisplayed();
|
||||
await expect(areaVisible).toBe(true);
|
||||
});
|
||||
|
||||
test('load project from file', async () => {
|
||||
// if remote, projectPath is Saucelabs path to downloaded file
|
||||
const projectPath = remote ?
|
||||
'/Users/chef/Downloads/project1.sb3' :
|
||||
path.resolve(__dirname, '../fixtures/project1.sb3');
|
||||
|
||||
// upload file
|
||||
await clickXpath('//li[@class="link create"]');
|
||||
let gf = await findByXpath('//img[@class="green-flag_green-flag_1kiAo"]');
|
||||
await gf.isDisplayed();
|
||||
await clickText('File');
|
||||
await clickText('Load from your computer');
|
||||
await driver.sleep(1000);
|
||||
const input = await findByXpath('//input[@accept=".sb,.sb2,.sb3"]');
|
||||
await input.sendKeys(projectPath);
|
||||
|
||||
// accept alert
|
||||
let alert = await driver.switchTo().alert();
|
||||
await alert.accept();
|
||||
|
||||
// check that project is loaded
|
||||
let spriteTile = await findText('project1-sprite');
|
||||
let spriteTileVisible = await spriteTile.isDisplayed();
|
||||
await expect(spriteTileVisible).toBe(true);
|
||||
|
||||
// check that gui is still there after some time has passed
|
||||
await driver.sleep(1000);
|
||||
let infoArea = await findByXpath('//div[@class="sprite-info_sprite-info_3EyZh box_box_2jjDp"]');
|
||||
let areaVisible = await infoArea.isDisplayed();
|
||||
await expect(areaVisible).toBe(true);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue