Skip to content

Commit 8913a38

Browse files
author
David Renshaw
committed
Get the powerbox tests to pass.
1 parent a20e07d commit 8913a38

File tree

1 file changed

+48
-52
lines changed

1 file changed

+48
-52
lines changed

tests/apps/powerbox.js

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,26 @@ var utils = require("../utils"),
2828

2929
module.exports = {};
3030

31-
module.exports["Install Powerbox"] = function (browser) {
32-
browser
33-
.init()
34-
.installApp("http://sandstorm.io/apps/jparyani/powerbox-4.spk", "baaceb4cda0d9451968670a3d4ffe5e7", "jm40yaw7zvnxyggqt2dddp5ztt0f5wku7a8wfz8uzn9cjus46ygh")
35-
.assert.containsText("#grainTitle", "Untitled PowerboxTest");
36-
};
37-
31+
// Source at https://github.com/jparyani/sandstorm-test-app/tree/powerbox
3832
module.exports["Test Powerbox"] = function (browser) {
3933
browser
34+
.init()
35+
.installApp("http://sandstorm.io/apps/david/sandstorm-powerbox-test-app.spk",
36+
"d0c0736300b0bb5e359f6eca53b69348",
37+
"j1wk2t2h5shy85mt2usv26dxsak38xuxh3yyg1dkvx34jydrcvmh")
38+
.assert.containsText("#grainTitle", "Untitled PowerboxTest")
4039
.waitForElementVisible('.grain-frame', short_wait)
4140
.frame("grain-frame")
42-
.waitForElementVisible("#offer", short_wait)
43-
.click("#offer")
44-
.waitForElementVisible("#offer-result", short_wait)
45-
.assert.containsText("#offer-result", "offer: success")
41+
.waitForElementVisible("#offer", short_wait)
42+
.click("#offer")
43+
.waitForElementVisible("#offer-result", short_wait)
44+
.assert.containsText("#offer-result", "offer: success")
4645
.frameParent()
4746
.waitForElementVisible("#powerbox-offer-url", short_wait)
4847
.getText("#powerbox-offer-url", function (result) {
4948
browser
5049
.frame("grain-frame")
51-
.click("#request")
50+
.click("#request")
5251
.frameParent()
5352
.waitForElementVisible("#powerbox-request-input", short_wait)
5453
.setValue("#powerbox-request-input", result.value)
@@ -59,28 +58,27 @@ module.exports["Test Powerbox"] = function (browser) {
5958
});
6059
};
6160

62-
// Source at https://github.com/jparyani/sandstorm-test-app/tree/powerbox-save
63-
module.exports["Install PowerboxSave"] = function (browser) {
64-
browser
65-
.init()
66-
.installApp("http://sandstorm.io/apps/jparyani/powerbox-save-0.spk", "5af2a3ca2a4e99ff082c458321c85105", "f6pf7a9my5vrcxk22f00msk97zss1ukz5fvesuh2mxfhs8uzvwu0")
67-
.assert.containsText("#grainTitle", "Untitled PowerboxSaveTest");
68-
};
6961

7062
module.exports["Test PowerboxSave"] = function (browser) {
7163
browser
64+
browser
65+
.init()
66+
.installApp("http://sandstorm.io/apps/david/sandstorm-powerbox-test-app.spk",
67+
"d0c0736300b0bb5e359f6eca53b69348",
68+
"j1wk2t2h5shy85mt2usv26dxsak38xuxh3yyg1dkvx34jydrcvmh")
69+
.assert.containsText("#grainTitle", "Untitled PowerboxTest")
7270
.waitForElementVisible('.grain-frame', short_wait)
7371
.frame("grain-frame")
74-
.waitForElementVisible("#offer", short_wait)
75-
.click("#offer")
76-
.waitForElementVisible("#offer-result", short_wait)
77-
.assert.containsText("#offer-result", "offer: success")
72+
.waitForElementVisible("#offer", short_wait)
73+
.click("#offer")
74+
.waitForElementVisible("#offer-result", short_wait)
75+
.assert.containsText("#offer-result", "offer: success")
7876
.frameParent()
7977
.waitForElementVisible("#powerbox-offer-url", short_wait)
8078
.getText("#powerbox-offer-url", function (result) {
8179
browser
8280
.frame("grain-frame")
83-
.click("#request")
81+
.click("#request-save-restore")
8482
.frameParent()
8583
.waitForElementVisible("#powerbox-request-input", short_wait)
8684
.setValue("#powerbox-request-input", result.value)
@@ -91,45 +89,43 @@ module.exports["Test PowerboxSave"] = function (browser) {
9189
});
9290
};
9391

94-
// This powerbox app adds `requiredPermissions` to the `restore` call that aren't satisfied.
92+
// This test adds `requiredPermissions` to the `restore` call that aren't satisfied.
9593
// We test to make sure an error is thrown.
96-
// Source at https://github.com/jparyani/sandstorm-test-app/tree/powerbox-permissions
97-
module.exports["Install Powerbox with failing requirements"] = function (browser) {
94+
module.exports["Test Powerbox with failing requirements"] = function (browser) {
9895
browser
9996
.init()
100-
.installApp("http://sandstorm.io/apps/jparyani/powerbox-2.spk", "9d6493e63bc9919de3959fe0c5a131ad", "jm40yaw7zvnxyggqt2dddp5ztt0f5wku7a8wfz8uzn9cjus46ygh")
101-
.assert.containsText("#grainTitle", "Untitled PowerboxTest sandstormtest");
102-
};
97+
.installApp("http://sandstorm.io/apps/david/sandstorm-powerbox-test-app.spk",
98+
"d0c0736300b0bb5e359f6eca53b69348",
99+
"j1wk2t2h5shy85mt2usv26dxsak38xuxh3yyg1dkvx34jydrcvmh")
100+
.assert.containsText("#grainTitle", "Untitled PowerboxTest")
103101

104-
module.exports["Test Powerbox with failing requirements"] = function (browser) {
105-
browser
106102
// We'll use the debugLog at the bottom of the test, but it's nice to open it early and give it time to load.
107103
.click("#openDebugLog")
108104
.waitForElementVisible('.grain-frame', short_wait)
109105
.frame("grain-frame")
110-
.waitForElementVisible("#offer", short_wait)
111-
.click("#offer")
112-
.waitForElementVisible("#offer-result", short_wait)
113-
.assert.containsText("#offer-result", "offer: success")
106+
.waitForElementVisible("#offer", short_wait)
107+
.click("#offer")
108+
.waitForElementVisible("#offer-result", short_wait)
109+
.assert.containsText("#offer-result", "offer: success")
114110
.frameParent()
115111
.waitForElementVisible("#powerbox-offer-url", short_wait)
116112
.getText("#powerbox-offer-url", function (result) {
117-
browser
118-
.frame("grain-frame")
119-
.click("#request")
120-
.frame()
121-
.waitForElementVisible("#powerbox-request-input", short_wait)
122-
.setValue("#powerbox-request-input", result.value)
123-
.click("#powerbox-request-form button")
124-
.frame("grain-frame")
125-
.waitForElementVisible("#request-result", short_wait)
126-
.assert.containsText("#request-result", "request:")
127-
.windowHandles(function (windows) {
128-
browser
129-
.switchWindow(windows.value[1])
130-
.waitForElementVisible(".grainlog-contents > pre", short_wait)
131-
.assert.containsText(".grainlog-contents > pre", "Error: Requirements not satisfied")
132-
});
113+
browser
114+
.frame("grain-frame")
115+
.click("#request-failing-requirements")
116+
.frame()
117+
.waitForElementVisible("#powerbox-request-input", short_wait)
118+
.setValue("#powerbox-request-input", result.value)
119+
.click("#powerbox-request-form button")
120+
.frame("grain-frame")
121+
.waitForElementVisible("#request-result", short_wait)
122+
.assert.containsText("#request-result", "request:")
123+
.windowHandles(function (windows) {
124+
browser
125+
.switchWindow(windows.value[1])
126+
.waitForElementVisible(".grainlog-contents > pre", short_wait)
127+
.assert.containsText(".grainlog-contents > pre", "Error: Requirements not satisfied")
128+
});
133129
})
134130
.end();
135131
};

0 commit comments

Comments
 (0)