|
| 1 | +/* |
| 2 | + * Copyright 2018 IBM Corporation |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +const common = require('../../../lib/common'), |
| 18 | + openwhisk = require('../../../lib/openwhisk'), |
| 19 | + ui = require('../../../lib/ui'), |
| 20 | + assert = require('assert'), |
| 21 | + keys = ui.keys, |
| 22 | + cli = ui.cli, |
| 23 | + sidecar = ui.sidecar, |
| 24 | + actionName = `foo-${new Date().getTime()}`, |
| 25 | + actionName2 = 'foo2', |
| 26 | + fs = require('fs') |
| 27 | + |
| 28 | +describe('activation list, activation get, click on header', function() { |
| 29 | + before(common.before(this)) |
| 30 | + after(common.after(this)) |
| 31 | + |
| 32 | + it('should have an active repl', () => cli.waitForRepl(this.app)) |
| 33 | + |
| 34 | + it('should create an action', () => cli.do(`let ${actionName} = x=>x -p x 3`, this.app) |
| 35 | + .then(cli.expectOK) |
| 36 | + .then(sidecar.expectOpen) |
| 37 | + .then(sidecar.expectShowing(actionName)) |
| 38 | + .catch(common.oops(this))) |
| 39 | + |
| 40 | + const expectedSrc = 'let main = x => x' |
| 41 | + |
| 42 | + it('should async that action and click on the activation id', () => cli.do(`async ${actionName}`, this.app) |
| 43 | + .then(cli.expectOKWithCustom(cli.makeCustom('.activationId', ''))) |
| 44 | + .then(selector => this.app.client.getText(selector) |
| 45 | + .then(activationId => this.app.client.click(selector) |
| 46 | + .then(() => sidecar.expectOpen(this.app)) |
| 47 | + .then(sidecar.expectShowing(actionName, activationId)))) |
| 48 | + .catch(common.oops(this))) |
| 49 | + |
| 50 | + it(`click on action name in sidecar header and show action source`, () => this.app.client.click(ui.selectors.SIDECAR_TITLE) |
| 51 | + .then(() => this.app) |
| 52 | + .then(sidecar.expectOpen) |
| 53 | + .then(sidecar.expectShowing(actionName)) |
| 54 | + .then(() => this.app.client.waitUntil(() => this.app.client.getText(ui.selectors.SIDECAR_ACTION_SOURCE)) |
| 55 | + .then(x => x.trim()) |
| 56 | + .then(actualSrc => actualSrc === expectedSrc)) |
| 57 | + .catch(common.oops(this))) |
| 58 | +}) |
0 commit comments