Links

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.
# Simple alert
When I accept the alert
# Alert with a message
When I accept the alert "Do you want to continue?"
# Confirmation dialog
When I accept the confirmation
# Confirmation dialog with a message
When I accept the confirmation "Do you want to continue?"
# Popup dialog
When I accept the popup
# Popup dialog with a message
When I accept the popup "Are you sure?"
# Prompt dialog
When I accept the prompt
# Prompt dialog with a message
When I accept the prompt "What's your name?"

amOn

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

append

Adds a value to an element.
# Append a value to a UI Element
When I append "Foo" to {Foo}
When I append 100 to {Bar}
When I append [My Contant] to {Zoo}
# Append a value to a UI literal
When 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 alert
When I cancel the confirmation
When I cancel the popup
When 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 tab
When I close the other tabs
# Mobile only
When I close the app

connect

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

disconnect

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

doubleClick

Performs a double click on something.
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.1415
When 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 only
When 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 only
When 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 only
When I pull "/storage/emulated/0/DCIM/logo.png" to "some/path"

refresh

Refreshes/reloads the current page.
When I refresh the page
When I refresh the current page
When I reload the page
When I reload the current page

remove

Removes/uninstall an app by its internal name (mobile only).
# Mobile only
When 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).
👉 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.
# Run a command in the console/terminal
When 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 database
When 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 text
Then I see "Some Text"
Then I see 3.1416
Then 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 literal
Then I see {Foo}
Then I don't see <#bar>
# Value is/isn't inside a UI Element or a UI literal
Then 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 ONLY
Then 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 enabled
Then I see {Foo} is enabled
Then I see <#bar> is enabled
Then I do not see {Foo} is enabled
Then don't see <#bar> is enabled
# UI Element or ui literal is/isn't checked
Then I see {Foo} is checked
Then I see <#bar> is checked
Then I do not see {Foo} is checked
Then don't see <#bar> is checked
# Title
Then I see "Some Text" in the title
Then I don't see [My Constant] in the title
Then 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"
# Cookie
Then I see the cookie "foo"
Then I don't see the cookie [My Cookie]
# App is installed/not installed - MOBILE ONLY
Then I see that the app "com.example.android.myapp" is installed
Then I see that the app "com.example.android.myapp" is not installed
# An activity - MOBILE ONLY
Then I see that the current activity is ".HomeScreenActivity"
# Device locked/unlocked - MOBILE ONLY
Then I see that the device is locked
Then I see that the device is locked
# Device orientation - MOBILE ONLY
Then I see that the orientation is landscape
Then 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 device
When I shake the phone
When I shake the tablet

swipe

Performs a swipe action - MOBILE ONLY
# To a certain position
When I swipe <#io.selendroid.myapp:id/LinearLayout1> to 100, 200
# An UI Element/literal to another
When I swipe {Foo} to {Bar}
When I swipe <#foo> to <#bar>
# Down
When I swipe <#io.selendroid.myapp:id/LinearLayout1> down
# Up
When I swipe <#io.selendroid.myapp:id/LinearLayout1> up
# Left
When I swipe <#io.selendroid.myapp:id/LinearLayout1> left
# Right
When 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 iframe
When I switch to the iframe
# To a certain iframe
When I switch to the iframe {My Frame}
When I switch to the iframe <#frame1>
# To an iframe inside another iframe
When I switch to the iframe {SubFrame 1} inside {Frame 1}
When I switch to the iframe <#subframe1> inside <#frame1>
# Back to the application page
When I switch to the application
When I switch to the page
# TAB
When I switch to the next tab
When I switch to the previous tab
When I switch to the tab 3
# MOBILE-WEB SWITCHING
# To native app
When I switch to native
# To web app
When 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 element
When I uncheck {Foo} in <#bar>

wait

Wait for something.
# -------
# ELEMENT
# -------
# An element
When I wait for {Foo}
When I wait for <#bar>
# An element to hide
When I wait {Foo} to hide
When I wait <#bar> to hide
# An element to be enabled
When I wait {Foo} to be enabled
When I wait <#bar> to be enabled
# An element to be visible
When I wait {Foo} to be visible
When I wait <#bar> to be visible
# An element to be invisible (same as to hide)
When I wait {Foo} to be invisible
When I wait <#bar> to be invisible
# Value inside element
When 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
# -------
# Seconds
When I wait 1 second
When I wait 2 seconds
# Seconds for an element
When I wait 1 second for {Foo}
When I wait 5 seconds for <#bar>
# Seconds for an element to hide
When I wait 1 second for {Foo} to hide
When I wait 5 seconds for <#bar> to hide
# Seconds for an element to be enabled
When I wait 1 second for {Foo} to be enabled
When I wait 5 seconds for <#bar> to be enabled
# Seconds for an element to be visible
When I wait 1 second for {Foo} to be visible
When 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 invisible
When I wait 5 seconds for <#bar> to be invisible
# Value inside element
When I wait 1 second for the value "foo" in {Foo}
When I wait 5 seconds for the value [My Constant] in <#bar>
# Text
When I wait 3 seconds for the text "Foo"
# URL
When I wait 3 seconds for the url "/foo"