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.
# Simple alertWhen I accept the alert # Alert with a messageWhen I accept the alert "Do you want to continue?" # Confirmation dialogWhen I accept the confirmation # Confirmation dialog with a messageWhen I accept the confirmation "Do you want to continue?" # Popup dialogWhen I accept the popup # Popup dialog with a messageWhen I accept the popup "Are you sure?" # Prompt dialogWhen I accept the prompt # Prompt dialog with a messageWhen I accept the prompt "What's your name?"
amOn
Indicates a webpage or screen in which it is expected to be at.
# URLGiven that I am on "http://concordialang.org" # ContantGiven that I am on [Some Page]
append
Adds a value to an element.
# Append a value to a UI ElementWhen I append "Foo" to {Foo}When I append 100 to {Bar}When I append [My Contant] to {Zoo} # Append a value to a UI literalWhen I append "Bar" to <#foo>When I append 200 to <#foo>When I append [My Contant] to <#zoo>
attachFile
Attaches a file. It selects a file and confirms its choice (e.g., clicks Open).
When I attach the file "/path/to/file" to {Foo}When I attach the file [My File] to {Foo}When I attach the file "/path/to/file" to <#bar>When I attach the file [My File] to <#bar>
cancel
Cancels a browser message or app message.
When I cancel the alertWhen I cancel the confirmationWhen I cancel the popupWhen I cancel the prompt
check
Checks a checkbox.
When I check {Foo}When I check <#bar>
clear
Empties an input field or browser cookie
When I clear {Foo}When I clear <#bar>When I clear the cookie "app"When I clear the cookie [App Cookie]
click
Clicks on something in the screen.
When I click on {Foo}When I click on <#bar>When I click on "Some Text"When I click on [Value From Contant]
close
Closes a tab, a set of tabs, or an app (mobile only).
When I close the current tabWhen I close the other tabs # Mobile onlyWhen I close the app
When I double click {Foo}When I double click <#bar>When I double click "Some Text"When I double click [My Contant]
drag
Drags and drops something to a widget.
When I drag {Foo} to {Bar}When I drag <#foo> to <#bar>
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
When I fill {Foo}When I inform {Foo}When I enter {Foo}When I type {Foo}When I fill {Foo} with "foo"When I fill {Foo} with [My Contant]When I fill <#bar> with "bar"When I fill <#bar> with 3.1415When I type "bar" in {Foo}When I type "foo" in <#bar>When I type 3.1416 in {Zoo}When I type [My Contant] in <#zoo>
hide
Hides something.
# Hides the device's keyboard - Mobile onlyWhen I hide the keyboard
install
Installs an app.
When I install the app "com.example.android.myapp"
maximize
Maximizes a window or the browser.
When I maximize the window
move
Moves the mouse cursor to a place or element.
When I move the cursor to {Foo}When I move the cursor to <#bar>When I move the cursor to {Foo} at 100, 200
open
Opens something
# Opens the device's notifications panel - Mobile onlyWhen I open the notifications panel
press
Presses a key or key combination, separated by comma.
When I press "Enter"When I press "Control", "Alt", "Delete"When I press "Control", "S"
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.
# Mobile onlyWhen I pull "/storage/emulated/0/DCIM/logo.png" to "some/path"
refresh
Refreshes/reloads the current page.
When I refresh the pageWhen I refresh the current pageWhen I reload the pageWhen I reload the current page
remove
Removes/uninstall an app by its internal name (mobile only).
# Mobile onlyWhen I remove the app "com.example.android.myapp"
resize
Resizes a window.
When I resize the window to 600, 400
rightClick
Performs a right click on something.
When I right click {Foo}When I right click <#bar>When I right click "Some Text"When I right click [Contant]
run
Runs a console command or a database script (SQL command).
👉 Commands and SQL scripts must be declared between single quotes ('), in a single line.
👉 SQL scripts must reference their database.
# Run a command in the console/terminalWhen I run the command 'rmdir foo'When I run the command './script.sh'When I run the command [My Command] # Run a SQL scripts in a databaseWhen I run the script 'INSERT INTO [MyDB].product ( name, price ) VALUES ( "Soda", 1.50 )'When I run the script 'INSERT INTO [MyDB].Users( UserName, UserSex, UserAge ) VALUES ( "Newton", "Male", 25 )'When I run the script 'INSERT INTO [MyDB].`my long table name`( `long column`, `another long column`) VALUES ("Foo", 10)'When I run the script 'UPDATE [MyDB].Users SET UserAge=26, UserStatus="online" WHERE UserName="Newton"'When I run the script 'UPDATE [MyDB].`my long table name` SET `long column` = "Bar" WHERE `another long column` = 70'When I run the script 'DELETE FROM [MyDB].Users WHERE UserName="Newton"'When I run the script 'DELETE FROM [MyDB].`my long table name` WHERE `another long column` = 70'
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:
When I run the script 'INSERT INTO [MyDB] VALUES { "name": "Mary", "surname": "Jane", "age": 21 }'
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:
When I run the script 'UPDATE [MyDB] SET age = 22 WHERE name = "Mary"'
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.
When I save a screenshot to "foo.png"When I take a photo to "bar.png"
scrollTo
Scrolls to a certain element.
When I scroll to <#foo>When I scroll to {Bar}
see
Indicates that something can be seen. You can also negate the sentence to indicate something cannot be seen.
# Some textThen I see "Some Text"Then I see 3.1416Then I see [Some Contant]Then I do not see "Some Text"Then I don't see [Some Contant]Then see the text "Some Text"Then I don't see the text "Some Text"# UI Element or a UI literalThen I see {Foo}Then I don't see <#bar> # Value is/isn't inside a UI Element or a UI literalThen I see "hello" in {foo}Then I see "world" in <#bar>Then I don't see "hello" in {foo}Then I don't see "world" in <#bar> Then I do not see {Foo} with "hello"Then I don't see <bar> with "world"# Attribute from a UI Element or UI literal Then I see {Foo} with the attribute "maxlength" valued "200"Then I see the attribute "type" of <#bar> to be "text"# CSS class or Style - WEB ONLYThen I see {Foo} with the class "primary-button"Then I see {Foo} with the style "color: blue"# UI Element or ui literal is/isn't enabledThen I see {Foo} is enabledThen I see <#bar> is enabledThen I do not see {Foo} is enabledThen don't see <#bar> is enabled# UI Element or ui literal is/isn't checkedThen I see {Foo} is checkedThen I see <#bar> is checkedThen I do not see {Foo} is checkedThen don't see <#bar> is checked# TitleThen I see "Some Text" in the titleThen I don't see [My Constant] in the titleThen I see the title with "foo"Then I don't see the title with [My Constant]# URL Then I see the url "/foo"Then I don't see the url "/bar"# CookieThen I see the cookie "foo"Then I don't see the cookie [My Cookie]# App is installed/not installed - MOBILE ONLYThen I see that the app "com.example.android.myapp" is installedThen I see that the app "com.example.android.myapp" is not installed# An activity - MOBILE ONLYThen I see that the current activity is ".HomeScreenActivity" # Device locked/unlocked - MOBILE ONLYThen I see that the device is lockedThen I see that the device is locked # Device orientation - MOBILE ONLYThen I see that the orientation is landscapeThen I see that the orientation is portrait
select
Selects a value for an element.
When I select "foo" in {Foo}When I select [Contant] in <#bar>
shake
Shakes the device - MOBILE ONLY.
When I shake the deviceWhen I shake the phoneWhen I shake the tablet
swipe
Performs a swipe action - MOBILE ONLY
# To a certain positionWhen I swipe <#io.selendroid.myapp:id/LinearLayout1> to 100, 200 # An UI Element/literal to anotherWhen I swipe {Foo} to {Bar}When I swipe <#foo> to <#bar> # DownWhen I swipe <#io.selendroid.myapp:id/LinearLayout1> down # UpWhen I swipe <#io.selendroid.myapp:id/LinearLayout1> up # LeftWhen I swipe <#io.selendroid.myapp:id/LinearLayout1> left # RightWhen I swipe <#io.selendroid.myapp:id/LinearLayout1> right
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.
# IFRAME# To the first iframeWhen I switch to the iframe# To a certain iframeWhen I switch to the iframe {My Frame}When I switch to the iframe <#frame1># To an iframe inside another iframeWhen I switch to the iframe {SubFrame 1} inside {Frame 1}When I switch to the iframe <#subframe1> inside <#frame1># Back to the application pageWhen I switch to the applicationWhen I switch to the page # TABWhen I switch to the next tabWhen I switch to the previous tabWhen I switch to the tab 3 # MOBILE-WEB SWITCHING # To native appWhen I switch to native # To web appWhen I switch to web
tap
Performs a tap on an element - MOBILE ONLY
When I tap {Confirm}When I tap <~confirm>
uncheck
Unchecks a checkbox.
When I unckeck {Foo}When I uncheck <#bar> # Unchecks an element inside another elementWhen I uncheck {Foo} in <#bar>
wait
Wait for something.
# -------# ELEMENT# -------# An elementWhen I wait for {Foo}When I wait for <#bar># An element to hideWhen I wait {Foo} to hideWhen I wait <#bar> to hide# An element to be enabledWhen I wait {Foo} to be enabledWhen I wait <#bar> to be enabled# An element to be visibleWhen I wait {Foo} to be visibleWhen I wait <#bar> to be visible# An element to be invisible (same as to hide)When I wait {Foo} to be invisibleWhen I wait <#bar> to be invisible# Value inside elementWhen I wait for the value "foo" in {Foo}When I wait for the value [My Constant] in <#bar># ----# TEXT# ----When I wait for the text "Foo"# ----# URL# ---- When I wait for the url "/foo"# -------# SECONDS# -------# SecondsWhen I wait 1 secondWhen I wait 2 seconds# Seconds for an elementWhen I wait 1 second for {Foo}When I wait 5 seconds for <#bar># Seconds for an element to hideWhen I wait 1 second for {Foo} to hideWhen I wait 5 seconds for <#bar> to hide# Seconds for an element to be enabledWhen I wait 1 second for {Foo} to be enabledWhen I wait 5 seconds for <#bar> to be enabled# Seconds for an element to be visibleWhen I wait 1 second for {Foo} to be visibleWhen I wait 5 seconds for <#bar> to be visible# Seconds for an element to be invisible (same as to hide)When I wait 1 second for {Foo} to be invisibleWhen I wait 5 seconds for <#bar> to be invisible # Value inside elementWhen I wait 1 second for the value "foo" in {Foo}When I wait 5 seconds for the value [My Constant] in <#bar> # TextWhen I wait 3 seconds for the text "Foo"# URLWhen I wait 3 seconds for the url "/foo"