Skip to content

Commit 14a1a36

Browse files
sapzapeDave Haeffner
authored andcommitted
Added set default value when select 'wait for...' command (#678)
* Added set default value when select 'wait for...' command * Added conditional statement to check empty string * Added set value test about 'wait for' command * Added set value validation test
1 parent eeecd6d commit 14a1a36

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

packages/selenium-ide/src/neo/__test__/models/Command.spec.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,20 @@ describe('Command', () => {
206206
expect(command.windowTimeout).toBe(jsRepresentation.windowTimeout)
207207
expect(command instanceof Command).toBeTruthy()
208208
})
209+
210+
it('should not overridden value when replace command', () => {
211+
const command = new Command()
212+
command.setCommand('assert text')
213+
command.setValue('Hello World')
214+
command.setCommand('wait for element present')
215+
expect(command.value).toBe('Hello World')
216+
})
217+
218+
it("should not set value for commands that do not start with 'wait for'", () => {
219+
const command = new Command()
220+
command.setCommand('click')
221+
expect(command.value).toBe('')
222+
})
209223
})
210224

211225
describe('Commands enum', () => {

packages/selenium-ide/src/neo/models/Command/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ export default class Command {
106106
if (!this.canHaveTargets) {
107107
this.setTargets()
108108
}
109+
110+
if (this.command.indexOf('waitFor') > -1 && this.value === '') {
111+
this.setValue('30000')
112+
}
109113
}
110114

111115
@action.bound

0 commit comments

Comments
 (0)