Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update E2E tests for sign-up with password to use lab tenant #2261

Merged
merged 5 commits into from
Jul 31, 2024

Conversation

diegojerezba
Copy link
Contributor

@diegojerezba diegojerezba commented Jul 26, 2024

Proposed changes

Tasks:

  • Updated the tests to work with lab tenant.
  • Updated the Hero Scenario reference to comply with Acceptance Criteria doc.

The above tasks have been done in the following tests:

  • test_signUpWithPassword_withEmailVerificationLastStep_succeeds
  • test_signUpWithPassword_withEmailVerificationAsLastStepAndCustomAttributes_succeeds
  • test_signUpWithPassword_withEmailVerificationAsFirstStep_succeeds (updated name to test_signUpWithPassword_withEmailVerificationAsFirstStepAndThenSetPassword_succeeds)
  • test_signUpWithPasswordWithEmailVerificationAsFirstStepAndCustomAttributes_succeeds
  • test_signUpWithPasswordWithEmailVerificationAsFirstStepAndCustomAttributesOverMultipleScreens_succeeds
  • test_signUpWithPasswordWithoutAutomaticSignIn

The following test has been removed due to be duplicated:

  • test_signInAndSendingCorrectPasswordResultsInSuccess

Type of change

  • Feature work
  • Bug fix
  • Documentation
  • Engineering change
  • Test
  • Logging/Telemetry

Risk

  • High – Errors could cause MAJOR regression of many scenarios. (Example: new large features or high level infrastructure changes)
  • Medium – Errors could cause regression of 1 or more scenarios. (Example: somewhat complex bug fixes, small new features)
  • Small – No issues are expected. (Example: Very small bug fixes, string changes, or configuration settings changes)

@diegojerezba diegojerezba added the native-auth Code related to native authentication label Jul 26, 2024
@diegojerezba diegojerezba changed the title Update E2E tests for sign-up with password Update E2E tests for sign-up with password to use lab tenant Jul 26, 2024
@diegojerezba diegojerezba marked this pull request as ready for review July 29, 2024 10:21
@diegojerezba diegojerezba requested a review from a team as a code owner July 29, 2024 10:21

