From 1a062650ad995dc3694df9ec07899dc7d2b37e59 Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sun, 13 Feb 2022 13:25:57 -0600 Subject: [PATCH] fixed more repo= qs stuff --- src/ide/ui.ts | 3 ++- test/web/testimport.js | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/ide/ui.ts b/src/ide/ui.ts index d2af8497..518b96f3 100644 --- a/src/ide/ui.ts +++ b/src/ide/ui.ts @@ -2383,8 +2383,9 @@ export function getPlatformAndRepo() { var repo = getRepos()[repo_id]; // override query string params w/ repo settings if (repo) { + console.log(platform_id, qs, repo); qs.repo = repo_id; - if (repo.platform_id) + if (repo.platform_id && !qs.platform) qs.platform = platform_id = repo.platform_id; if (!qs.file && repo.mainPath) qs.file = repo.mainPath; diff --git a/test/web/testimport.js b/test/web/testimport.js index bc4f607c..0da05602 100644 --- a/test/web/testimport.js +++ b/test/web/testimport.js @@ -9,8 +9,8 @@ var FILE = 'happy2020.c' var PRESETFILE = 'hello.c' var QS_GITHUBURL = '&githubURL=https%3A%2F%2Fgithub.com%2F' + REPO -let github_config = JSON.parse(require('fs').readFileSync('./github.json','utf-8')); -if (github_config?.token) { +try { + var github_config = JSON.parse(require('fs').readFileSync('./github.json','utf-8')); exports['beforeEach'] = function(browser) { browser.setCookie({ name: '__github_key', @@ -18,8 +18,8 @@ if (github_config?.token) { path: '/' }); } -} else { - throw new Error('need ./github.js with {token:"..."}') +} catch (e) { + console.log('warning: need ./github.json with {token:"..."}') } exports['test import Github'] = async function (browser) { @@ -63,6 +63,14 @@ exports['test import Github'] = async function (browser) { browser.expect.url().to.contain(`file=${FILE}`) browser.expect.url().to.contain(`repo=${REPO.replace('/', '%2F')}`) + await browser.url(`${IDEURL}?platform=apple2`) + .waitForElementNotVisible('#error_alert') + .waitForElementVisible('#emuscreen') + .waitForElementVisible('.emuvideo') + + browser.expect.url().to.contain(`platform=apple2`) + browser.expect.url().to.not.contain(`repo=${REPO.replace('/', '%2F')}`) + await browser.url(`${IDEURL}?platform=${PLATFORM}&file=${PRESETFILE}`) .waitForElementNotVisible('#error_alert') .waitForElementVisible('#emuscreen')