From f08704e789c1c782b853418ad5452ba8aab84deb Mon Sep 17 00:00:00 2001 From: Tarcisio Fedrizzi Date: Tue, 12 Jan 2016 09:59:03 +0100 Subject: [PATCH] Adds function to insert multiple lines in the clipboard --- tests/integration/features/conftest.py | 9 ++++++++- tests/integration/features/yankpaste.feature | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index 72de45fc6..076f91942 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -199,13 +199,20 @@ def selection_supported(qapp): def fill_clipboard(qtbot, qapp, httpbin, what, content): mode = _clipboard_mode(qapp, what) content = content.replace('(port)', str(httpbin.port)) - content = content.replace('\\n', '\n') clipboard = qapp.clipboard() with qtbot.waitSignal(clipboard.changed): clipboard.setText(content, mode) +@bdd.when(bdd.parsers.re(r'I put the following lines into the ' + r'(?Pprimary selection|clipboard):\n' + r'(?P.+)$', flags=re.DOTALL)) +def fill_clipboard_multiline(qtbot, qapp, httpbin, what, content): + content = '\n'.join(l.strip() for l in content.strip().split('\n')) + fill_clipboard(qtbot, qapp, httpbin, what, content) + + ## Then diff --git a/tests/integration/features/yankpaste.feature b/tests/integration/features/yankpaste.feature index 89a2d8426..e8487848f 100644 --- a/tests/integration/features/yankpaste.feature +++ b/tests/integration/features/yankpaste.feature @@ -108,7 +108,10 @@ Feature: Yanking and pasting. Scenario: Pasting multiple urls in a new tab Given I have a fresh instance When I run :tab-only - And I put "http://localhost:(port)/data/hello.txt\nhttp://localhost:(port)/data/hello2.txt\nhttp://localhost:(port)/data/hello3.txt" into the clipboard + And I put the following lines into the clipboard: + http://localhost:(port)/data/hello.txt + http://localhost:(port)/data/hello2.txt + http://localhost:(port)/data/hello3.txt And I run :paste -t And I wait until data/hello.txt is loaded And I wait until data/hello2.txt is loaded @@ -122,7 +125,10 @@ Feature: Yanking and pasting. Scenario: Pasting multiple urls in a background tab Given I open about:blank When I run :tab-only - And I put "http://localhost:(port)/data/hello.txt\nhttp://localhost:(port)/data/hello2.txt\nhttp://localhost:(port)/data/hello3.txt" into the clipboard + And I put the following lines into the clipboard: + http://localhost:(port)/data/hello.txt + http://localhost:(port)/data/hello2.txt + http://localhost:(port)/data/hello3.txt And I run :paste -b And I wait until data/hello.txt is loaded And I wait until data/hello2.txt is loaded @@ -135,7 +141,10 @@ Feature: Yanking and pasting. Scenario: Pasting multiple urls in new windows Given I have a fresh instance - When I put "http://localhost:(port)/data/hello.txt\nhttp://localhost:(port)/data/hello2.txt\nhttp://localhost:(port)/data/hello3.txt" into the clipboard + When I put the following lines into the clipboard: + http://localhost:(port)/data/hello.txt + http://localhost:(port)/data/hello2.txt + http://localhost:(port)/data/hello3.txt And I run :paste -w And I wait until data/hello.txt is loaded And I wait until data/hello2.txt is loaded