-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #409 from plone/port-robot-tests
Playwright based robot test
- Loading branch information
Showing
5 changed files
with
103 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Update robot framework tests to use `robotframework-browser` (`playwright` integration on robotframework). | ||
[1letter] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
206 changes: 97 additions & 109 deletions
206
plone/app/event/tests/robot/test_event_roundtrip.robot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,165 +1,153 @@ | ||
*** Settings *** | ||
|
||
Resource plone/app/robotframework/selenium.robot | ||
Resource plone/app/robotframework/keywords.robot | ||
Resource plone/app/robotframework/browser.robot | ||
|
||
Library Remote ${PLONE_URL}/RobotRemote | ||
Library Remote ${PLONE_URL}/RobotRemote | ||
|
||
Test Setup Open test browser | ||
Test Teardown Close all browsers | ||
Test Setup Run Keywords Plone test setup | ||
Test Teardown Run keywords Plone test teardown | ||
|
||
Variables plone/app/event/tests/robot/variables.py | ||
Variables variables.py | ||
|
||
|
||
*** Variables *** | ||
|
||
|
||
*** Test Cases *** | ||
*** Test cases *** | ||
|
||
Scenario: Create and view an event | ||
Given a site owner | ||
and an event add form | ||
Debug | ||
When I select a date in calendar overlay | ||
Then it should be filled in the form | ||
|
||
When I click on Recurrence Add | ||
Then I should see the recurrence overlay | ||
Given a site owner | ||
and an event add form | ||
When I click on Recurrence Add | ||
Then I should see the recurrence overlay | ||
|
||
When I select weekly repeat | ||
Then I should see the recurrence overlay in weeekly repeat mode | ||
When I select weekly repeat | ||
Then I should see the recurrence overlay in weeekly repeat mode | ||
|
||
When I fill 3 occurrences | ||
Then I should see 3 occurrences in the overlay | ||
When I fill 3 occurrences | ||
Then I should see 3 occurrences in the overlay | ||
|
||
When I click save in the overlay | ||
Then the overlay should be closed | ||
And I should see 3 occurrences in the form | ||
When I click save in the overlay | ||
Then the overlay should be closed | ||
and I should see 3 occurrences in the form | ||
|
||
When I click save in the form | ||
Then I should see the event detail view | ||
When I click save in the form | ||
Then I should see the event detail view | ||
|
||
When I open an event occurrence | ||
Then I should see the occurrence detail view | ||
When I open an event occurrence | ||
Then I should see the occurrence detail view | ||
|
||
When I open the event listing | ||
Then I should see the event listing view | ||
When I open the event listing | ||
Then I should see the event listing view | ||
|
||
|
||
*** Keywords *** | ||
|
||
# Given | ||
|
||
a site owner | ||
Enable autologin as Manager | ||
Enable autologin as Manager | ||
|
||
an event add form | ||
Go to ${PLONE_URL}/++add++Event | ||
Wait until page contains Add Event | ||
Input text name=form.widgets.IDublinCore.title Testevent | ||
Input text id=form-widgets-IDublinCore-description Test description | ||
Input text id=form-widgets-IEventLocation-location Test location | ||
Input text id=form-widgets-IEventAttendees-attendees Test attendee | ||
Input text id=form-widgets-IEventContact-contact_name Test name | ||
Input text id=form-widgets-IEventContact-contact_email test@email.com | ||
Input text id=form-widgets-IEventContact-contact_phone +1234567890 | ||
Input text id=form-widgets-IEventContact-event_url http://test.url | ||
Go to ${PLONE_URL}/++add++Event | ||
Type text //input[@name="form.widgets.IDublinCore.title"] Testevent | ||
Type text //textarea[@id="form-widgets-IDublinCore-description"] Test description | ||
Type text //input[@id="form-widgets-IEventLocation-location"] Test location | ||
Type text //textarea[@id="form-widgets-IEventAttendees-attendees"] Test attendee | ||
Type text //input[@id="form-widgets-IEventContact-contact_name"] Test name | ||
Type text //input[@id="form-widgets-IEventContact-contact_email"] test@email.com | ||
Type text //input[@id="form-widgets-IEventContact-contact_phone"] +1234567890 | ||
Type text //input[@id="form-widgets-IEventContact-event_url"] http://test.url | ||
|
||
# we can't set safely the date in the test via native browser ui "date input" element | ||
# reason 1: different ui's, depending on language of system browser | ||
# 12 hours format with meridiem input (AM/PM) vs. 24 hours format | ||
# reason 2: shadow root (user-agent) can't access via css or xpath selectors | ||
# | ||
# temporarily solution: set value via javascript | ||
|
||
Evaluate JavaScript //input[@name="form.widgets.IEventBasic.start"] | ||
... (el, arg) => { | ||
... el.setAttribute("value", arg) | ||
... } | ||
... all_elements=False | ||
... arg=${EVENT_START_ISO} | ||
|
||
Evaluate JavaScript //input[@name="form.widgets.IEventBasic.start"] | ||
... (el,arg) => { | ||
... el.setAttribute("value", arg) | ||
... } | ||
... all_elements=False | ||
... arg=${EVENT_END_ISO} | ||
|
||
# When | ||
|
||
I select a date in calendar overlay | ||
Click Element xpath=//div[@data-fieldname="form.widgets.IEventBasic.start"]//input[contains(@class,"pattern-pickadate-date")] | ||
Wait until page contains Sat | ||
# For Javascript: Month 1 = February. | ||
Select from list by label css=div[data-fieldname="form.widgets.IEventBasic.start"] .picker__select--month ${EVENT_START_MONTHNAME} | ||
Select from list by label css=div[data-fieldname="form.widgets.IEventBasic.start"] select.picker__select--year ${EVENT_START_YEAR} | ||
Click Element xpath=//div[@data-fieldname="form.widgets.IEventBasic.start"]//div[contains(@class, 'picker__day')][contains(text(), "${EVENT_START_DAY}")] | ||
# Select Times | ||
Click Element xpath=//div[@data-fieldname="form.widgets.IEventBasic.start"]//input[contains(@class,"pattern-pickadate-time")] | ||
Click Element xpath=//div[@data-fieldname="form.widgets.IEventBasic.start"]//div[contains(@class, 'picker--time')]//li[contains(@class, 'picker__list-item')][contains(text(), "${EVENT_START_HOUR}:00")] | ||
|
||
|
||
I click on Recurrence Add | ||
Click Link css=a[name='riedit'] | ||
Wait until page contains Repeat | ||
Click //a[@name="riedit"] | ||
|
||
I select weekly repeat | ||
Select From List by label css=#rirtemplate weekly | ||
Select Options By //div[contains(@class,"modal-wrapper")]//select[@id="rirtemplate"] value weekly | ||
|
||
I fill ${NUM} occurrences | ||
Input text name=rirangebyoccurrencesvalue ${NUM} | ||
Focus css=.risavebutton | ||
Type Text //div[contains(@class,"modal-wrapper")]//form//input[@name="rirangebyoccurrencesvalue"] ${NUM} | ||
Keyboard Key press Tab | ||
|
||
I click save in the overlay | ||
Click Button css=.risavebutton | ||
Click //div[contains(@class,"modal-wrapper")]//div[@class="modal-footer"]//button[contains(@class,"risavebutton")] | ||
|
||
I click save in the form | ||
Click Button name=form.buttons.save | ||
Click //button[@name="form.buttons.save"] | ||
|
||
I open an event occurrence | ||
Go to ${PLONE_URL}/testevent/2014-02-17 | ||
${url}= Get Property //*[@id="content-core"]/div/div/div/div[2]/div[1]/div/div/div[2]/p/span[2]/a href | ||
Go to ${url} | ||
|
||
I open the event listing | ||
Go to ${PLONE_URL}/@@event_listing?mode=all | ||
|
||
Go to ${PLONE_URL}/@@event_listing?mode=all | ||
|
||
# Then | ||
|
||
it should be filled in the form | ||
Textfield Value Should Be css=#formfield-form-widgets-IEventBasic-start input.pattern-pickadate-date ${EVENT_START_MONTHNAME} ${EVENT_START_DAY}, ${EVENT_START_YEAR} | ||
Textfield Should Contain css=#formfield-form-widgets-IEventBasic-start input.pattern-pickadate-time ${EVENT_START_HOUR}:00 | ||
Textfield Value Should Be css=#formfield-form-widgets-IEventBasic-end input.pattern-pickadate-date ${EVENT_END_MONTHNAME} ${EVENT_END_DAY}, ${EVENT_END_YEAR} | ||
Textfield Should Contain css=#formfield-form-widgets-IEventBasic-end input.pattern-pickadate-time ${EVENT_END_HOUR}:00 | ||
|
||
I should see the recurrence overlay | ||
Page Should Contain Recurrence | ||
Page Should Contain Selected dates | ||
Page Should Contain Element //div[contains(@class, 'occurrence') and contains(@class, 'start')] 1 | ||
Page Should Contain Element //div[contains(@class, 'occurrence') and contains(@class, 'rrule')] 6 | ||
Get Text //div[contains(@class,"modal-wrapper")]//form/div[@class="rioccurrencesactions"]/div/h6/strong should be Selected dates | ||
Get Element Count //div[contains(@class, 'occurrence') and contains(@class, 'start')] should be 1 | ||
Get Element Count //div[contains(@class, 'occurrence') and contains(@class, 'rrule')] should be 6 | ||
|
||
I should see the recurrence overlay in weeekly repeat mode | ||
Page Should Contain Repeats every | ||
Page Should Contain Sun | ||
Page Should Contain Mon | ||
Page Should Contain Tue | ||
Page Should Contain Wed | ||
Page Should Contain Thu | ||
Page Should Contain Fri | ||
Page Should Contain Sat | ||
|
||
the overlay should be closed | ||
Page Should Not Contain class=.riform | ||
|
||
# About class matching with x-path, see: | ||
# http://stackoverflow.com/questions/1604471/how-can-i-find-an-element-by-css-class-with-xpath | ||
Get Text //div[contains(@class,"modal-wrapper")]//form//div[@id="riweeklyinterval"] contains Repeat every | ||
Get Text //div[contains(@class,"modal-wrapper")]//form//div[@id="riweeklyweekdays"] contains Sun | ||
Get Text //div[contains(@class,"modal-wrapper")]//form//div[@id="riweeklyweekdays"] contains Mon | ||
Get Text //div[contains(@class,"modal-wrapper")]//form//div[@id="riweeklyweekdays"] contains Tue | ||
Get Text //div[contains(@class,"modal-wrapper")]//form//div[@id="riweeklyweekdays"] contains Wed | ||
Get Text //div[contains(@class,"modal-wrapper")]//form//div[@id="riweeklyweekdays"] contains Thu | ||
Get Text //div[contains(@class,"modal-wrapper")]//form//div[@id="riweeklyweekdays"] contains Fri | ||
Get Text //div[contains(@class,"modal-wrapper")]//form//div[@id="riweeklyweekdays"] contains Sat | ||
|
||
I should see ${NUM} occurrences in the overlay | ||
Page Should Contain Element //div[contains(concat(' ', normalize-space(@class), ' '), ' rioccurrences ')]/div[contains(@class, 'occurrence')] ${NUM} | ||
Get Element Count //div[contains(@class,"modal-wrapper")]//div[@class="rioccurrences"]/div[contains(@class, 'occurrence')] should be ${NUM} | ||
|
||
the overlay should be closed | ||
Get Element Count //div[contains(@class,"modal-wrapper")]//*[contains(@class,"riform")] should be 0 | ||
|
||
I should see ${NUM} occurrences in the form | ||
Page Should Contain Element //div[contains(concat(' ', normalize-space(@class), ' '), ' ridisplay ')]/div[contains(concat(' ', normalize-space(@class), ' '), ' rioccurrences ')]/div[contains(@class, 'occurrence')] ${NUM} | ||
Get Element Count //div[contains(@class,"ridisplay")]//div[@class="rioccurrences"]/div[contains(@class, 'occurrence')] should be ${NUM} | ||
|
||
I should see the event detail view | ||
Page Should Contain Testevent | ||
Page Should Contain Test description | ||
Page Should Contain All dates | ||
Page Should Contain Test location | ||
Page Should Contain Test name | ||
Page Should Contain +1234567890 | ||
Page Should Contain Test attendee | ||
Page Should Contain Visit external website | ||
Page Should Contain iCal | ||
Get Text //*[@id="global_statusmessage"] contains Item created | ||
Get Text //article[@id="content"]/header contains Testevent | ||
Get Text //article[@id="content"]/header contains Test description | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains Test location | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains Test name | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains +1234567890 | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains Test attendee | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains Visit external website | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains iCal | ||
|
||
I should see the occurrence detail view | ||
Page Should Contain Testevent | ||
Page Should Contain Test description | ||
Page Should Contain All dates | ||
Page Should Contain Test location | ||
Page Should Contain Test name | ||
Page Should Contain +1234567890 | ||
Page Should Contain Test attendee | ||
Page Should Contain Visit external website | ||
Page Should Contain iCal | ||
Get Text //article[@id="content"]/header contains Testevent | ||
Get Text //article[@id="content"]/header contains Test description | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains Test location | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains Test name | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains +1234567890 | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains Test attendee | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains Visit external website | ||
Get Text //div[@id="content-core"]//div[contains(@class,"event-summary")] contains iCal | ||
|
||
I should see the event listing view | ||
Page Should Contain Element //article[@class="vevent"] 3 | ||
Get Element Count //article[contains(@class,"vevent")] should be 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,10 @@ | ||
# setup dates | ||
from datetime import datetime | ||
from datetime import timedelta | ||
|
||
import locale | ||
|
||
|
||
# important for MONTHNAME | ||
locale.setlocale(locale.LC_ALL, "en_US") | ||
|
||
NOW = datetime.now() + timedelta(days=1) | ||
EVENT_START_YEAR = NOW.strftime("%Y") | ||
EVENT_START_MONTH = str(NOW.month - 1) | ||
EVENT_START_MONTHNAME = NOW.strftime("%B") | ||
EVENT_START_DAY = NOW.strftime("%d") | ||
EVENT_START_HOUR = str(int(NOW.strftime("%I"))) | ||
EVENT_START_ISO = NOW.strftime("%Y-%m-%dT%H:00") | ||
|
||
END = NOW + timedelta(hours=1) | ||
EVENT_END_YEAR = END.strftime("%Y") | ||
EVENT_END_MONTH = str(END.month - 1) | ||
EVENT_END_MONTHNAME = END.strftime("%B") | ||
EVENT_END_DAY = END.strftime("%d") | ||
EVENT_END_HOUR = str(int(END.strftime("%I"))) | ||
EVENT_END_ISO = END.strftime("%Y-%m-%dT%H:00") |
1 change: 0 additions & 1 deletion
1
plone/app/event/tests/INACTIVE_test_robot.py → plone/app/event/tests/test_robot.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters