How to use environment.stop method in qawolf

Best JavaScript code snippet using qawolf

stopFabricRuntime.test.ts

Source:stopFabricRuntime.test.ts Github

copy

Full Screen

1/*2 * Licensed under the Apache License, Version 2.0 (the "License");3 * you may not use this file except in compliance with the License.4 * You may obtain a copy of the License at5 *6 * http://www.apache.org/licenses/LICENSE-2.07 *8 * Unless required by applicable law or agreed to in writing, software9 * distributed under the License is distributed on an "AS IS" BASIS,10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11 * See the License for the specific language governing permissions and12 * limitations under the License.13*/14import * as vscode from 'vscode';15import { ExtensionUtil } from '../../extension/util/ExtensionUtil';16import { VSCodeBlockchainOutputAdapter } from '../../extension/logging/VSCodeBlockchainOutputAdapter';17import { TestUtil } from '../TestUtil';18import * as chai from 'chai';19import * as sinon from 'sinon';20import { ExtensionCommands } from '../../ExtensionCommands';21import { FabricGatewayConnectionManager } from '../../extension/fabric/FabricGatewayConnectionManager';22import { FabricEnvironmentRegistry, FabricEnvironmentRegistryEntry, FabricRuntimeUtil, LogType, FabricGatewayRegistry, FabricGatewayRegistryEntry, EnvironmentFlags } from 'ibm-blockchain-platform-common';23import { FabricEnvironmentManager } from '../../extension/fabric/environments/FabricEnvironmentManager';24import { UserInputUtil, IBlockchainQuickPickItem } from '../../extension/commands/UserInputUtil';25import { EnvironmentFactory } from '../../extension/fabric/environments/EnvironmentFactory';26import { RuntimeTreeItem } from '../../extension/explorer/runtimeOps/disconnectedTree/RuntimeTreeItem';27import { BlockchainEnvironmentExplorerProvider } from '../../extension/explorer/environmentExplorer';28import { LocalMicroEnvironment } from '../../extension/fabric/environments/LocalMicroEnvironment';29chai.should();30// tslint:disable no-unused-expression31describe('stopFabricRuntime', () => {32 const sandbox: sinon.SinonSandbox = sinon.createSandbox();33 const connectionRegistry: FabricGatewayRegistry = FabricGatewayRegistry.instance();34 let getGatewayRegistryEntryStub: sinon.SinonStub;35 let getEnvironmentRegistryEntryStub: sinon.SinonStub;36 let logSpy: sinon.SinonSpy;37 let stopStub: sinon.SinonStub;38 let executeCommandSpy: sinon.SinonSpy;39 let getConnectionStub: sinon.SinonStub;40 let showFabricEnvironmentQuickPickBoxStub: sinon.SinonStub;41 let localRegistryEntry: FabricEnvironmentRegistryEntry;42 before(async () => {43 await TestUtil.setupTests(sandbox);44 });45 beforeEach(async () => {46 await ExtensionUtil.activateExtension();47 await connectionRegistry.clear();48 await TestUtil.startLocalFabric();49 const localGateway: FabricGatewayRegistryEntry = await FabricGatewayRegistry.instance().get(`${FabricRuntimeUtil.LOCAL_FABRIC} - Org1 Gateway`);50 getGatewayRegistryEntryStub = sandbox.stub(FabricGatewayConnectionManager.instance(), 'getGatewayRegistryEntry');51 getGatewayRegistryEntryStub.resolves(localGateway);52 getEnvironmentRegistryEntryStub = sandbox.stub(FabricEnvironmentManager.instance(), 'getEnvironmentRegistryEntry');53 getConnectionStub = sandbox.stub(FabricEnvironmentManager.instance(), 'getConnection');54 getConnectionStub.returns(undefined);55 const localEnvironment: FabricEnvironmentRegistryEntry = await FabricEnvironmentRegistry.instance().get(FabricRuntimeUtil.LOCAL_FABRIC);56 getEnvironmentRegistryEntryStub.returns(localEnvironment);57 logSpy = sandbox.spy(VSCodeBlockchainOutputAdapter.instance(), 'log');58 executeCommandSpy = sandbox.spy(vscode.commands, 'executeCommand');59 localRegistryEntry = await FabricEnvironmentRegistry.instance().get(FabricRuntimeUtil.LOCAL_FABRIC);60 showFabricEnvironmentQuickPickBoxStub = sandbox.stub(UserInputUtil, 'showFabricEnvironmentQuickPickBox');61 showFabricEnvironmentQuickPickBoxStub.resolves({ label: FabricRuntimeUtil.LOCAL_FABRIC, data: localRegistryEntry });62 });63 afterEach(async () => {64 sandbox.restore();65 await connectionRegistry.clear();66 });67 it('should do nothing and report a warning on Eclipse Che', async () => {68 sandbox.stub(ExtensionUtil, 'isChe').returns(true);69 await vscode.commands.executeCommand(ExtensionCommands.STOP_FABRIC_SHORT);70 logSpy.should.have.been.calledWithExactly(LogType.ERROR, sinon.match(/not supported/));71 });72 it('should stop a Fabric environment from the tree', async () => {73 const environment: LocalMicroEnvironment = EnvironmentFactory.getEnvironment(localRegistryEntry) as LocalMicroEnvironment;74 stopStub = sandbox.stub(environment, 'stop').resolves();75 sandbox.stub(environment, 'startLogs').resolves();76 const blockchainEnvironmentExplorerProvider: BlockchainEnvironmentExplorerProvider = ExtensionUtil.getBlockchainEnvironmentExplorerProvider();77 const treeItem: RuntimeTreeItem = await RuntimeTreeItem.newRuntimeTreeItem(blockchainEnvironmentExplorerProvider,78 environment.getName(),79 localRegistryEntry,80 {81 command: ExtensionCommands.CONNECT_TO_ENVIRONMENT,82 title: '',83 arguments: [localRegistryEntry]84 },85 environment86 );87 getGatewayRegistryEntryStub.resolves();88 getEnvironmentRegistryEntryStub.returns(undefined);89 await vscode.commands.executeCommand(ExtensionCommands.STOP_FABRIC_SHORT, treeItem);90 stopStub.should.have.been.called.calledOnceWithExactly(VSCodeBlockchainOutputAdapter.instance());91 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_GATEWAY);92 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_ENVIRONMENT);93 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_ENVIRONMENTS);94 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_GATEWAYS);95 logSpy.should.have.been.calledOnceWithExactly(LogType.INFO, undefined, 'stopFabricRuntime');96 });97 it('should stop a Fabric runtime, disconnect from gateway and refresh the view', async () => {98 const environment: LocalMicroEnvironment = EnvironmentFactory.getEnvironment(localRegistryEntry) as LocalMicroEnvironment;99 stopStub = sandbox.stub(environment, 'stop').resolves();100 sandbox.stub(environment, 'startLogs').resolves();101 const blockchainEnvironmentExplorerProvider: BlockchainEnvironmentExplorerProvider = ExtensionUtil.getBlockchainEnvironmentExplorerProvider();102 const treeItem: RuntimeTreeItem = await RuntimeTreeItem.newRuntimeTreeItem(blockchainEnvironmentExplorerProvider,103 environment.getName(),104 localRegistryEntry,105 {106 command: ExtensionCommands.CONNECT_TO_ENVIRONMENT,107 title: '',108 arguments: [localRegistryEntry]109 },110 environment111 );112 getEnvironmentRegistryEntryStub.returns(undefined);113 await vscode.commands.executeCommand(ExtensionCommands.STOP_FABRIC_SHORT, treeItem);114 stopStub.should.have.been.called.calledOnceWithExactly(VSCodeBlockchainOutputAdapter.instance());115 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.DISCONNECT_GATEWAY);116 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_ENVIRONMENT);117 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_ENVIRONMENTS);118 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_GATEWAYS);119 logSpy.should.have.been.calledOnceWithExactly(LogType.INFO, undefined, 'stopFabricRuntime');120 });121 it('should stop a Fabric runtime, disconnect from environment and refresh the view', async () => {122 const environment: LocalMicroEnvironment = EnvironmentFactory.getEnvironment(localRegistryEntry) as LocalMicroEnvironment;123 stopStub = sandbox.stub(environment, 'stop').resolves();124 sandbox.stub(environment, 'startLogs').resolves();125 const blockchainEnvironmentExplorerProvider: BlockchainEnvironmentExplorerProvider = ExtensionUtil.getBlockchainEnvironmentExplorerProvider();126 const treeItem: RuntimeTreeItem = await RuntimeTreeItem.newRuntimeTreeItem(blockchainEnvironmentExplorerProvider,127 environment.getName(),128 localRegistryEntry,129 {130 command: ExtensionCommands.CONNECT_TO_ENVIRONMENT,131 title: '',132 arguments: [localRegistryEntry]133 },134 environment135 );136 getGatewayRegistryEntryStub.resolves();137 await vscode.commands.executeCommand(ExtensionCommands.STOP_FABRIC_SHORT, treeItem);138 stopStub.should.have.been.called.calledOnceWithExactly(VSCodeBlockchainOutputAdapter.instance());139 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_GATEWAY);140 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.DISCONNECT_ENVIRONMENT);141 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_ENVIRONMENTS);142 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_GATEWAYS);143 logSpy.should.have.been.calledOnceWithExactly(LogType.INFO, undefined, 'stopFabricRuntime');144 });145 it('should display an error if stopping Fabric Runtime fails', async () => {146 const error: Error = new Error('what the fabric has happened');147 const environment: LocalMicroEnvironment = EnvironmentFactory.getEnvironment(localRegistryEntry) as LocalMicroEnvironment;148 stopStub = sandbox.stub(environment, 'stop').throws(error);149 sandbox.stub(environment, 'startLogs').resolves();150 const blockchainEnvironmentExplorerProvider: BlockchainEnvironmentExplorerProvider = ExtensionUtil.getBlockchainEnvironmentExplorerProvider();151 const treeItem: RuntimeTreeItem = await RuntimeTreeItem.newRuntimeTreeItem(blockchainEnvironmentExplorerProvider,152 environment.getName(),153 localRegistryEntry,154 {155 command: ExtensionCommands.CONNECT_TO_ENVIRONMENT,156 title: '',157 arguments: [localRegistryEntry]158 },159 environment160 );161 getGatewayRegistryEntryStub.resolves();162 getEnvironmentRegistryEntryStub.returns(undefined);163 await vscode.commands.executeCommand(ExtensionCommands.STOP_FABRIC_SHORT, treeItem);164 stopStub.should.have.been.called.calledOnceWithExactly(VSCodeBlockchainOutputAdapter.instance());165 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_GATEWAY);166 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_ENVIRONMENT);167 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_ENVIRONMENTS);168 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_GATEWAYS);169 logSpy.getCall(0).should.have.been.calledWithExactly(LogType.INFO, undefined, 'stopFabricRuntime');170 logSpy.getCall(1).should.have.been.calledWithExactly(LogType.ERROR, `Failed to stop ${environment.getName()}: ${error.message}`, `Failed to stop ${environment.getName()}: ${error.toString()}`);171 });172 it('should be able to stop the an environment from the command', async () => {173 showFabricEnvironmentQuickPickBoxStub.resolves({ label: FabricRuntimeUtil.LOCAL_FABRIC, data: localRegistryEntry } as IBlockchainQuickPickItem<FabricEnvironmentRegistryEntry>);174 const environment: LocalMicroEnvironment = EnvironmentFactory.getEnvironment(localRegistryEntry) as LocalMicroEnvironment;175 stopStub = sandbox.stub(environment, 'stop').resolves();176 sandbox.stub(environment, 'startLogs').resolves();177 getGatewayRegistryEntryStub.resolves();178 getEnvironmentRegistryEntryStub.returns(undefined);179 await vscode.commands.executeCommand(ExtensionCommands.STOP_FABRIC);180 showFabricEnvironmentQuickPickBoxStub.should.have.been.calledOnceWithExactly('Select an environment to stop', false, true, [EnvironmentFlags.LOCAL], [], true);181 stopStub.should.have.been.called.calledOnceWithExactly(VSCodeBlockchainOutputAdapter.instance());182 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_GATEWAY);183 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_ENVIRONMENT);184 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_ENVIRONMENTS);185 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_GATEWAYS);186 logSpy.should.have.been.calledOnceWithExactly(LogType.INFO, undefined, 'stopFabricRuntime');187 });188 it('should stop local connected environment (called from three dot menu)', async () => {189 getConnectionStub.returns({});190 const environment: LocalMicroEnvironment = EnvironmentFactory.getEnvironment(localRegistryEntry) as LocalMicroEnvironment;191 stopStub = sandbox.stub(environment, 'stop').resolves();192 getGatewayRegistryEntryStub.resolves();193 await vscode.commands.executeCommand(ExtensionCommands.STOP_FABRIC);194 showFabricEnvironmentQuickPickBoxStub.should.not.have.been.called;195 stopStub.should.have.been.called.calledOnceWithExactly(VSCodeBlockchainOutputAdapter.instance());196 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_GATEWAY);197 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.DISCONNECT_ENVIRONMENT);198 logSpy.should.have.been.calledOnceWithExactly(LogType.INFO, undefined, 'stopFabricRuntime');199 });200 it('should ask what environment to stop if connected to non-managed environment', async () => {201 getEnvironmentRegistryEntryStub.returns({name: 'otherEnvironment'} as FabricEnvironmentRegistryEntry);202 const environment: LocalMicroEnvironment = EnvironmentFactory.getEnvironment(localRegistryEntry) as LocalMicroEnvironment;203 stopStub = sandbox.stub(environment, 'stop').resolves();204 getGatewayRegistryEntryStub.resolves();205 showFabricEnvironmentQuickPickBoxStub.resolves({label: FabricRuntimeUtil.LOCAL_FABRIC, data: localRegistryEntry} as IBlockchainQuickPickItem<FabricEnvironmentRegistryEntry>);206 await vscode.commands.executeCommand(ExtensionCommands.STOP_FABRIC);207 showFabricEnvironmentQuickPickBoxStub.should.have.been.calledOnceWithExactly('Select an environment to stop', false, true, [EnvironmentFlags.LOCAL], [], true);208 stopStub.should.have.been.called.calledOnceWithExactly(VSCodeBlockchainOutputAdapter.instance());209 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_GATEWAY);210 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_ENVIRONMENT);211 logSpy.should.have.been.calledOnceWithExactly(LogType.INFO, undefined, 'stopFabricRuntime');212 });213 it('should be able to cancel choosing an environment to stop', async () => {214 showFabricEnvironmentQuickPickBoxStub.resolves(undefined);215 await vscode.commands.executeCommand(ExtensionCommands.STOP_FABRIC);216 showFabricEnvironmentQuickPickBoxStub.should.have.been.calledOnceWithExactly('Select an environment to stop', false, true, [EnvironmentFlags.LOCAL], [], true);217 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_GATEWAY);218 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_ENVIRONMENT);219 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.REFRESH_ENVIRONMENTS);220 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.REFRESH_GATEWAYS);221 logSpy.should.have.been.calledOnceWithExactly(LogType.INFO, undefined, 'stopFabricRuntime');222 });223 it(`shouldn't disconnect from the connected gateway if the environment isn't associated`, async () => {224 showFabricEnvironmentQuickPickBoxStub.resolves({ label: FabricRuntimeUtil.LOCAL_FABRIC, data: localRegistryEntry });225 stopStub = sandbox.stub(LocalMicroEnvironment.prototype, 'stop').resolves();226 getEnvironmentRegistryEntryStub.returns(undefined);227 const localEnv: LocalMicroEnvironment = EnvironmentFactory.getEnvironment(localRegistryEntry) as LocalMicroEnvironment;228 sandbox.stub(EnvironmentFactory, 'getEnvironment').returns(localEnv);229 getGatewayRegistryEntryStub.resolves({230 name: 'SomeGateway',231 fromEnvironment: 'SomeEnvironment'232 } as FabricGatewayRegistryEntry);233 await vscode.commands.executeCommand(ExtensionCommands.STOP_FABRIC);234 showFabricEnvironmentQuickPickBoxStub.should.have.been.calledOnceWithExactly('Select an environment to stop', false, true, [EnvironmentFlags.LOCAL], [], true);235 stopStub.should.have.been.called.calledOnceWithExactly(VSCodeBlockchainOutputAdapter.instance());236 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_GATEWAY);237 executeCommandSpy.should.not.have.been.calledWith(ExtensionCommands.DISCONNECT_ENVIRONMENT);238 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_ENVIRONMENTS);239 executeCommandSpy.should.have.been.calledWith(ExtensionCommands.REFRESH_GATEWAYS);240 logSpy.should.have.been.calledOnceWithExactly(LogType.INFO, undefined, 'stopFabricRuntime');241 });...

