diff options
author | Joas Schilling <coding@schilljs.com> | 2022-09-20 14:16:55 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-09-20 14:16:55 +0200 |
commit | 3b3c7de56b24f197d2f504d6eee8088c05a6e2ee (patch) | |
tree | 0136af817ede51ba3b03f3ff45ee5deb7db7ba6a /tests | |
parent | 73033cecfc0ee476664de47e29489bcc3b00fce2 (diff) |
Reuse existing sleep and abstract $base_url
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/features/bootstrap/FeatureContext.php | 19 | ||||
-rw-r--r-- | tests/integration/features/integration/dashboard.feature | 18 |
2 files changed, 16 insertions, 21 deletions
diff --git a/tests/integration/features/bootstrap/FeatureContext.php b/tests/integration/features/bootstrap/FeatureContext.php index 7cc01aad2..1ded3a5dc 100644 --- a/tests/integration/features/bootstrap/FeatureContext.php +++ b/tests/integration/features/bootstrap/FeatureContext.php @@ -1720,6 +1720,8 @@ class FeatureContext implements Context, SnippetAcceptingContext { $widget['item_icons_round'] = (bool) $widget['item_icons_round']; $widget['order'] = (int) $widget['order']; + $widget['widget_url'] = str_replace('{$BASE_URL}', $this->baseUrl, $widget['widget_url']); + $widget['buttons'] = str_replace('{$BASE_URL}', $this->baseUrl, $widget['buttons']); $widget['buttons'] = json_decode($widget['buttons'], true); Assert::assertEquals($widget, $data[$id], 'Mismatch of data for widget ' . $id); @@ -1752,22 +1754,15 @@ class FeatureContext implements Context, SnippetAcceptingContext { Assert::assertCount(count($expectedItems), $data[$widgetId]); - foreach ($expectedItems as $key => $widget) { - $widget['link'] = $this->baseUrl . 'index.php/call/' . self::$identifierToToken[$widget['link']]; + foreach ($expectedItems as $key => $item) { + $item['link'] = $this->baseUrl . 'index.php/call/' . self::$identifierToToken[$item['link']]; + $item['iconUrl'] = str_replace('{$BASE_URL}', $this->baseUrl, $item['iconUrl']); - Assert::assertEquals($widget, $data[$widgetId][$key], 'Wrong details for item #' . $key); + Assert::assertEquals($item, $data[$widgetId][$key], 'Wrong details for item #' . $key); } } /** - * @Then /^sleep 1 second$/ - * - */ - public function sleepOneSecond(): void { - sleep(1); - } - - /** * @Then /^user "([^"]*)" deletes message "([^"]*)" from room "([^"]*)" with (\d+)(?: \((v1)\))?$/ * * @param string $user @@ -2667,7 +2662,7 @@ class FeatureContext implements Context, SnippetAcceptingContext { } /** - * @When wait for :seconds seconds + * @When wait for :seconds seconds? */ public function waitForXSeconds($seconds): void { sleep($seconds); diff --git a/tests/integration/features/integration/dashboard.feature b/tests/integration/features/integration/dashboard.feature index 93cbc3beb..63b5759f1 100644 --- a/tests/integration/features/integration/dashboard.feature +++ b/tests/integration/features/integration/dashboard.feature @@ -5,8 +5,8 @@ Feature: integration/dashboard Scenario: User gets the available dashboard widgets When user "participant1" sees the following entry when loading the list of dashboard widgets (v1) - | id | title | icon_class | icon_url | widget_url | item_icons_round | order | buttons | - | spreed | Talk mentions | dashboard-talk-icon | img/app-dark.svg | http://localhost:8080/index.php/apps/spreed/ | true | 10 | [{"type":"more","text":"More unread mentions","link":"http://localhost:8080/index.php/apps/spreed/"}] | + | id | title | icon_class | icon_url | widget_url | item_icons_round | order | buttons | + | spreed | Talk mentions | dashboard-talk-icon | img/app-dark.svg | {$BASE_URL}index.php/apps/spreed/ | true | 10 | [{"type":"more","text":"More unread mentions","link":"{$BASE_URL}index.php/apps/spreed/"}] | Scenario: User gets the dashboard widget content When user "participant1" sees the following entries for dashboard widgets "spreed" (v1) @@ -15,21 +15,21 @@ Feature: integration/dashboard | roomType | 1 | | invite | participant1 | And user "participant2" sends message "Hello" to room "one-to-one room" with 201 - And sleep 1 second + And wait for 1 second Given user "participant2" creates room "group room" (v4) | roomType | 2 | | roomName | group room | And user "participant2" adds user "participant1" to room "group room" with 200 (v4) And user "participant2" sends message "Hello @all" to room "group room" with 201 - And sleep 1 second + And wait for 1 second Given user "participant2" creates room "call room" (v4) | roomType | 3 | | roomName | call room | And user "participant2" adds user "participant1" to room "call room" with 200 (v4) And user "participant2" joins room "call room" with 200 (v4) And user "participant2" joins call "call room" with 200 (v4) - When user "participant1" sees the following entries for dashboard widgets "spreed" (v1) - | title | subtitle | link | iconUrl | sinceId | - | participant2-displayname | Hello | one-to-one room | http://localhost:8080/index.php/avatar/participant2/64 | | - | group room | Hello group room | group room | http://localhost:8080/core/img/actions/group.svg | | - | call room | @participant2-displayname started a call | call room | http://localhost:8080/core/img/actions/public.svg | | + Then user "participant1" sees the following entries for dashboard widgets "spreed" (v1) + | title | subtitle | link | iconUrl | sinceId | + | participant2-displayname | Hello | one-to-one room | {$BASE_URL}index.php/avatar/participant2/64 | | + | group room | Hello group room | group room | {$BASE_URL}core/img/actions/group.svg | | + | call room | @participant2-displayname started a call | call room | {$BASE_URL}core/img/actions/public.svg | | |