Skip to content

Commit 0f78c7d

Browse files
authored
Support webkit and firefox browser (#52)
* Add playwright * Add firefox support * Clean up scripts
1 parent 1736115 commit 0f78c7d

File tree

96 files changed

+2266
-812
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2266
-812
lines changed

Diff for: .github/workflows/pythonpackage.yml

+45-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ jobs:
99
strategy:
1010
max-parallel: 4
1111
matrix:
12-
python-version: [3.6, 3.7, 3.8]
12+
# python-version: [3.7, 3.8, 3.9]
13+
include:
14+
- python-version: 3.7
15+
browser: webkit
16+
- python-version: 3.8
17+
browser: chrome
18+
- python-version: 3.9
19+
browser: firefox
1320

1421
steps:
1522
- uses: actions/checkout@v1
@@ -21,17 +28,51 @@ jobs:
2128
run: |
2229
python -m pip install --upgrade pip
2330
pip install -r requirements.txt
31+
- name: Install webkit
32+
run: |
33+
sudo apt-get update
34+
sudo apt-get install -y --no-install-recommends \
35+
gstreamer1.0-libav \
36+
gstreamer1.0-plugins-bad \
37+
libgstreamer-plugins-bad1.0-0 \
38+
libwoff1 \
39+
libopus0 \
40+
libwebp6 \
41+
libwebpdemux2 \
42+
libenchant1c2a \
43+
libgudev-1.0-0 \
44+
libsecret-1-0 \
45+
libhyphen0 \
46+
libgdk-pixbuf2.0-0 \
47+
libegl1 \
48+
libnotify4 \
49+
libxslt1.1 \
50+
libevent-2.1-6 \
51+
libgles2 \
52+
libvpx5 \
53+
libxcomposite1 \
54+
libatk1.0-0 \
55+
libatk-bridge2.0-0 \
56+
libepoxy0 \
57+
libgtk-3-0 \
58+
libharfbuzz-icu0 \
59+
xvfb
2460
- name: Lint with flake8
2561
run: |
2662
pip install flake8
2763
# stop the build if there are Python syntax errors or undefined names
2864
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
2965
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3066
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31-
- name: System test
67+
- name: Run test project
3268
run: |
3369
python setup.py install
34-
pyppeteer-install
3570
pip install -r demoapp/requirements.txt
71+
pyppeteer-install
72+
python -m playwright install
3673
python demoapp/server.py &
37-
robot -v HEADLESS:True -e Ignore Examples
74+
- name: System test
75+
uses: GabrielBB/xvfb-action@v1
76+
with:
77+
working-directory: ./ #optional
78+
run: robot -v BROWSER:${{ matrix.browser }} -e IgnoreORIgnore_${{ matrix.browser }} Examples

Diff for: Examples/alert-handler/alert-handler.robot

+10-4
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,31 @@ Test Setup Open browser to test page
44
Test Teardown Close All Browser
55
Suite Teardown Close Puppeteer
66

7+
78
*** Variables ***
9+
${DEFAULT_BROWSER} chrome
810
${HOME_PAGE_URL} http://127.0.0.1:7272/basic-html-elements.html
911

12+
1013
*** Test Cases ***
1114
Accept alert
15+
[Tags] Ignore_webkit Ignore_firefox
1216
Run Async Keywords
1317
... Handle Alert ACCEPT AND
14-
... Click Button id=alert_confirm
18+
... Click Element id=alert_confirm
1519
Click Element id:get_ajax
1620

1721
Dismiss alert
22+
[Tags] Ignore_webkit Ignore_firefox
1823
Run Async Keywords
1924
... Handle Alert DISMISS AND
20-
... Click Button id=alert_confirm
25+
... Click Element id=alert_confirm
2126
Click Element id:get_ajax
27+
2228

2329
*** Keywords ***
2430
Open browser to test page
31+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
2532
${HEADLESS} Get variable value ${HEADLESS} ${False}
2633
&{options} = create dictionary headless=${HEADLESS}
27-
Open browser ${HOME_PAGE_URL} options=${options}
28-
34+
Open browser ${HOME_PAGE_URL} browser=${BROWSER} options=${options}

Diff for: Examples/api/mock-api.robot

+8-5
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,27 @@ Test Teardown Close All Browser
55
Suite Teardown Close Puppeteer
66

77
*** Variables ***
8+
${DEFAULT_BROWSER} chrome
89
${HOME_PAGE_URL} http://127.0.0.1:7272/basic-html-elements.html
910

1011

1112
*** Test Cases ***
12-
Mock ajax response with raw text
13+
Mock ajax response with raw text
1314
&{response} Create Dictionary body=I'm a mock response text
14-
Mock Current Page Api Response /ajax_info.json\\?count=3 ${response}
15+
Mock Current Page Api Response /ajax_info.json?count=3 ${response}
1516
Click Element id=get_ajax
1617
Wait Until Page Contains I'm a mock response text
1718

1819
Mock ajax response with json response
1920
&{response} Create Dictionary body={ 'data': 'I\'m a mock response json'} contentType=application/json
20-
Mock Current Page Api Response /ajax_info.json\\?count=3 ${response}
21+
Mock Current Page Api Response /ajax_info.json?count=3 ${response}
2122
Click Element id=get_ajax
2223
Wait Until Page Contains I'm a mock response json
2324

25+
2426
*** Keywords ***
2527
Open browser to test page
26-
${HEADLESS} Get variable value ${HEADLESS} ${False}
28+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
29+
${HEADLESS} = Get variable value ${HEADLESS} ${False}
2730
&{options} = create dictionary headless=${HEADLESS}
28-
Open browser ${HOME_PAGE_URL} options=${options}
31+
Open browser ${HOME_PAGE_URL} browser=${BROWSER} options=${options}

Diff for: Examples/browser-management/emulator-mode.robot

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
Library PuppeteerLibrary
33
Suite Teardown Close Puppeteer
44

5+
*** Variables ***
6+
${DEFAULT_BROWSER} chrome
7+
# ${DEFAULT_BROWSER} webkit
8+
59
*** Test Cases ***
610
Example enable emulator mode
11+
[Tags] Ignore_firefox
712
[Teardown] Close All Browser
8-
${HEADLESS} Get variable value ${HEADLESS} ${False}
9-
&{options} = create dictionary headless=${HEADLESS}
10-
Open browser http://127.0.0.1:7272/basic-html-elements.html options=${options} alias=Browser 1
11-
Enable emulate mode iPhone SE
13+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
14+
${HEADLESS} = Get variable value ${HEADLESS} ${False}
15+
&{options} = create dictionary headless=${HEADLESS} emulate=iPhone 11
16+
Open browser http://127.0.0.1:7272/basic-html-elements.html browser=${BROWSER} options=${options} alias=Browser 1
1217
Capture page screenshot

Diff for: Examples/browser-management/open-close-browser.robot

+14-7
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,35 @@ Library PuppeteerLibrary
33
Suite Teardown Close Puppeteer
44
Test Teardown Close All Browser
55

6+
*** Variables ***
7+
${DEFAULT_BROWSER} chrome
8+
9+
610
*** Test Cases ***
711
Switch to new browser
8-
${HEADLESS} Get variable value ${HEADLESS} ${False}
12+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
13+
${HEADLESS} = Get variable value ${HEADLESS} ${False}
914
&{options} = create dictionary headless=${HEADLESS}
10-
Open browser http://127.0.0.1:7272/basic-html-elements.html options=${options}
15+
Open browser http://127.0.0.1:7272/basic-html-elements.html browser=${BROWSER} options=${options}
1116
Run Async Keywords
12-
... Wait For New Window Open AND
13-
... Click Element id=open-new-tab
14-
Switch Window NEW
17+
... Click Element id=open-new-tab AND
18+
... Wait For New Window Open
19+
Switch Window NEW
1520
Wait Until Page Contains Element id=exampleInputEmail1
1621
Switch Window title=Basic HTML Elements
1722
Wait Until Page Contains Element id=open-new-tab
1823

1924
Handle multiple browser
25+
[Teardown] Capture Page Screenshot
26+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
2027
${HEADLESS} Get variable value ${HEADLESS} ${False}
2128
&{options} = create dictionary headless=${HEADLESS}
22-
Open browser http://127.0.0.1:7272/basic-html-elements.html options=${options} alias=Browser 1
29+
Open browser http://127.0.0.1:7272/basic-html-elements.html browser=${BROWSER} options=${options} alias=Browser 1
2330
Run Async Keywords
2431
... Wait For New Window Open AND
2532
... Click Element id=open-new-tab
2633
Switch Window NEW
27-
Open browser http://127.0.0.1:7272/basic-html-elements.html options=${options} alias=Browser 2
34+
Open browser http://127.0.0.1:7272/basic-html-elements.html browser=${BROWSER} options=${options} alias=Browser 2
2835
Switch Browser Browser 1
2936
Wait Until Page Contains Login form
3037
Switch Browser Browser 2

Diff for: Examples/debug-mode/enable-debug-mode.robot

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,22 @@ Library PuppeteerLibrary
33
Test Teardown Close All Browser
44
Suite Teardown Close Puppeteer
55

6+
*** Variables ***
7+
${DEFAULT_BROWSER} chrome
8+
# ${DEFAULT_BROWSER} webkit
9+
${HOME_PAGE_URL} http://127.0.0.1:7272/login-form-example.html
10+
611

712
*** Test Cases ***
813
Enable debug mode
9-
Open browser to test page http://127.0.0.1:7272/login-form-example.html
14+
Open browser to test page
1015
Input Text id=exampleInputEmail1 demo@qahive.com
1116
Input Text id=exampleInputPassword1 123456789
1217

1318
*** Keywords ***
1419
Open browser to test page
15-
[Arguments] ${url}
16-
${HEADLESS} Get variable value ${HEADLESS} ${False}
17-
Run Keyword If ${HEADLESS} == ${False} Enable Debug Mode
20+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
21+
${HEADLESS} = Get variable value ${HEADLESS} ${False}
22+
Run Keyword If ${HEADLESS} == ${False} Enable Debug Mode
1823
&{options} = create dictionary headless=${HEADLESS}
19-
Open browser ${url} options=${options}
24+
Open browser ${HOME_PAGE_URL} browser=${BROWSER} options=${options}

Diff for: Examples/form-handler/dropdown-list.robot

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Test Teardown Close All Browser
55
Suite Teardown Close Puppeteer
66

77
*** Variables ***
8+
${DEFAULT_BROWSER} chrome
9+
# ${DEFAULT_BROWSER} webkit
810
${HOME_PAGE_URL} http://127.0.0.1:7272/basic-html-elements.html
911

1012

@@ -23,6 +25,7 @@ Select dropdown list by labels with xpath
2325

2426
*** Keywords ***
2527
Open browser to test page
28+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
2629
${HEADLESS} Get variable value ${HEADLESS} ${False}
2730
&{options} = create dictionary headless=${HEADLESS}
28-
Open browser ${HOME_PAGE_URL} options=${options}
31+
Open browser ${HOME_PAGE_URL} browser=${BROWSER} options=${options}

Diff for: Examples/form-handler/element-properties.robot

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Test Teardown Close All Browser
55
Suite Teardown Close Puppeteer
66

77
*** Variables ***
8+
${DEFAULT_BROWSER} chrome
89
${HOME_PAGE_URL} http://127.0.0.1:7272/basic-html-elements.html
910

1011

@@ -20,7 +21,11 @@ Element is visible and not visible
2021
Element Should Be Visible id:prop-visible
2122
Element Should Not Be Visible id:prop-hide
2223
Run Keyword And Expect Error REGEXP:Element 'id:prop-hide' is not be visible Element Should Be Visible id:prop-hide
23-
24+
25+
Get Element Text
26+
${text} = Get Text id=prop-text
27+
Should Contain ${text} Please
28+
2429
Element should containt text
2530
Element Should Contain id=prop-text Please ${True}
2631

@@ -35,6 +40,7 @@ Element text should not be
3540

3641
*** Keywords ***
3742
Open browser to test page
43+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
3844
${HEADLESS} Get variable value ${HEADLESS} ${False}
3945
&{options} = create dictionary headless=${HEADLESS}
40-
Open browser ${HOME_PAGE_URL} options=${options}
46+
Open browser ${HOME_PAGE_URL} browser=${BROWSER} options=${options}

Diff for: Examples/form-handler/file-upload.robot

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Suite Teardown Close Puppeteer
66

77

88
*** Variables ***
9+
${DEFAULT_BROWSER} chrome
910
${HOME_PAGE_URL} http://127.0.0.1:7272/basic-html-elements.html
1011

1112

@@ -15,6 +16,7 @@ Upload file
1516

1617
*** Keywords ***
1718
Open browser to test page
19+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
1820
${HEADLESS} Get variable value ${HEADLESS} ${False}
1921
&{options} = create dictionary headless=${HEADLESS}
20-
Open browser ${HOME_PAGE_URL} options=${options}
22+
Open browser ${HOME_PAGE_URL} browser=${BROWSER} options=${options}

Diff for: Examples/form-handler/form-submit.robot

+7-3
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,21 @@ Library PuppeteerLibrary
33
Test Teardown Close All Browser
44
Suite Teardown Close Puppeteer
55

6+
*** Variables ***
7+
${DEFAULT_BROWSER} chrome
8+
69

710
*** Test Cases ***
811
Submit login form
912
Open browser to test page http://127.0.0.1:7272/login-form-example.html
1013
Input Text id=exampleInputEmail1 demo@qahive.com
11-
Input Text id=exampleInputPassword1 123456789
14+
Input Text xpath=//*[@id='exampleInputPassword1'] 123456789
1215
Click Element id=exampleCheck1
1316
Run Async Keywords
1417
... Wait For New Window Open AND
1518
... Click Element css=button[type="submit"]
1619
Switch Window NEW
17-
Wait Until Page Contains Login succeeded
20+
Wait Until Page Contains Login succeeded
1821

1922
Submit register form
2023
Open browser to test page http://127.0.0.1:7272/register-form-example.html
@@ -29,6 +32,7 @@ Submit register form
2932
*** Keywords ***
3033
Open browser to test page
3134
[Arguments] ${url}
35+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
3236
${HEADLESS} Get variable value ${HEADLESS} ${False}
3337
&{options} = create dictionary headless=${HEADLESS}
34-
Open browser ${url} options=${options}
38+
Open browser ${url} browser=${BROWSER} options=${options}

Diff for: Examples/form-handler/iframe.robot

+9-2
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,24 @@ Suite Teardown Close Puppeteer
66

77

88
*** Variables ***
9+
${DEFAULT_BROWSER} chrome
910
${HOME_PAGE_URL} http://127.0.0.1:7272/basic-html-elements.html
1011

1112

1213
*** Test Cases ***
1314
Interact with iframe element
1415
Wait Until Page Contains Element id=ifrm
1516
Select Frame id=ifrm
17+
Input Text id=exampleInputEmail1 demo@qahive.com
18+
Input Text xpath=//*[@id='exampleInputPassword1'] 123456789
1619
Click Element id=exampleCheck1
20+
Click Element xpath=//*[@id='exampleCheck1']
21+
Unselect Frame
22+
Wait Until Page Contains Element id=ifrm
1723

1824
*** Keywords ***
1925
Open browser to test page
26+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
2027
${HEADLESS} Get variable value ${HEADLESS} ${False}
21-
&{options} = create dictionary headless=${HEADLESS}
22-
Open browser ${HOME_PAGE_URL} options=${options}
28+
&{options} = create dictionary headless=${HEADLESS}
29+
Open browser ${HOME_PAGE_URL} browser=${BROWSER} options=${options}

Diff for: Examples/input/mouse.robot

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
Library PuppeteerLibrary
33
Test Setup Open browser to test page
44
Test Teardown Close All Browser
5+
Suite Teardown Close Puppeteer
56

67
*** Variables ***
8+
${DEFAULT_BROWSER} chrome
9+
# ${DEFAULT_BROWSER} webkit
710
${HOME_PAGE_URL} http://127.0.0.1:7272/basic-html-elements.html
811

912

@@ -22,7 +25,7 @@ Mouse drag
2225

2326
*** Keywords ***
2427
Open browser to test page
28+
${BROWSER} = Get variable value ${BROWSER} ${DEFAULT_BROWSER}
2529
${HEADLESS} Get variable value ${HEADLESS} ${False}
2630
&{options} = create dictionary headless=${HEADLESS}
27-
Open browser ${HOME_PAGE_URL} options=${options}
28-
31+
Open browser ${HOME_PAGE_URL} browser=${BROWSER} options=${options}

0 commit comments

Comments
 (0)