Actions
Abstract actions recognized through Natural Language Processing
Concordia Language contains a set of meta-actions that can be used by different testing frameworks for generating test scripts. Concordia Compiler uses Intent Recognition (yes, like chatbots do) to understand sentences and extract the desired action to perform. Later these actions are sent to testing frameworks for conversion into commands.
Concordia actions are recognized in Variants, Test Cases, and Test Events.
The following list presents the available actions and gives some examples on how to use them in sentences. We expect that you do not have to memorize them but, instead, see the things you can do. Try to write the sentences the way you speak, using first person singular (I) . When there is a UI Element in the sentence, embrace it with { and }, like {this}. The compiler will tell you whether it cannot understand some sentence you wrote. If you think it should have understood something, please tell us. We'll try to augment the compiler's vocabulary to understand it the next time.

accept

Accepts a browser message or app message.
1
# Simple alert
2
When I accept the alert
3
4
# Alert with a message
5
When I accept the alert "Do you want to continue?"
6
7
# Confirmation dialog
8
When I accept the confirmation
9
10
# Confirmation dialog with a message
11
When I accept the confirmation "Do you want to continue?"
12
13
# Popup dialog
14
When I accept the popup
15
16
# Popup dialog with a message
17
When I accept the popup "Are you sure?"
18
19
# Prompt dialog
20
When I accept the prompt
21
22
# Prompt dialog with a message
23
When I accept the prompt "What's your name?"
Copied!

amOn

Indicates a webpage or screen in which it is expected to be at.
1
# URL
2
Given that I am on "http://concordialang.org"
3
4
# Contant
5
Given that I am on [Some Page]
Copied!

append

Adds a value to an element.
1
# Append a value to a UI Element
2
When I append "Foo" to {Foo}
3
When I append 100 to {Bar}
4
When I append [My Contant] to {Zoo}
5
6
# Append a value to a UI literal
7
When I append "Bar" to <#foo>
8
When I append 200 to <#foo>
9
When I append [My Contant] to <#zoo>
Copied!

attachFile

Attaches a file. It selects a file and confirms its choice (e.g., clicks Open).
1
When I attach the file "/path/to/file" to {Foo}
2
When I attach the file [My File] to {Foo}
3
4
When I attach the file "/path/to/file" to <#bar>
5
When I attach the file [My File] to <#bar>
Copied!

cancel

Cancels a browser message or app message.
1
When I cancel the alert
2
3
When I cancel the confirmation
4
5
When I cancel the popup
6
7
When I cancel the prompt
Copied!

check

Checks a checkbox.
1
When I check {Foo}
2
3
When I check <#bar>
Copied!

clear

Empties an input field or browser cookie
1
When I clear {Foo}
2
3
When I clear <#bar>
4
5
When I clear the cookie "app"
6
7
When I clear the cookie [App Cookie]
Copied!

click

Clicks on something in the screen.
1
When I click on {Foo}
2
3
When I click on <#bar>
4
5
When I click on "Some Text"
6
7
When I click on [Value From Contant]
Copied!

close

Closes a tab, a set of tabs, or an app (mobile only).
1
When I close the current tab
2
3
When I close the other tabs
4
5
# Mobile only
6
When I close the app
Copied!

connect

Connects to a database.
The next sentence is for Test Events only:
1
When I connect to the database [TestDB]
Copied!

disconnect

Disconnects from a database.
The next sentence is for Test Events only:
1
When I disconnect from the database [TestDB]
Copied!

doubleClick

Performs a double click on something.
1
When I double click {Foo}
2
3
When I double click <#bar>
4
5
When I double click "Some Text"
6
7
When I double click [My Contant]
Copied!

drag

Drags and drops something to a widget.
1
When I drag {Foo} to {Bar}
2
3
When I drag <#foo> to <#bar>
Copied!

fill

Indicates that a field is being filled. If desired, a value can be given. Otherwise, a value will be generated for the corresponding Test Case.

fill + target

