Skip to content

Commit bb21f99

Browse files
author
Marcel Schmäing
committed
Merge pull request #2955 in SW/shopware from sw-12519/5.0/fix-mink-test to 5.0
* commit 'f2cf6e61fd3b52feb80581333be1ae9ef76d2919': SW-12519 - Fixed failed mink test
2 parents 945009d + f2cf6e6 commit bb21f99

File tree

3 files changed

+38
-13
lines changed

3 files changed

+38
-13
lines changed

tests/Mink/features/account_changeLoginData.feature

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,25 +113,33 @@ Feature: Successful changes of login data
113113

114114
@forgot @login
115115
Scenario: I can request a new password, if I forgot it
116-
When I log in successful as "Max Mustermann" with email "[email protected]" and password "shopware"
117-
And I log me out
118-
And I follow "Mein Konto"
119-
And I follow "Passwort vergessen?"
116+
When I follow "Passwort vergessen?"
120117

121-
Then I should see "Passwort vergessen? Hier können Sie ein neues Passwort anfordern"
122-
And I should see "Wir senden Ihnen ein neues, zufällig generiertes Passwort. Dieses können Sie dann im Kundenbereich ändern."
118+
Then I should see "Passwort vergessen?"
119+
And I should see "Wir senden Ihnen eine Bestätigungsmail. Klicken Sie auf den darin enthaltenen Link, um Ihr Passwort zu ändern."
123120

124121
When I fill in "email" with "[email protected]"
125-
And I press "Passwort anfordern"
122+
And I press "E-Mail senden"
126123
Then I should see "Diese E-Mail-Adresse ist uns nicht bekannt"
127124

128125
When I fill in "email" with "[email protected]"
129-
And I press "Passwort anfordern"
130-
Then I should see "Ihr neues Passwort wurde Ihnen zugeschickt"
126+
And I press "E-Mail senden"
127+
Then I should see "Wir haben Ihnen eine Bestätigungsmail gesendet."
131128

132129
When I follow "Mein Konto"
130+
And I log in successful as "Max Mustermann" with email "[email protected]" and password "shopware"
131+
And I log me out
132+
And I click the link in my latest email
133+
134+
Then I should see "Wenn Sie das Passwort für Ihr Konto vergessen haben, können Sie hier ein neues definieren. Wenn Sie das neue Passwort speichern, wird Ihr altes Passwort ungültig."
135+
136+
When I fill in "password" with "shopware5"
137+
And I fill in "passwordConfirmation" with "shopware5"
138+
And I press "Passwort ändern"
139+
Then I should see "Ihr Passwort wurde erfolgreich geändert."
140+
And I should be on the page "Account"
141+
142+
When I log me out
143+
And I go to the page "Account"
133144
And I log in with email "[email protected]" and password "shopware"
134145
Then I should see "Ihre Zugangsdaten konnten keinem Benutzer zugeordnet werden"
135-
136-
When I log in with email "[email protected]" and password "shopware"
137-
Then I should see "Zu viele fehlgeschlagene Versuche. Ihr Account wurde vorübergehend deaktivert - bitte probieren Sie es in einigen Minuten erneut!"

tests/Mink/features/bootstrap/Page/Emotion/Homepage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,9 @@ public function checkArticle(Article $article, array $data)
338338

339339
Helper::throwException($message);
340340
}
341+
342+
public function getShopUrl()
343+
{
344+
return $this->getUrl();
345+
}
341346
}

tests/Mink/features/bootstrap/ShopwareContext.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,23 @@ public function iUnsubscribeTheNewsletter($email = null)
115115
*/
116116
public function iConfirmTheLinkInTheEmail($limit = 1)
117117
{
118-
$sql = 'SELECT hash FROM s_core_optin ORDER BY id DESC LIMIT ' . $limit;
118+
$sql = 'SELECT `type`, `hash` FROM `s_core_optin` ORDER BY `id` DESC LIMIT ' . $limit;
119119
$hashes = $this->getContainer()->get('db')->fetchAll($sql);
120120

121121
$session = $this->getSession();
122122
$link = $session->getCurrentUrl();
123+
124+
foreach ($hashes as $optin) {
125+
if ($optin['type'] === 'password') {
126+
$mask = '%saccount/resetPassword/hash/%s';
127+
$link = $this->getPage('Homepage')->getShopUrl();
128+
129+
$confirmationLink = sprintf($mask, $link, $optin['hash']);
130+
$session->visit($confirmationLink);
131+
return;
132+
}
133+
}
134+
123135
$query = parse_url($link, PHP_URL_QUERY);
124136
$anchor = strpos($link, "#");
125137

0 commit comments

Comments
 (0)