Full Screen

Full Screen

environment.js

Source:environment.js Github

copy

Full Screen

...24 environment.start();25};26Template.environment.destroyed = function() {27 if (environment) {28 environment.stop();29 }30};31Template.environment.helpers({32 bonuses: function() {33 return ALL_BONUSES;34 },35 modeIsSelected: function(gameMode) {36 return Session.get('dev.environment.currentMode') === gameMode;37 },38 netEnabled: function() {39 return netEnabled.get();40 },41 soccerNetEnabled: function() {42 return soccerNetEnabled.get();43 },44 groundHitEnabled: function() {45 return groundHitEnabled.get();46 },47 ballHitCountEnabled: function() {48 return ballHitCountEnabled.get();49 },50 matchPointEnabled: function() {51 return matchPointEnabled.get();52 },53 deucePointEnabled: function() {54 return deucePointEnabled.get();55 }56});57Template.environment.events({58 'click [data-action="kill-player"]': function() {59 environment.killPlayer();60 },61 'click [data-action="revive-player"]': function() {62 environment.revivePlayer();63 },64 'click [data-action="create-bonus"]': function() {65 environment.createBonus($('#bonus-class')[0].value);66 },67 'click [data-action="change-game-mode"]': function(e) {68 Session.set('dev.environment.currentMode', $(e.currentTarget).attr('data-game-mode-id'));69 environment.stop();70 environment = new Environment();71 environment.start();72 },73 'click [data-action="enable-disable-has-net"]': function() {74 netEnabled.set(!netEnabled.get());75 Session.set('dev.environment.hasNet', netEnabled.get());76 environment.stop();77 environment = new Environment();78 environment.start();79 },80 'click [data-action="enable-disable-soccer-net"]': function() {81 soccerNetEnabled.set(!soccerNetEnabled.get());82 Session.set('dev.environment.soccerNetEnabled', soccerNetEnabled.get());83 environment.stop();84 environment = new Environment();85 environment.start();86 },87 'click [data-action="enable-disable-ground-hit"]': function() {88 if (groundHitEnabled.get()) {89 environment.disableGroundHit();90 } else {91 environment.enableGroundHit();92 }93 groundHitEnabled.set(!groundHitEnabled.get());94 Session.set('dev.environment.groundHitEnabled', groundHitEnabled.get());95 },96 'click [data-action="enable-ball-hit-count"]': function() {97 if (ballHitCountEnabled.get()) {...

Full Screen

Full Screen

ClientBackend.integration.js

Source:ClientBackend.integration.js Github

copy

Full Screen

1/* eslint-disable no-unused-expressions */2/* global describe before after */3import { testValidationBehavior } from '../behavior/SimpleWallet.behavior'4import {5 testCancelByUrlBehavior,6 testCreateWalletBehavior,7 testRecoverWalletBehavior8} from '../behavior/SimpleManager.behavior'9import TestEnvironment from '../../utils/TestEnvironment'10import { Backend } from '../../../src/js/backend/Backend'11import SMSmock from '../../../src/js/mocks/SMS.mock'12import { SmsManager } from '../../../src/js/backend/SmsManager'13import { generateMockJwt } from '../../backend/testutils'14const jwt = require('../../backend/testJwt').jwt15const phoneNumber = '+1-541-754-3010'16// we use predictable SMS code generation for tests. this code predicts SMS codes.17function calculateSmsCode () {18 const smsProvider = new SMSmock()19 const smsManager = new SmsManager({ smsProvider, secretSMSCodeSeed: Buffer.from('f'.repeat(64), 'hex') })20 const backendTestInstance = new Backend(21 {22 smsManager: smsManager,23 audience: '202746986880-u17rbgo95h7ja4fghikietupjknd1bln.apps.googleusercontent.com'24 })25 backendTestInstance.secretSMSCodeSeed = Buffer.from('f'.repeat(64), 'hex')26 const minuteTimestamp = backendTestInstance.smsManager.getMinuteTimestamp({})27 const phoneNumber = '+1-541-754-3010'28 return backendTestInstance.smsManager.calcSmsCode({29 phoneNumber: backendTestInstance._formatPhoneNumber(phoneNumber),30 email: 'shahaf@tabookey.com',31 minuteTimeStamp: minuteTimestamp32 })33}34async function newTest () {35 const testContext = await TestEnvironment.initializeAndStartBackendForRealGSN({})36 await testContext.manager.googleLogin()37 testContext.jwt = jwt38 testContext.smsCode = calculateSmsCode()39 return testContext40}41describe('Client <-> Backend <-> Blockchain', async function () {42 before(async () => {43 // restart GSN (someone, previous tests left it in an unstable state.44 TestEnvironment.stopBackendServer(true)45 })46 describe('SimpleManager', async function () {47 describe('#cancelByUrl()', async function () {48 let testContext49 before(async function () {50 this.timeout(30000)51 testContext = await newTest()52 })53 testCancelByUrlBehavior(() => testContext)54 after('stop backend', async () => {55 await TestEnvironment.stopBackendServer()56 })57 })58 describe('#createWallet()', async function () {59 let testContext60 before(async function () {61 this.timeout(30000)62 testContext = await newTest()63 testContext.phoneNumber = '+1-541-754-3010'64 })65 testCreateWalletBehavior(() => testContext)66 after('stop backend', async () => {67 await TestEnvironment.stopBackendServer()68 })69 })70 describe('#recoverWallet()', async function () {71 let testContext72 const newOperatorAddress = '0x' + '7'.repeat(40)73 before(async function () {74 this.timeout(30000)75 testContext = await newTest()76 const email = await testContext.manager.getEmail()77 testContext.jwt = generateMockJwt({ email, nonce: newOperatorAddress })78 testContext.smsCode = calculateSmsCode()79 testContext.newOperatorAddress = newOperatorAddress80 })81 after('stop backend', async () => {82 await TestEnvironment.stopBackendServer()83 })84 testRecoverWalletBehavior(() => testContext)85 })86 })87 describe.skip('SimpleWallet', async function () {88 let testContext89 before(async function () {90 this.timeout(30000)91 testContext = await TestEnvironment.initializeAndStartBackendForRealGSN({})92 await testContext.manager.googleLogin()93 const wallet = await testContext.manager.createWallet({94 jwt, phoneNumber, smsVerificationCode: calculateSmsCode()95 })96 testContext.wallet = wallet97 testContext.smartAccount = wallet.contract98 })99 after('stop backend', async () => {100 await TestEnvironment.stopBackendServer()101 })102 testValidationBehavior(() => testContext)103 })...

Full Screen

Full Screen

workflow-steps-plugin.js

Source:workflow-steps-plugin.js Github

copy

Full Screen

1/*2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.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 * A copy of the License is located at7 *8 * http://aws.amazon.com/apache2.09 *10 * or in the "license" file accompanying this file. This file is distributed11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either12 * express or implied. See the License for the specific language governing13 * permissions and limitations under the License.14 */15/* eslint-disable global-require */16const deleteEnvironment = require('../steps/delete-environment/delete-environment');17const deleteEnvironmentYaml = require('../steps/delete-environment/delete-environment.yml');18const provisionAccount = require('../steps/provision-account/provision-account');19const provisionAccountYaml = require('../steps/provision-account/provision-account.yml');20const provisionEnvironment = require('../steps/provision-environment/provision-environment');21const provisionEnvironmentYaml = require('../steps/provision-environment/provision-environment.yml');22const startSageMakerEnvironment = require('../steps/start-sagemaker-environment/start-sagemaker-environment');23const startSageMakerEnvironmentYaml = require('../steps/start-sagemaker-environment/start-sagemaker-environment.yml');24const stopSageMakerEnvironment = require('../steps/stop-sagemaker-environment/stop-sagemaker-environment');25const stopSageMakerEnvironmentYaml = require('../steps/stop-sagemaker-environment/stop-sagemaker-environment.yml');26const startEC2Environment = require('../steps/start-ec2-environment/start-ec2-environment');27const startEC2EnvironmentYaml = require('../steps/start-ec2-environment/start-ec2-environment.yml');28const stopEC2Environment = require('../steps/stop-ec2-environment/stop-ec2-environment');29const stopEC2EnvironmentYaml = require('../steps/stop-ec2-environment/stop-ec2-environment.yml');30const networkInfra = require('../steps/storage-gateway/create-network-infrastructure');31const networkInfraYaml = require('../steps/storage-gateway/create-network-infrastructure.yml');32const bulkReachability = require('../steps/bulk-reachability-check/bulk-reachability-check');33const bulkReachabilityYaml = require('../steps/bulk-reachability-check/bulk-reachability-check.yml');34const dsAccountStatusChange = require('../steps/ds-account-status-change/ds-account-status-change');35const dsAccountStatusChangeYaml = require('../steps/ds-account-status-change/ds-account-status-change.yml');36const add = (implClass, yaml) => ({ implClass, yaml });37// The order is important, add your steps here38const steps = [39 add(deleteEnvironment, deleteEnvironmentYaml),40 add(provisionAccount, provisionAccountYaml),41 add(provisionEnvironment, provisionEnvironmentYaml),42 add(startSageMakerEnvironment, startSageMakerEnvironmentYaml),43 add(stopSageMakerEnvironment, stopSageMakerEnvironmentYaml),44 add(startEC2Environment, startEC2EnvironmentYaml),45 add(stopEC2Environment, stopEC2EnvironmentYaml),46 add(networkInfra, networkInfraYaml),47 add(bulkReachability, bulkReachabilityYaml),48 add(dsAccountStatusChange, dsAccountStatusChangeYaml),49];50async function registerWorkflowSteps(registry) {51 // eslint-disable-next-line no-restricted-syntax52 for (const step of steps) {53 const { implClass, yaml } = step;54 await registry.add({ implClass, yaml }); // eslint-disable-line no-await-in-loop55 }56}...

Full Screen

Full Screen

environment.ts

Source:environment.ts Github

copy

Full Screen

1import {2 log,3 ScanStatus,4} from 'wechaty-puppet'5import { Mocker } from './mocker'6type EnvironmentStart = (mocker: Mocker) => EnvironmentStop7type EnvironmentStop = () => void8export type EnvironmentMock = EnvironmentStart9const SimpleEnvironment: () => EnvironmentMock = () => {10 log.verbose('SimpleEnvironment', '()')11 return function SimpleEnvironmentStart (mocker: Mocker): EnvironmentStop {12 log.verbose('SimpleEnvironment', 'SimpleEnvironmentStart(%s)', mocker)13 const taskList: (() => void)[] = []14 const loop = () => taskList.forEach(task => task())15 const timer = setInterval(loop, 5000)16 const SimpleEnvironmentStop = () => {17 log.verbose('SimpleEnvironment', 'SimpleEnvironmentStop()')18 clearInterval(timer)19 }20 mocker.scan('https://github.com/wechaty/wechaty-puppet-mock', ScanStatus.Waiting)21 const user = mocker.createContact()22 mocker.login(user)23 const contactList = mocker.createContacts(3)24 mocker.createRoom({25 memberIdList: [26 user.id,27 ...contactList.map(c => c.id),28 ],29 })30 taskList.push(() => {31 const contact = mocker.randomContact()32 if (contact) {33 contact.say().to()34 }35 })36 return SimpleEnvironmentStop37 }38}39export {40 SimpleEnvironment,...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { launch } = require('qawolf');2const selectors = require('./selectors/test.json');3describe('test', () => {4 let browser;5 let page;6 beforeAll(async () => {7 browser = await launch();8 });9 afterAll(async () => {10 await browser.close();11 });12 beforeEach(async () => {13 page = await browser.newPage();14 });15 afterEach(async () => {16 await page.close();17 });18 test('test', async () => {19 await page.type(selectors[0], 'test');20 await page.click(selectors[1]);21 await page.waitForSelector(selectors[2]);22 await page.click(selectors[2]);23 await page.waitForSelector(selectors[3]);24 await page.click(selectors[3]);25 await page.waitForSelector(selectors[4]);26 await page.click(selectors[4]);27 await page.waitForSelector(selectors[5]);28 await page.click(selectors[5]);29 await page.waitForSelector(selectors[6]);30 await page.click(selectors[6]);31 await page.waitForSelector(selectors[7]);32 await page.click(selectors[7]);33 await page.waitForSelector(selectors[8]);34 await page.click(selectors[8]);35 await page.waitForSelector(selectors[9]);36 await page.click(selectors[9]);37 await page.waitForSelector(selectors[10]);38 await page.click(selectors[10]);39 await page.waitForSelector(selectors[11]);40 await page.click(selectors[11]);41 await page.waitForSelector(selectors[12]);42 await page.click(selectors[12]);43 await page.waitForSelector(selectors[13]);44 await page.click(selectors[13]);45 await page.waitForSelector(selectors[14]);46 await page.click(selectors[14]);47 await page.waitForSelector(selectors[15]);48 await page.click(selectors[15]);49 await page.waitForSelector(selectors[16]);50 await page.click(selectors[16]);51 await page.waitForSelector(selectors[17]);52 await page.click(selectors[17]);53 await page.waitForSelector(selectors[18]);54 await page.click(selectors[18]);55 await page.waitForSelector(selectors[19]);56 await page.click(selectors[19]);57 await page.waitForSelector(selectors[20]);58 await page.click(selectors[20]);

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require("qawolf");2const browser = await qawolf.launch();3const context = await browser.newContext();4await qawolf.register(context);5const page = await context.newPage();6await page.type("input[name='q']", "test");7await page.press("input[name='q']", "Enter");

Full Screen

Using AI Code Generation

copy

Full Screen

1const { environment } = require('qawolf');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await environment.stop();8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { environment } = require("qawolf");2const { chromium } = require("playwright");3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.click("text=Example Domain");

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require("qawolf");2const browser = await qawolf.launch();3const context = await browser.newContext();4const page = await context.newPage();5await qawolf.stop(browser);6const playwright = require("playwright");7const browser = await playwright.chromium.launch();8const context = await browser.newContext();9const page = await context.newPage();10await playwright.stop(browser);11const qawolf = require("qawolf");12const browser = await qawolf.launch();13const context = await browser.newContext();14const page = await context.newPage();15await qawolf.stop(browser);16const playwright = require("playwright");17const browser = await playwright.chromium.launch();18const context = await browser.newContext();19const page = await context.newPage();20await playwright.stop(browser);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { launch } = require('qawolf');2const { test, expect } = require('@playwright/test');3test('test', async ({ page }) => {4 const browser = await launch();5 const context = await browser.newContext();6 const page = await context.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { environment } = require('qawolf');2const { test } = require('qawolf');3test('test', async ({ page }) => {4 await page.type('input[name="q"]', 'qawolf');5 await page.click('input[value="Google Search"]');6 await page.waitForSelector('a[href="/docs/introduction"]');7 await page.click('a[href="/docs/introduction"]');8 await page.waitForSelector('a[href="/docs/quick_start"]');9 await page.click('a[href="/docs/quick_start"]');10 await page.waitForSelector('a[href="/docs/api"]');11 await page.click('a[href="/docs/api"]');12 await page.waitForSelector('a[href="/docs/guides"]');13 await page.click('a[href="/docs/guides"]');14 await page.waitForSelector('a[href="/docs/guides/automate"]');15 await page.click('a[href="/docs/guides/automate"]');16 await page.waitForSelector('a[href="/docs/guides/automate#setup"]');17 await page.click('a[href="/docs/guides/automate#setup"]');18 await page.waitForSelector('a[href="/docs/guides/automate#record"]');19 await page.click('a[href="/docs/guides/automate#record"]');20 await page.waitForSelector('a[href="/docs/guides/automate#edit"]');21 await page.click('a[href="/docs/guides/automate#edit"]');22 await page.waitForSelector('a[href="/docs/guides/automate#run"]');23 await page.click('a[href="/docs/guides/automate#run"]');24 await page.waitForSelector('a[href="/docs/guides/automate#test"]');25 await page.click('a[href="/docs/guides/automate#test"]');26 await page.waitForSelector('a[href="/docs/guides/automate#publish"]');27 await page.click('a[href="/docs/guides/automate#publish"]');28 await page.waitForSelector('

Full Screen

Using AI Code Generation

copy

Full Screen

1const { launch } = require('qawolf');2const selectors = require('./selectors/test');3const assert = require('assert');4const { stop } = require('qawolf');5const { environment } = require('qawolf');6(async () => {7 const browser = await launch();8 const context = await browser.newContext();9 const page = await context.newPage();10 await page.click(selectors['Login']);11 await page.fill(selectors['Login'], 'test');12 await page.press(selectors['Login'], 'Enter');13 await page.click(selectors['Password']);14 await page.fill(selectors['Password'], 'test');15 await page.press(selectors['Password'], 'Enter');

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run qawolf automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful