Skip to content

Commit

Permalink
changed selector with data-testid
Browse files Browse the repository at this point in the history
  • Loading branch information
csp175 committed Nov 23, 2023
1 parent ec4eecc commit b8a3a60
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
14 changes: 7 additions & 7 deletions cypress/e2e/login_management/invalidCredentials.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ Feature: Invalid Credentials - Verify login functionality via wrong user data
@stable_test
Scenario: User uses invalid email and password
Given I am on the dBildungscloud login page
Then I see Email field is visible and empty
Then I see email field is visible and empty
When I enter invalid email
Then I see Password field is visible and empty
Then I see password field is visible and empty
When I enter invalid password
When I click submit button
When I click button Submit
Then I see error message

@stable_test
Scenario: User login with empty fields
Given I am on the dBildungscloud login page
When I click submit button
When I click button Submit
Then I see form validation message

@stable_test
Scenario: User uses invalid username and password
Given I am on the dBildungscloud login page
Then I see Email field is visible and empty
Then I see email field is visible and empty
When I enter invalid username
Then I see Password field is visible and empty
Then I see password field is visible and empty
When I enter invalid password
When I click submit button
When I click button Submit
Then I see error message
24 changes: 12 additions & 12 deletions cypress/e2e/login_management/passwordUpdate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Feature: Password Update - Verify login functionality via password change
@stable_test
Scenario: User change password, login and change again to old passwords.
Given I am on the dBildungscloud login page
Then I see Email field is visible and empty
Then I see email field is visible and empty
When I enter email
Then I see Password field is visible and empty
Then I see password field is visible and empty
When I enter password
When I click submit button
When I click button Submit
When I go to my account settings
Then I see current password field is visible and empty
Then I see new and repeat password field is visible and empty
Expand All @@ -23,18 +23,18 @@ Feature: Password Update - Verify login functionality via password change
When I logout
#Then I see dbildungscloud login page
Given I am on the dBildungscloud login page
Then I see Email field is visible and empty
Then I see email field is visible and empty
When I enter email
Then I see Password field is visible and empty
Then I see password field is visible and empty
When I enter password
When I click submit button
When I click button Submit
Then I see error message
When I wait for 15 seconds
Then I see Email field is visible and empty
Then I see email field is visible and empty
When I enter email
Then I see Password field is visible and empty
Then I see password field is visible and empty
When I enter new password
When I click submit button
When I click button Submit
When I go to my account settings
Then I see current password field is visible and empty
Then I see new and repeat password field is visible and empty
Expand All @@ -47,9 +47,9 @@ Feature: Password Update - Verify login functionality via password change
When I logout
#Then I see dbildungscloud login page
Given I am on the dBildungscloud login page
Then I see Email field is visible and empty
Then I see email field is visible and empty
When I enter email
Then I see Password field is visible and empty
Then I see password field is visible and empty
When I enter password
When I click submit button
When I click button Submit
Then I arrive on the dashboard
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Login_Management {
static #emailInputBox = '[data-testid="username-email"]'
static #passwordField = '[data-testid = "password-email"]'
static #notificationBannerField = '[data-testid="notification"]'
static #loginFormSelector = 'form.login-form'
static #loginFormSelector = '[data-testid = "login-loginform-standard"]'
static #inputFieldInvalidPseudoSelector = 'input:invalid'
static #userSettingsCurrentPasswordField =
'[data-testid="settings_password_current"]'
Expand All @@ -33,6 +33,8 @@ class Login_Management {
errorMessageText: 'Login fehlgeschlagen.'
}

// info about checkValidity: https://www.w3schools.com/js/js_validation_api.asp
// info about inputFieldInvalidPseudoSelector: https://glebbahmutov.com/blog/form-validation-in-cypress/
assertEmailFieldIsVisibleAndEmpty () {
cy.get(Login_Management.#loginFormSelector).within(() => {
cy.get(Login_Management.#emailInputBox)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ Then('I see form validation message', () => {
loginManagement.assertFormValidationMessageDisplay()
})

Then('I see Email field is visible and empty', () => {
Then('I see email field is visible and empty', () => {
loginManagement.assertEmailFieldIsVisibleAndEmpty()
})

When('I click submit button', () => {
When('I click button Submit', () => {
loginManagement.clickOnSubmitButton()
})

Then('I see Password field is visible and empty', () => {
Then('I see password field is visible and empty', () => {
loginManagement.assertPasswordFieldIsVisibleAndEmpty()
})

0 comments on commit b8a3a60

Please sign in to comment.