-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: initial e2e test work with new auth mechanism
- Loading branch information
Showing
7 changed files
with
117 additions
and
72 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
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
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 |
---|---|---|
@@ -1,20 +1,25 @@ | ||
import { ApiConfig } from '@iqss/dataverse-client-javascript/dist/core' | ||
import { DataverseApiHelper } from './DataverseApiHelper' | ||
import { DataverseApiAuthMechanism } from '@iqss/dataverse-client-javascript/dist/core/infra/repositories/ApiConfig' | ||
import { UserJSDataverseRepository } from '../../../src/users/infrastructure/repositories/UserJSDataverseRepository' | ||
import { DatasetHelper } from './datasets/DatasetHelper' | ||
import { DATAVERSE_BACKEND_URL } from '../../../src/config' | ||
|
||
export class TestsUtils { | ||
static readonly DATAVERSE_BACKEND_URL = DATAVERSE_BACKEND_URL | ||
|
||
static setup() { | ||
ApiConfig.init(`${this.DATAVERSE_BACKEND_URL}/api/v1`, DataverseApiAuthMechanism.SESSION_COOKIE) | ||
ApiConfig.init(`${this.DATAVERSE_BACKEND_URL}/api/v1`, DataverseApiAuthMechanism.BEARER_TOKEN) | ||
DataverseApiHelper.setup() | ||
} | ||
|
||
static login() { | ||
return cy.loginAsAdmin() // TODO - Replace with an ajax call to the API | ||
return cy.loginAsAdmin() | ||
} | ||
|
||
static enterCredentialsInKeycloak() { | ||
cy.get('#username').type('[email protected]') | ||
cy.get('#password').type('admin') | ||
cy.get('#kc-login').click() | ||
} | ||
|
||
static wait(ms: number): Promise<void> { | ||
|
@@ -24,7 +29,7 @@ export class TestsUtils { | |
} | ||
|
||
static logout() { | ||
return new UserJSDataverseRepository().removeAuthenticated() | ||
return cy.logout() | ||
} | ||
|
||
static async waitForNoLocks(persistentId: string, maxRetries = 20, delay = 1000): Promise<void> { | ||
|
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