1
When I fill {Foo}
2
When I inform {Foo}
3
When I enter {Foo}
4
When I type {Foo}
5
6
7
When I fill {Foo} with "foo"
8
When I fill {Foo} with [My Contant]
9
When I fill <#bar> with "bar"
10
When I fill <#bar> with 3.1415
11
12
13
When I type "bar" in {Foo}
14
When I type "foo" in <#bar>
15
When I type 3.1416 in {Zoo}
16
When I type [My Contant] in <#zoo>
Copied!

hide

Hides something.
1
# Hides the device's keyboard - Mobile only
2
When I hide the keyboard
Copied!

install

Installs an app.
1
When I install the app "com.example.android.myapp"
Copied!

maximize

Maximizes a window or the browser.
1
When I maximize the window
Copied!

move

Moves the mouse cursor to a place or element.
1
When I move the cursor to {Foo}
2
When I move the cursor to <#bar>
3
4
When I move the cursor to {Foo} at 100, 200
Copied!

open

Opens something
1
# Opens the device's notifications panel - Mobile only
2
When I open the notifications panel
Copied!

press

Presses a key or key combination, separated by comma.
1
When I press "Enter"
2
When I press "Control", "Alt", "Delete"
3
When I press "Control", "S"
Copied!
Some special keys (case sensitive!):
  • Add
  • Alt
  • ArrowDown or Down arrow
  • ArrowLeft or Left arrow
  • ArrowRight or Right arrow
  • ArrowUp or Up arrow
  • Backspace
  • Command
  • Control
  • Del
  • Divide
  • End
  • Enter
  • Equals
  • Escape
  • F1 to F12
  • Home
  • Insert
  • Meta
  • Multiply
  • Numpad 0 to Numpad 9
  • Pause
  • Pagedown or PageDown
  • Pageup or PageUp
  • Semicolon
  • Shift
  • Space
  • Subtract
  • Tab

pull

Extracts a device's resource from a path.
1
# Mobile only
2
When I pull "/storage/emulated/0/DCIM/logo.png" to "some/path"
Copied!

refresh

Refreshes/reloads the current page.
1
When I refresh the page
2
When I refresh the current page
3
4
When I reload the page
5
When I reload the current page
Copied!

remove

Removes/uninstall an app by its internal name (mobile only).
1
# Mobile only
2
When I remove the app "com.example.android.myapp"
Copied!

resize

Resizes a window.
1
When I resize the window to 600, 400
Copied!

rightClick

Performs a right click on something.
1
When I right click {Foo}
2
When I right click <#bar>
3
When I right click "Some Text"
4
When I right click [Contant]
Copied!

run

