Skip to content

Commit 5a1870a

Browse files
committed
Log useragent
1 parent baea0c6 commit 5a1870a

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

test/end-to-end/src/test-taskpane.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as functionsJsonData from "./test-data.json";
22
import { pingTestServer, sendTestResults } from "office-addin-test-helpers";
33
import { closeWorkbook, sleep } from "./test-helpers";
44

5-
/* global Office, document, Excel, run */
5+
/* global Office, document, Excel, run, navigator */
66
const customFunctionsData = (<any>functionsJsonData).functions;
77
const port: number = 4201;
88
let testValues = [];
@@ -11,6 +11,7 @@ Office.onReady(async () => {
1111
document.getElementById("sideload-msg").style.display = "none";
1212
document.getElementById("app-body").style.display = "flex";
1313
document.getElementById("run").onclick = run;
14+
addTestResult("UserAgent", navigator.userAgent);
1415

1516
const testServerResponse: object = await pingTestServer(port);
1617
if (testServerResponse["status"] === 200) {

test/end-to-end/tests.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { connectToWebsocket, enableDebugging, pauseDebugging } from "./src/debug
99
import * as officeAddinTestServer from "office-addin-test-server";
1010
import * as path from "path";
1111

12-
/* global process, describe, before, it, after */
12+
/* global process, describe, before, it, after, console */
1313
const host: string = "excel";
1414
const manifestPath = path.resolve(`${process.cwd()}/test/end-to-end/test-manifest.xml`);
1515
const port: number = 4201;
@@ -43,41 +43,42 @@ describe("Test Excel Custom Functions", function () {
4343
describe("Get test results for custom functions and validate results", function () {
4444
it("should get results from the taskpane application", async function () {
4545
this.timeout(0);
46-
// Expecting six result values
46+
// Expecting six result values + user agent
4747
testValues = await testServer.getTestResults();
48-
assert.strictEqual(testValues.length, 6);
48+
console.log(`User Agent: ${testValues[0].Value}`);
49+
assert.strictEqual(testValues.length, 7);
4950
});
5051
it("ADD function should return expected value", async function () {
51-
assert.strictEqual(testJsonData.functions.ADD.result, testValues[0].Value);
52+
assert.strictEqual(testJsonData.functions.ADD.result, testValues[1].Value);
5253
});
5354
it("CLOCK function should return expected value", async function () {
5455
// Check that captured values are different to ensure the function is streaming
55-
assert.notStrictEqual(testValues[1].Value, testValues[2].Value);
56+
assert.notStrictEqual(testValues[2].Value, testValues[3].Value);
5657
// Check if the returned string contains 'AM', 'PM', or 'GMT', indicating it's a time-stamp
57-
assert.strictEqual(
58-
testValues[1].Value.includes(testJsonData.functions.CLOCK.result.amString) ||
59-
testValues[1].Value.includes(testJsonData.functions.CLOCK.result.pmString) ||
60-
testValues[1].Value.includes(testJsonData.functions.CLOCK.result.timeZoneString),
61-
true,
62-
"Found timestamp indicator string in first value '" + testValues[1].Value + "'"
63-
);
6458
assert.strictEqual(
6559
testValues[2].Value.includes(testJsonData.functions.CLOCK.result.amString) ||
6660
testValues[2].Value.includes(testJsonData.functions.CLOCK.result.pmString) ||
6761
testValues[2].Value.includes(testJsonData.functions.CLOCK.result.timeZoneString),
6862
true,
69-
"Found timestamp indicator string in second value '" + testValues[2].Value + "'"
63+
"Found timestamp indicator string in first value '" + testValues[2].Value + "'"
64+
);
65+
assert.strictEqual(
66+
testValues[3].Value.includes(testJsonData.functions.CLOCK.result.amString) ||
67+
testValues[3].Value.includes(testJsonData.functions.CLOCK.result.pmString) ||
68+
testValues[3].Value.includes(testJsonData.functions.CLOCK.result.timeZoneString),
69+
true,
70+
"Found timestamp indicator string in second value '" + testValues[3].Value + "'"
7071
);
7172
});
7273
it("INCREMENT function should return expected value", async function () {
7374
// Check that captured values are different to ensure the function is streaming
7475
assert.notStrictEqual(testValues[3].Value, testValues[4].Value);
7576
// Check to see that both captured streaming values are divisible by 4
76-
assert.strictEqual(0, testValues[3].Value % testJsonData.functions.INCREMENT.result);
7777
assert.strictEqual(0, testValues[4].Value % testJsonData.functions.INCREMENT.result);
78+
assert.strictEqual(0, testValues[5].Value % testJsonData.functions.INCREMENT.result);
7879
});
7980
it("LOG function should return expected value", async function () {
80-
assert.strictEqual(testJsonData.functions.LOG.result, testValues[5].Value);
81+
assert.strictEqual(testJsonData.functions.LOG.result, testValues[6].Value);
8182
});
8283
});
8384
after("Teardown test environment", async function () {

0 commit comments

Comments
 (0)