let username = generateSignUpRandomEmail()
let attributes = [
"city": "Dublin",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these attributes key in a constant class? So, we can reuse them across multiple test classes without repetition.
Could you call the variables with a generic name? Something like "attribute1".
So, if we want to change the attributes, we can just change the Constant class

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, I have created an AttributesStub class

guard let sut = initialisePublicClientApplication() else {
guard
let sut = initialisePublicClientApplication(clientIdType: .passwordAndAttributes),
let password = await retrievePasswordForSignInUsername()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of retrieving the signIn password, can you just generate a random valid password? There is no need to access the key vault for those tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it makes a lot of sense. I've created a generateRandomPassword() function in MSALNativeAuthEndToEndBaseTestCase with the SSPR's technique to generate random passwords.

In this way it can also be used by the SSPR code.

@diegojerezba diegojerezba requested a review from a team as a code owner July 29, 2024 15:57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be under the "end_to_end" folder?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, my bad.

I've created a new folder called "mocks" under end_to_end, so we follow the same pattern as the unit tests (all the mocks + stubs are in the "mocks" folder)

private let attributes = ["age": 40]

// Hero Scenario 2.1.1. Sign up - with Email verification as LAST step (Email & Password)
final class MSALNativeAuthSignUpUsernameAndPasswordEndToEndTests: MSALNativeAuthEndToEndPasswordTestCase {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this class still need to extend MSALNativeAuthEndToEndPasswordTestCase and not MSALNativeAuthEndToEndBaseTestCase.swift?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@diegojerezba diegojerezba merged commit ffe6848 into dev Jul 31, 2024
10 checks passed
@diegojerezba diegojerezba deleted the diegoje/signup-pwd-e2e branch July 31, 2024 08:50
spetrescu84 added a commit that referenced this pull request Sep 10, 2024
* updating automation test to use msidlabciam6

* updating identity core

* remove logging comment

* updating common core

* update commoncore code in MSAL

* updating common core

* - Converted SSPR E2E tests to use labs tenant

* - Converted sign up + username with attributes tests to use labs tenant
- Adjusted tests description to follow acceptance criteria doc

* - Adjusted test description to match acceptance criteria doc
- Adjusted error message to keep consistency with other tests

* - Comments pointing to correct items in acceptance criteria doc
- Adjusted initial sign up call

* - Removed unused code.

* Update E2E tests for sign-up with password to use lab tenant (#2261)

* Update E2E test for sign-up with password

* Clean up comments

* PR code review. Add Attributes stub

* Stop the execution of the test if any delegate does not get called.

* PR code review

* - Using attributes stub

* - Added extra verification and early finish for tests
- Using random password generator from base test class

* - Updated submodule

* - Updated submodule

* Update E2E tests for sign-in with code to use lab tenant (#2272)

* - Tidy up

* Update submodule to dev common core

* [macOS SDK] Update macOS minimum version to 10.15 (#2220)

* Increased minimum macOS version to 10.15

* Removed all instances of if (@available(macOS 10.15, *))

* Updated CHANGELOG.md

* Corrected version

* Removed all API_AVAILABLE that were always satisfied
Removed all if (@available) that were always satisfied

* Reverted to dev IdentityCore

* New IdentityCore

* New Idenitycore

* Updated IdenityCore to correct version

* PR comments

* Latest IdentityCore

* Updated IdentityCore

* Using dev branch after merge

* Merge 1.4.2 back to dev (#2289)

* update versions and change log

* update common core after merging to main

* updating cc

* Add Native Auth E2E tests to CI. Skip Native Auth E2E tests in pr-validation if label is present (#2274)

* Add MSAL Native Auth E2E tests to the pr-validation.yml script

* Add condition to skip the NativeAuth E2E tests if label skip-native-auth-e2e-tests is included in the PR

* Add MSAL Native Auth E2E tests to the automation.yml script

* update code owner file. Add swiftlint to native auth team ownership (#2304)

* Changed Link-Time Optimization for macOS to Incremental to prevent build artifacts (#2305)

* [macOS SDK] Add Native Auth features to the macOS framework (#2216)

* Latest commit

* Reverted discarded files

* Adding missing unit tests

* Sort out warning around Swift 4.0
Fixced pob lint for extension

* Changed link-time optimization to Incremental

* Removed version from automation scrip as it's now present in MSAL.podspec (#2309)

* [macOS SDK] Add Native Auth E2E and Integration tests for macOS (#2250)

* MacOS changes to the project

* unit tests

* Added missing files to Mac Target

* Removed unit tests that don't work

* Merge dev into branch

* Add flag to fix modules and unit tests

* Last IC

* Swift to dev IC

* Add CacheAccessor for macOS for unit tests

* fix compilation error integration tests

* Set correctly URL for mock API when running end to end tests

* use same XCAssert command

* Update integration tests, do not skip tests anymore

* add new schema dedicated to E2E tests. Move E2E tests from integration to new target

* remove empty tests

* copy conf json file and add new test to check that file is loaded correctly

* retrieve OTP code from email using 1secmail

* Read info from conf.json file

* generate random email address

* Cocoapod

* Pointing IdenityCore to spetrescu/macos-version-increase

* Updated modulemap

* Latest IC

* enable first signUp email-code signUp test

* disable not runnable signup tests and fix one test

* remove not E2E tests, move password tests to dedicated class

* update input and output to build script to remove warning

* add settings to retry tests on failure, enable all possible tests

* remove not needed log in script

* update pr validation and nightly build to include E2E tests for native auth

* delete jobs redeclaration

* update schema name

* update target name

* Increased minimum macOS version to 10.15

* Create new schema dedicated to E2E tests

* execute new schema for E2E tests

* set new name for xctestrun file

* Removed all instances of if (@available(macOS 10.15, *))

* link conf.json file to target

* not run E2E tests in parallel

* test new file from secure files

* Updated CHANGELOG.md

* Corrected version

* Run E2E tests in PR validation

* fix pr-validation.yml script

* update script

* move tests execution with conf json to a template

* add jobs definition in template

* try creating a variables

* use template only for steps and not job

* fix template file reference

* remove not needed comma

* set schema name correctly

* typo

* run E2E tests using template

* use id instead of date string to sort emails, refactor email parser

* Removed commented file from modulemap
Changed how test is split between iOS and macOS

* fail the test if conf file can not be serialized

* add enum for clientId key, add more log in code retriever, generate email in codeRetriever class

* remove clientId type specification

* remove changes from build script

* remove spaces

* Ownership for new testplan and target to MSAL NativeAuth team

* Removed all API_AVAILABLE that were always satisfied
Removed all if (@available) that were always satisfied

* Reverted to dev IdentityCore

* add missing owner to file

* declare pool for each job

* Created E2E and Integration Target tests for macOS

* Test plans

* Fixed E2E macOS script

* Correct test plans

* Latest version of IdentityCore

* New tests

* Run in PR validation

* New IdentityCore

* Last IdentityCore

* Correct IdentityCore

* Correct IdentityCore

* Added to automation also

* Changed job name

* Updated for mac

* Updated folders

* Fix iOS pipeline

* Updated xctestrun name for Mac

* Changed to arm

* Fixed for current pipeline

* MacOS version for xctest
Changed path for script

* Trying new setup

* Changed how path gets created

* Fixed path

* Quotes fix

* Changed from moving to copying the file

* Add conf.json to target

* Update changelog

* Updated changelog

* Added check for macOS

* Added comment to explain why the check happens

* PR Comments

* Update to mv

* Testing with default target path

* New Idenitycore

* Point to proper IdentityCore

* Pointing to correct IdentityCore

* Updated IdenityCore to correct version

* Updated IdentityCore to correct version

* PR comments

* Latest IdentityCore

* Latest IdentityCore

* PR comments, removed null

* PR comments, reverted team

* Moved script to automation.yml

* Updated path

* Updated sdk

* Corrected path

* Set correct scheme

* Updated IdentityCore

* Latest identityCore

* Latest IdentityCore

* Updated IdentityCore

* Using dev branch after merge

* Correct Identity Core

* Added keychain access for macOS app
Reverted yml file to previous

* Update IdentityCore after merge

* Latest IC

* Reverted change to artifactName

* Latest commit

* Reverted discarded files

* Adding missing unit tests

* Sort out warning around Swift 4.0
Fixced pob lint for extension

* Changed link-time optimization to Incremental

* Latest IdentityCore

* Add macOS e2e tests to PR validation and Pipeline

* Properly escaped ( character in build.py

* Removed xcpretty temporarly

* Skipping code signature for macOS

* Transformed else if into if

* Fixed indetation

* Corrected platform name

* Added spacing

* Added command after report

* Reverted order, added xcpretty back

* Log full path
Fixed warnings

* Setting full path to fixed version

* Removed condition temporarly

* Modified pr validation also

* Added logging

* Reverted echo, added additional flags

* Logging with flags

* Added flags to PR validation also

* Modify to -

* Set codesign to Apple Developer

* Fixed synatx

* Changed codesign

* Trying with Apple development

* Revert bundle name change

* Added correct bundle back

* Removed not needed entitlements
Skipped test that requires cache

* Removed unit-test-host-mac.entitlements

* Reverted code sign

* Reverted build.py

* Removed flags from tests-with-conf-file
Added condition for macOS back

* Temp remove depends on check

* Added conditions back

* Moved e2e plans
Fixed TOOD typo

---------

Co-authored-by: Danilo Raspa <daniloraspa@microsoft.com>

* Merge latest changes from main to dev (#2314)

* update versions and change log

* update common core after merging to main

* Updating MSAL framework checksum & url for 1.4.2 [skip ci]

* Updated codeowners file

* Added package.swift to MSAL CIAM team also

---------

Co-authored-by: Veena Soman <veenasoman@microsoft.com>

* Changed files for release 1.5.0

* Merging main into release 1.5.0 (#2316)

* update versions and change log

* update common core after merging to main

* Updating MSAL framework checksum & url for 1.4.2 [skip ci]

---------

Co-authored-by: Veena Soman <veenasoman@microsoft.com>

* Latest idenittycore

---------

Co-authored-by: Fidelia Nawar <fidelia.m589@gmail.com>
Co-authored-by: Marcos Borges <marcosborges@microsoft.com>
Co-authored-by: Diego Jerez <109726904+diegojerezba@users.noreply.github.com>
Co-authored-by: Marcos Borges <116104275+borgesmb@users.noreply.github.com>
Co-authored-by: Swasti Gupta <swagup@microsoft.com>
Co-authored-by: Swasti Gupta <swastinitb@gmail.com>
Co-authored-by: Veena Soman <veenasoman@microsoft.com>
Co-authored-by: Fidelia Nawar <89487029+fidelianawar@users.noreply.github.com>
Co-authored-by: Danilo Raspa <105228698+nilo-ms@users.noreply.github.com>
Co-authored-by: Danilo Raspa <daniloraspa@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
native-auth Code related to native authentication
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants