Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions atest/test/02_Content_Keywords/basic_getters.robot
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ Get Attribute Names And Assert Single And Multiple

Get Classes
[Setup] Ensure Location ${LOGIN_URL}
${classes} = Get Classes id=draggable
Should Be Equal ${classes} ${{["box", "react-draggable"]}}
${classes} = Get Classes id=ManyClass
Should Be Equal ${classes} ${{["pure-button", "another", "something", "kala"]}}

Get Classes With Strict
[Tags] slow
Expand All @@ -136,13 +136,12 @@ Get Classes With Strict

Get Classes And Assert
[Setup] Ensure Location ${LOGIN_URL}
Get Classes id=draggable contains react-draggable
Get Classes id=draggable == react-draggable box
Get Classes id=draggable validate "react-draggable-dragged" not in value
Drag And Drop Relative To id=draggable 10 10 steps=2
Get Classes id=draggable *= react-draggable box
Get Classes id=draggable == react-draggable box react-draggable-dragged
Get Classes id=draggable validate "react-draggable-dragged" in value
Get Classes id=ManyClass contains another
Get Classes id=ManyClass == pure-button another something kala
Get Classes id=ManyClass validate "tidii" not in value
Get Classes id=ManyClass *= pure-button another
Get Classes id=ManyClass == pure-button another something kala
Get Classes id=ManyClass validate "another" in value

Get Element Count
[Setup] Ensure Location ${LOGIN_URL}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,16 @@ Get Attribute Names Custom Error

Get Classes Default Error
Run Keyword And Expect Error
... EQUALS: Classes of ${SELECTOR_PREFIX_SPACED}id=draggable '['box', 'react-draggable']' (list) should contain '['not-here']' (list)
... EQUALS: Classes of id=ManyClass '['pure-button', 'another', 'something', 'kala']' (list) should contain '['not-here']' (list)
... Get Classes
... id=draggable
... id=ManyClass
... contains
... not-here

Get Classes Custom Error
Run Keyword And Expect Error
... My Custom Error
... Get Classes id=draggable contains not-here message=My Custom Error
... Get Classes id=ManyClass contains not-here message=My Custom Error

Get Element Count Default Error
Run Keyword And Expect Error
Expand Down
16 changes: 8 additions & 8 deletions atest/test/02_Content_Keywords/solve_draggame.robot
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ Resource imports.resource

Test Setup New Page ${DRAGGAME_URL}

Force Tags no-iframe

*** Test Cases ***
Move Obstacle To Goal And Make A Goal
Get Text h2 == Put the circle in the goal
Drag And Drop css=.obstacle css=.goal
Drag And Drop css=.circle css=.goal
Get Text h2 == GOAL!!
Drag And Drop id=blue-box id=invisible-element steps=10
Drag And Drop id=red-circle id=goal-post steps=10
Get Text h2 == GOAL!!!

Move Obstacle Away And Drag And Drop
Hover "Obstacle"
Get Text h2 == Put the circle in the goal
Hover id=blue-box
Mouse Button down
Mouse Move Relative To "Obstacle" 500
Mouse Move Relative To id=blue-box 200
Mouse Button up
Drag And Drop "Circle" "Goal"
Drag And Drop id=red-circle id=goal-post steps=10
Get Text h2 == GOAL!!!

Test
[Tags] slow
Expand Down
90 changes: 55 additions & 35 deletions atest/test/02_Content_Keywords/virtual_mouse.robot
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,30 @@ Move In Circle
Mouse Move 0 0

Draggable Test
${x} = Get Boundingbox \#draggable x
${y} = Get Boundingbox \#draggable y
[Setup] New Page ${DRAGGAME_URL}
${x} = Get Boundingbox id=blue-box x
${y} = Get Boundingbox id=blue-box y
# evaluate end coordinates
${xnew} = Evaluate ${x}+400
${ynew} = Evaluate ${y}+400
${xnew} = Evaluate ${x}-200
${ynew} = Evaluate ${y}-200
Mouse Button down ${x} ${y}
Mouse Button up ${xnew} ${ynew}
# just do a random move to make sure the element is not stuck to mouse any more
Mouse Move 0 0
Get Text \#dragX == 400
Get Text \#dragY == 400
Get Text id=blue-box-x-value == 360
Get Text id=blue-box-y-value == 80

