Test for private browsing differently
Ina48ea597d0
we fixed settings in private QtWebEngine windows. However, this means we also enable local storage for private windows, which was disabled in QtWebEngine by default:4ef5831a39 (diff-44ac7d27348388501944f6a8e2e67d8dR207)
It should be safe to enable it, as we get the same behavior as in Chromium, i.e. a working local storage which entirely lives in RAM. This also makes those tests work on QtWebKit-NG, presumably because private browsing for cookies is implemented there. It also adds a test to at least check whether local storage is isolated from non-private tabs. I tried writing a test which ensures nothing lands on the hard disk, but due to QTBUG-52121 this might not happen at all: https://bugreports.qt.io/browse/QTBUG-52121
This commit is contained in:
parent
a48ea597d0
commit
e0ff2d98fe
@ -6,21 +6,25 @@ Feature: Using private browsing
|
||||
Given I open about:blank
|
||||
And I clean up open tabs
|
||||
|
||||
@qtwebkit_ng_xfail: private browsing is not implemented yet
|
||||
Scenario: Opening new tab in private window
|
||||
When I open about:blank in a private window
|
||||
And I run :window-only
|
||||
And I open data/javascript/localstorage.html in a new tab
|
||||
Then the page should contain the plaintext "Local storage status: not working"
|
||||
And I open cookies/set?qute-private-test=42 without waiting in a new tab
|
||||
And I wait until cookies is loaded
|
||||
And I run :close
|
||||
And I wait for "removed: main-window" in the log
|
||||
And I open cookies
|
||||
Then the cookie qute-private-test should not be set
|
||||
|
||||
@qtwebkit_ng_xfail: private browsing is not implemented yet
|
||||
Scenario: Opening new tab in private window with :navigate next
|
||||
When I open data/navigate in a private window
|
||||
And I run :window-only
|
||||
And I run :navigate -t next
|
||||
And I wait until data/navigate/next.html is loaded
|
||||
And I open data/javascript/localstorage.html
|
||||
Then the page should contain the plaintext "Local storage status: not working"
|
||||
And I open cookies/set?qute-private-test=42 without waiting
|
||||
And I wait until cookies is loaded
|
||||
And I run :close
|
||||
And I wait for "removed: main-window" in the log
|
||||
And I open cookies
|
||||
Then the cookie qute-private-test should not be set
|
||||
|
||||
Scenario: Using command history in a new private browsing window
|
||||
When I run :set-cmd-text :message-info "Hello World"
|
||||
@ -123,3 +127,14 @@ Feature: Using private browsing
|
||||
When I set content -> allow-javascript to false
|
||||
And I open data/javascript/consolelog.html in a private window
|
||||
Then the javascript message "console.log works!" should not be logged
|
||||
|
||||
@qtwebkit_skip: Only applies to QtWebEngine
|
||||
Scenario: Make sure local storage is isolated with private browsing
|
||||
When I open / in a private window
|
||||
And I run :jseval localStorage.qute_private_test = 42
|
||||
And I wait for "42" in the log
|
||||
And I run :close
|
||||
And I wait for "removed: main-window" in the log
|
||||
And I open /
|
||||
And I run :jseval localStorage.qute_private_test
|
||||
Then "No output or error" should be logged
|
||||
|
@ -35,6 +35,15 @@ def check_cookie(quteproc, name, value):
|
||||
assert data['cookies'][name] == value
|
||||
|
||||
|
||||
@bdd.then(bdd.parsers.parse('the cookie {name} should not be set'))
|
||||
def check_cookie_not_set(quteproc, name):
|
||||
"""Check if a given cookie is not set."""
|
||||
content = quteproc.get_content()
|
||||
data = json.loads(content)
|
||||
print(data)
|
||||
assert name not in data['cookies']
|
||||
|
||||
|
||||
@bdd.then(bdd.parsers.parse('the file {name} should not contain "{text}"'))
|
||||
def check_not_contain(tmpdir, name, text):
|
||||
path = tmpdir / name
|
||||
|
Loading…
Reference in New Issue
Block a user