-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hopefully now finally fixes #348
- Loading branch information
Showing
16 changed files
with
2,787 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ Generally speaking, the authentication behavior mimicks that of a regular user s | |
BTP-, Office365- and custom IdP all supply credentials as a user would, meaning they're literally typed into the respective input fields on each login screen. | ||
Basic Authentication prepends username and password in encoded form to the URL, resulting in an `HTTP` `GET` in the form of `https://username:[email protected]`. | ||
|
||
!> Multi-Factor Authentication is not supported as it's nearly to manage any media break (e.g. browser ↔ mobile) in authentication flows out of the box | ||
!> Multi-Factor Authentication is not supported as it's nearly impossible to manage any media break (e.g. browser ↔ mobile) in authentication flows out of the box | ||
|
||
For you as users, authentication is done at design-time, meaning: **by configuration only, not programmatically**. | ||
This especially means that no changes in the test code are needed for using authentication in `wdi5` tests! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Feature: The Internet Guinea Pig Website | ||
|
||
Scenario Outline: As a user, I can log into the secure area | ||
|
||
Given I am on the login page | ||
When I login with <username> and <password> | ||
Then I should see a flash message saying <message> | ||
|
||
Examples: | ||
| username | password | message | | ||
| tomsmith | SuperSecretPassword! | You logged into a secure area! | | ||
| foobar | barfoo | Your username is invalid! | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const Page = require("./page") | ||
|
||
/** | ||
* sub page containing specific selectors and methods for a specific page | ||
*/ | ||
class LoginPage extends Page { | ||
/** | ||
* define selectors using getter methods | ||
*/ | ||
get inputUsername() { | ||
return $("#username") | ||
} | ||
|
||
get inputPassword() { | ||
return $("#password") | ||
} | ||
|
||
get btnSubmit() { | ||
return $('button[type="submit"]') | ||
} | ||
|
||
/** | ||
* a method to encapsule automation code to interact with the page | ||
* e.g. to login using username and password | ||
*/ | ||
async login(username, password) { | ||
await this.inputUsername.setValue(username) | ||
await this.inputPassword.setValue(password) | ||
await this.btnSubmit.click() | ||
} | ||
|
||
/** | ||
* overwrite specific options to adapt it to page object | ||
*/ | ||
open() { | ||
return super.open("login") | ||
} | ||
} | ||
|
||
module.exports = new LoginPage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* main page object containing all methods, selectors and functionality | ||
* that is shared across all page objects | ||
*/ | ||
module.exports = class Page { | ||
/** | ||
* Opens a sub page of the page | ||
* @param path path of the sub page (e.g. /path/to/page.html) | ||
*/ | ||
open(path) { | ||
return browser.url(`https://the-internet.herokuapp.com/${path}`) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const Page = require("./page") | ||
|
||
/** | ||
* sub page containing specific selectors and methods for a specific page | ||
*/ | ||
class SecurePage extends Page { | ||
/** | ||
* define selectors using getter methods | ||
*/ | ||
get flashAlert() { | ||
return $("#flash") | ||
} | ||
} | ||
|
||
module.exports = new SecurePage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
const { Given, When, Then } = require("@wdio/cucumber-framework") | ||
|
||
const LoginPage = require("../pageobjects/login.page") | ||
const SecurePage = require("../pageobjects/secure.page") | ||
|
||
const pages = { | ||
login: LoginPage | ||
} | ||
|
||
Given(/^I am on the (\w+) page$/, async (page) => { | ||
await pages[page].open() | ||
}) | ||
|
||
When(/^I login with (\w+) and (.+)$/, async (username, password) => { | ||
await LoginPage.login(username, password) | ||
}) | ||
|
||
Then(/^I should see a flash message saying (.*)$/, async (message) => { | ||
await expect(SecurePage.flashAlert).toBeExisting() | ||
await expect(SecurePage.flashAlert).toHaveTextContaining(message) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"devDependencies": { | ||
"@wdio/cli": "^7.27.0", | ||
"@wdio/cucumber-framework": "^7.27.0", | ||
"@wdio/local-runner": "^7.27.0", | ||
"@wdio/mocha-framework": "^7.26.0", | ||
"@wdio/spec-reporter": "^7.26.0", | ||
"chromedriver": "latest", | ||
"wdio-chromedriver-service": "^7.3.2", | ||
"wdio-ui5-service": "*" | ||
}, | ||
"scripts": { | ||
"test": "wdio run ./wdio.conf.js" | ||
} | ||
} |
Oops, something went wrong.