Runs a console command or a database script (SQL command).
👉 Available for Test Events only.
👉 Commands and SQL scripts must be declared between single quotes ('), in a single line.
👉 SQL scripts must reference their database.
1
# Run a command in the console/terminal
2
3
When I run the command 'rmdir foo'
4
When I run the command './script.sh'
5
When I run the command [My Command]
6
7
# Run a SQL scripts in a database
8
9
When I run the script 'INSERT INTO [MyDB].product ( name, price ) VALUES ( "Soda", 1.50 )'
10
When I run the script 'INSERT INTO [MyDB].Users( UserName, UserSex, UserAge ) VALUES ( "Newton", "Male", 25 )'
11
When I run the script 'INSERT INTO [MyDB].`my long table name`( `long column`, `another long column`) VALUES ("Foo", 10)'
12
13
When I run the script 'UPDATE [MyDB].Users SET UserAge=26, UserStatus="online" WHERE UserName="Newton"'
14
When I run the script 'UPDATE [MyDB].`my long table name` SET `long column` = "Bar" WHERE `another long column` = 70'
15
16
When I run the script 'DELETE FROM [MyDB].Users WHERE UserName="Newton"'
17
When I run the script 'DELETE FROM [MyDB].`my long table name` WHERE `another long column` = 70'
Copied!

SQL Syntax

Concordia Compiler uses database-js to access databases and files through SQL-like commands. The supported SQL syntax may vary from one database to another. Please see the documentation of the corresponding driver.
JSON and CSV as databases: INSERT accepts JSON objects or arrays as values. Example:
1
When I run the script 'INSERT INTO [MyDB] VALUES { "name": "Mary", "surname": "Jane", "age": 21 }'
Copied!
Excel and Firebase databases: Syntax similar to JSON and CSV databases. However, it has some limitations, as pointed out in its documentation :
SQL commands are limited to SELECT, UPDATE, INSERT and DELETE. WHERE works well. JOINs are not allowed. GROUP BY is not supported. LIMIT and OFFSET are combined into a single LIMIT syntax: LIMIT [offset,]number
INI databases: INSERT and DELETE are not supported yet by database-js-ini. UPDATE example:
1
When I run the script 'UPDATE [MyDB] SET age = 22 WHERE name = "Mary"'
Copied!
SQLite databases: Currently database-js-sqlite uses sql.js that doesn't persist the changes in the file (only in memory).

saveScreenshot

Takes a screenshot an saves into a file.
1
When I save a screenshot to "foo.png"
2
3
When I take a photo to "bar.png"
Copied!

scrollTo

Scrolls to a certain element.
1
When I scroll to <#foo>
2
When I scroll to {Bar}
Copied!

see

Indicates that something can be seen. You can also negate the sentence to indicate something cannot be seen.
1
# Some text
2
3
Then I see "Some Text"
4
Then I see 3.1416
5
Then I see [Some Contant]
6
7
Then I do not see "Some Text"
8
Then I don't see [Some Contant]
9
10
Then see the text "Some Text"
11
Then I don't see the text "Some Text"
12
13
14
# UI Element or a UI literal
15
16
Then I see {Foo}
17
Then I don't see <#bar>
18
19
20
# Value is/isn't inside a UI Element or a UI literal
21
22
Then I see "hello" in {foo}
23
Then I see "world" in <#bar>
24
25
Then I don't see "hello" in {foo}
26
Then I don't see "world" in <#bar>
27
28
Then I do not see {Foo} with "hello"
29
Then I don't see <bar> with "world"
30
31
32
# Attribute from a UI Element or UI literal
33
34
Then I see {Foo} with the attribute "maxlength" valued "200"
35
36
Then I see the attribute "type" of <#bar> to be "text"
37
38
39
# CSS class or Style - WEB ONLY
40
41
Then I see {Foo} with the class "primary-button"
42
43
Then I see {Foo} with the style "color: blue"
44
45
46
# UI Element or ui literal is/isn't enabled
47
48
Then I see {Foo} is enabled
49
Then I see <#bar> is enabled
50
51
Then I do not see {Foo} is enabled
52
Then don't see <#bar> is enabled
53
54
55
# UI Element or ui literal is/isn't checked
56
57
Then I see {Foo} is checked
58
Then I see <#bar> is checked
59
60
Then I do not see {Foo} is checked
61
Then don't see <#bar> is checked
62
63
64
# Title
65
66
Then I see "Some Text" in the title
67
Then I don't see [My Constant] in the title
68
69
Then I see the title with "foo"
70
Then I don't see the title with [My Constant]
71
72
73
# URL
74
75
Then I see the url "/foo"
76
Then I don't see the url "/bar"
77
78
79
# Cookie
80
81
Then I see the cookie "foo"
82
Then I don't see the cookie [My Cookie]
83
84
85
# App is installed/not installed - MOBILE ONLY
86
87
Then I see that the app "com.example.android.myapp" is installed
88
89
Then I see that the app "com.example.android.myapp" is not installed
90
91
92
# An activity - MOBILE ONLY
93
94
Then I see that the current activity is ".HomeScreenActivity"
95
96
# Device locked/unlocked - MOBILE ONLY
97
98
Then I see that the device is locked
99
100
Then I see that the device is locked
101
102
# Device orientation - MOBILE ONLY
103
104
Then I see that the orientation is landscape
105
Then I see that the orientation is portrait
106
Copied!

select

Selects a value for an element.
1
When I select "foo" in {Foo}
2
When I select [Contant] in <#bar>
Copied!

shake

Shakes the device - MOBILE ONLY.
1
When I shake the device
2
When I shake the phone
3
When I shake the tablet
Copied!

swipe

Performs a swipe action - MOBILE ONLY
1
# To a certain position
2
When I swipe <#io.selendroid.myapp:id/LinearLayout1> to 100, 200
3
4
# An UI Element/literal to another
5
When I swipe {Foo} to {Bar}
6
When I swipe <#foo> to <#bar>
7
8
# Down
9
When I swipe <#io.selendroid.myapp:id/LinearLayout1> down
10
11
# Up
12
When I swipe <#io.selendroid.myapp:id/LinearLayout1> up
13
14
# Left
15
When I swipe <#io.selendroid.myapp:id/LinearLayout1> left
16
17
# Right
18
When I swipe <#io.selendroid.myapp:id/LinearLayout1> right
19
Copied!

switch

  • Switches to a certain iframe and back to the application page; OR
  • Switches to a certain tab; OR
  • Switches an app to native mode or web mode - MOBILE ONLY.
NOTE: When switching to an iframe, all the commands that follow it will be applied to it.
1
# IFRAME
2
3
# To the first iframe
4
5
When I switch to the iframe
6
7
# To a certain iframe
8
9
When I switch to the iframe {My Frame}
10
When I switch to the iframe <#frame1>
11
12
# To an iframe inside another iframe
13
14
When I switch to the iframe {SubFrame 1} inside {Frame 1}
15
When I switch to the iframe <#subframe1> inside <#frame1>
16
17
# Back to the application page
18
19
When I switch to the application
20
When I switch to the page
21
22
# TAB
23
24
When I switch to the next tab
25
When I switch to the previous tab
26
When I switch to the tab 3
27
28
29
# MOBILE-WEB SWITCHING
30
31
# To native app
32
When I switch to native
33
# To web app
34
When I switch to web
35
Copied!

tap

Performs a tap on an element - MOBILE ONLY
1
When I tap {Confirm}
2
When I tap <~confirm>
3
Copied!

uncheck

Unchecks a checkbox.
1
When I unckeck {Foo}
2
When I uncheck <#bar>
3
4
# Unchecks an element inside another element
5
6
When I uncheck {Foo} in <#bar>
Copied!

wait

Wait for something.
1
# -------
2
# ELEMENT
3
# -------
4
5
# An element
6
7
When I wait for {Foo}
8
When I wait for <#bar>
9
10
# An element to hide
11
12
When I wait {Foo} to hide
13
When I wait <#bar> to hide
14
15
# An element to be enabled
16
17
When I wait {Foo} to be enabled
18
When I wait <#bar> to be enabled
19
20
# An element to be visible
21
22
When I wait {Foo} to be visible
23
When I wait <#bar> to be visible
24
25
# An element to be invisible (same as to hide)
26
27
When I wait {Foo} to be invisible
28
When I wait <#bar> to be invisible
29
30
# Value inside element
31
32
When I wait for the value "foo" in {Foo}
33
When I wait for the value [My Constant] in <#bar>
34
35
36
# ----
37
# TEXT
38
# ----
39
40
When I wait for the text "Foo"
41
42
43
# ----
44
# URL
45
# ----
46
47
When I wait for the url "/foo"
48
49
50
# -------
51
# SECONDS
52
# -------
53
54
# Seconds
55
56
When I wait 1 second
57
When I wait 2 seconds
58
59
# Seconds for an element
60
61
When I wait 1 second for {Foo}
62
When I wait 5 seconds for <#bar>
63
64
# Seconds for an element to hide
65
66
When I wait 1 second for {Foo} to hide
67
When I wait 5 seconds for <#bar> to hide
68
69
# Seconds for an element to be enabled
70
71
When I wait 1 second for {Foo} to be enabled
72
When I wait 5 seconds for <#bar> to be enabled
73
74
# Seconds for an element to be visible
75
76
When I wait 1 second for {Foo} to be visible
77
When I wait 5 seconds for <#bar> to be visible
78
79
# Seconds for an element to be invisible (same as to hide)
80
81
When I wait 1 second for {Foo} to be invisible
82
When I wait 5 seconds for <#bar> to be invisible
83
84
# Value inside element
85
86
When I wait 1 second for the value "foo" in {Foo}
87
When I wait 5 seconds for the value [My Constant] in <#bar>
88
89
# Text
90
91
When I wait 3 seconds for the text "Foo"
92
93
# URL
94
95
When I wait 3 seconds for the url "/foo"
96
Copied!