Skip to content

Commit

Permalink
fix behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MishNajam committed Nov 29, 2023
1 parent 509fe81 commit 2047714
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 28 deletions.
28 changes: 7 additions & 21 deletions service-front/app/features/context/UI/AccountContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2078,8 +2078,8 @@ public function iClickTheOneLoginButton(): void
public function iHaveLoggedInToOneLogin($language): void
{
$this->iAmOnTheTemporaryOneLoginPage();
$language = $language === 'English' ? 'en' : 'cy';
if ($language === 'cy') {
$this->language = $language === 'English' ? 'en' : 'cy';
if ($this->language === 'cy') {
$this->iSelectTheWelshLanguage();
}
$this->iClickTheOneLoginButton();
Expand Down Expand Up @@ -2119,26 +2119,12 @@ public function oneLoginReturnsAError($errorType): void
}

/**
* @Then /^I am redirected to the login page with a "(.*)" error message$/
* @Then /^I am redirected to the login page with a "(.*)" error and "(.*)"$/
*/
public function iAmRedirectedToTheErrorPage($errorType): void
public function iAmRedirectedToTheLanguageErrorPage($errorType, $errorMessage): void
{
$this->ui->assertPageAddress('/home?error=' . $errorType);
}

/**
* @Then /^I am redirected to the Welsh login page with a "(.*)" error message$/
*/
public function iAmRedirectedToTheWelshErrorPage($errorType): void
{
$this->ui->assertPageAddress('/cy/home?error=' . $errorType);
}

/**
* @Then /^I should be told "(.*)"$/
*/
public function iSeeTheText($text): void
{
$this->ui->assertPageContainsText($text);
$basePath = $this->language === 'cy' ? '/cy' : '';
$this->ui->assertPageAddress($basePath . '/home?error=' . $errorType);
$this->ui->assertPageContainsText($errorMessage);
}
}
13 changes: 6 additions & 7 deletions service-front/app/features/one-login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@
Scenario Outline: One Login returns a specific error
Given I have logged in to one login in <language>
When One Login returns a "<error_type>" error
Then I am redirected to the login page with a "<error_type>" error message
And I should be told "<error_message>"
Then I am redirected to the login page with a "<error_type>" error and "<error_message>"

Examples:
|language | error_type | error_message |
| English | access_denied | Tried to login however access is denied |
| English | temporarily_unavailable | One Login is temporarily unavailable |
| Welsh | access_denied | Mae problem |
| Welsh | temporarily_unavailable | Mae problem |
| language | error_type | error_message |
| English | access_denied | Tried to login however access is denied |
| English | temporarily_unavailable | One Login is temporarily unavailable |
| Welsh | access_denied | Mae problem |
| Welsh | temporarily_unavailable | Mae problem |

@ui @actor @ff:allow_gov_one_login:true
Scenario Outline: One Login returns a generic error
Expand Down

0 comments on commit 2047714

Please sign in to comment.