Drag And Drop
Drag And Drop id=draggable id=clickWithOptions
${obj_center} = Get Boundingbox id=draggable ALL evaluate ${Center_Func}
${dest_center} = Get Boundingbox id=clickWithOptions ALL evaluate ${Center_Func}
[Setup] New Page ${DRAGGAME_URL}
Drag And Drop id=blue-box id=invisible-element
Take Screenshot
${dest_center} = Get Boundingbox
... id=invisible-element
... ALL
... evaluate
... ${Center_Func}
... allow_hidden=True
Take Screenshot
Assert Position ${dest_center}[x] ${dest_center}[y] ${tol}

Drag And Drop With Strict
Expand All @@ -47,34 +55,37 @@ Drag And Drop With Strict
... Drag And Drop //input id=clickWithOptions
Run Keyword And Expect Error
... *strict mode violation*//input*resolved to ${INPUT_ELEMENT_COUNT_IN_LOGIN} elements*
... Drag And Drop id=draggable //input
... Drag And Drop id=clickWithOptions //input
Set Strict Mode False
Drag And Drop id=draggable //input
Drag And Drop id=clickWithOptions //input
Drag And Drop //input id=clickWithOptions
[Teardown] Set Strict Mode True

Drag And Drop With Coordinates
[Tags] slow
[Timeout] 60s
${obj_center} = Get Boundingbox id=draggable ALL evaluate ${Center_Func}
${obj_dim} = Get Boundingbox id=draggable ALL evaluate ${Dim_Func}
${dest_center} = Get Boundingbox id=clickWithOptions ALL evaluate ${Center_Func}
[Setup] New Page ${DRAGGAME_URL}
${obj_center} = Get Boundingbox id=blue-box ALL evaluate ${Center_Func}
${obj_dim} = Get Boundingbox id=blue-box ALL evaluate ${Dim_Func}
${dest_center} = Get Boundingbox id=goal-post ALL evaluate ${Center_Func}
# Tests with implicit argument drop=True
Drag And Drop By Coordinates
... from_x=${obj_center}[x] from_y=${obj_center}[y]
... to_x=${dest_center}[x] to_y=${dest_center}[y] steps=200
Assert Position ${dest_center}[x] ${dest_center}[y] ${tol}
Take Screenshot
Drag And Drop By Coordinates
... from_x=${dest_center}[x] from_y=${dest_center}[y]
... to_x=${obj_center}[x] to_y=${obj_center}[y] steps=200
Take Screenshot
Assert Position ${obj_center}[x] ${obj_center}[y] ${tol}
# Tests with explicit values True or False for argument drop
# "Start coordinates" of draggable object:
# "Start coordinates" of blue-box object:
${x1} = Set Variable ${obj_center}[x]
${y1} = Set Variable ${obj_center}[y]
${width} = Set Variable ${obj_dim}[width]
${height} = Set Variable ${obj_dim}[height]
Log Draggable object: ${obj_center}
Log blue-box object: ${obj_center}
# coordinates where to drag in relative values:
${x2} = Evaluate ${x1} + 0.1 * ${width}
${y2} = Evaluate ${y1} - 1.0 * ${height}
Expand All @@ -88,12 +99,19 @@ Drag And Drop With Coordinates
${time} = Set Variable 1

Hover And Drop To Hover
Hover id=draggable 10 10
[Setup] New Page ${DRAGGAME_URL}
${x} = Get Text id=blue-box-x-value
${y} = Get Text id=blue-box-y-value
Hover id=blue-box 10 10
Mouse Button down
Hover id=draggable 30 40
Hover id=blue-box 30 40
Mouse Button up
Get Text \#dragX == 20
Get Text \#dragY == 30
${x} = Evaluate ${x}+30
${y} = Evaluate ${y}+40
${x} = Convert To String ${x}
${y} = Convert To String ${y}
Get Text id=blue-box-x-value == ${x}
Get Text id=blue-box-y-value == ${y}

