Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 2554cb3

Browse files
committed
Reapply Austin's ADD: src query and tests
https://github.com/tableau/webdataconnector/pull/108/files
1 parent 817985f commit 2554cb3

4 files changed

Lines changed: 70 additions & 32 deletions

File tree

Simulator/tests/end-to-end/GeneralSimulator.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ describe('General Simulator Tests', function(){
3838
}
3939

4040
// open simulator page
41-
driver.get('http://localhost:8888/Simulator').then(function() {
41+
driver.get('http://localhost:8888/Simulator?src=srcQuery').then(function() {
4242
simulatorWindow = driver.getWindowHandle();
4343
done();
4444
});
@@ -70,6 +70,18 @@ describe('General Simulator Tests', function(){
7070
});
7171
})
7272

73+
it("Should Have Set Src Query Url", function(done){
74+
const wdcUrl = 'srcQuery';
75+
driver.findElement({id:'address-input'})
76+
.then(function (addressBar) {
77+
return addressBar.getAttribute("value");
78+
})
79+
.then(function(url) {
80+
url.should.be.equal(wdcUrl);
81+
done();
82+
});
83+
})
84+
7385
it("Should be Able to Enter a Url", function(done){
7486
let addressBar;
7587
const wdcUrl = '../Examples/html/earthquakeUSGS.html';

Simulator/utils/consts.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Cookie from 'js-cookie';
2+
import queryString from 'querystring';
23

34
// Set Class Constants
45
export const eventNames = {
@@ -49,7 +50,13 @@ export const samples = [
4950
];
5051

5152
export const defaultMostRecentUrls = Cookie.getJSON('mostRecentUrls') || [...samples];
52-
export const defaultUrl = [...defaultMostRecentUrls][0];
53+
54+
// if a src query was specified, use it, else use the first MRU
55+
// use a src query if one exists
56+
const srcQuery = typeof location !== 'undefined' ?
57+
queryString.parse(location.search.slice(1)).src : null;
58+
59+
export const defaultUrl = srcQuery || [...defaultMostRecentUrls][0];
5360

5461
export const WINDOW_PROPS = 'height=500,width=800';
5562

0 commit comments

Comments
 (0)