fixed more repo= qs stuff

This commit is contained in:
Steven Hugg 2022-02-13 13:25:57 -06:00
parent f73e1dbf66
commit 1a062650ad
2 changed files with 14 additions and 5 deletions

View File

@ -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;

View File

@ -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')