Hover With Strict
Set Strict Mode True
Expand All @@ -105,16 +123,18 @@ Hover With Strict
[Teardown] Set Strict Mode True

Drag And Drop With Move Relative
Relative DnD 32 64 32 64
Relative DnD 0 -64 32 0
Relative DnD -20 0 12 0
Relative DnD -22 -20 -10 -20
[Setup] New Page ${DRAGGAME_URL}
Relative DnD 32 64 672 424
Relative DnD 0 -64 752 440
Relative DnD -20 0 812 520
Relative DnD -22 -20 870 580

Drag And Drop Relative To
DnD Relative To 32 64 32 64
DnD Relative To 0 -64 32 0
DnD Relative To -20 0 12 0
DnD Relative To -22 -20 -10 -20
[Setup] New Page ${DRAGGAME_URL}
DnD Relative To 32 64 672 424
DnD Relative To 0 -64 752 440
DnD Relative To -20 0 812 520
DnD Relative To -22 -20 870 580

Click Count
${x} = Get Boundingbox \#clickWithOptions x
Expand Down Expand Up @@ -172,15 +192,15 @@ Scroll By Mouse Wheel
*** Keywords ***
Relative DnD
[Arguments] ${x} ${y} ${txt_x} ${txt_y}
Hover id=draggable
Hover id=blue-box
Mouse Button down
Mouse Move Relative To id=draggable ${x} ${y} steps=2
Mouse Move Relative To id=blue-box ${x} ${y} steps=2
Mouse Button up
Get Text \#dragX == ${txt_x}
Get Text \#dragY == ${txt_y}
Get Text id=blue-box-x-value == ${txt_x}
Get Text id=blue-box-y-value == ${txt_y}

DnD Relative To
[Arguments] ${x} ${y} ${txt_x} ${txt_y}
Drag And Drop Relative To id=draggable ${x} ${y} steps=2
Get Text id=dragX == ${txt_x}
Get Text id=dragY == ${txt_y}
Drag And Drop Relative To id=blue-box ${x} ${y} steps=2
Get Text id=blue-box-x-value == ${txt_x}
Get Text id=blue-box-y-value == ${txt_y}
8 changes: 4 additions & 4 deletions atest/test/keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ Assert Position
... {'x': (value["x"] + (value["width"] / 2)), 'y': (value["y"] + (value["height"] / 2))}
${Node_Func} = Set Variable
... {'x': (value["x"]), 'y': (value["y"])}
${obj_node} = Get Boundingbox id=draggable ALL evaluate ${Node_Func}
${obj_center} = Get Boundingbox id=draggable ALL evaluate ${Center_Func}
${x_diff} = Evaluate ${obj_center}[x] - ${expect_x}
${y_diff} = Evaluate ${obj_center}[y] - ${expect_y}
${obj_node} = Get Boundingbox id=blue-box ALL evaluate ${Node_Func}
${obj_center} = Get Boundingbox id=blue-box ALL evaluate ${Center_Func}
${x_diff} = Evaluate ${obj_node}[x] - ${expect_x}
${y_diff} = Evaluate ${obj_node}[y] - ${expect_y}
Log Many Node x,y: \t${obj_node}[x],\t${obj_node}[y]
... Center x,y: \t${obj_center}[x],\t${obj_center}[y]\nExpected xy \t${expect_x},\t${expect_y}
... X-Diff: ${x_diff}, Y-Diff: ${y_diff}, tolerance: ${tol}
Expand Down
2 changes: 1 addition & 1 deletion node/dynamic-test-app/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DragGame } from './draggame';
import { HashRouter, Route, Routes } from 'react-router-dom';
import DragGame from './draggame';
import Login from './login';
import React from 'react';

Expand Down
Loading