From dfff64b847a744cffdc860c143b96ff8ad6bb6d4 Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Thu, 2 Mar 2023 15:17:17 +0000 Subject: [PATCH] Add firstApp creation to public api tests --- .../public-api/TestConfiguration/accountsAPIClient.ts | 3 --- .../public-api/TestConfiguration/applications.ts | 11 +++++++++++ .../src/config/public-api/TestConfiguration/auth.ts | 2 +- .../src/config/public-api/TestConfiguration/index.ts | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/qa-core/src/config/public-api/TestConfiguration/accountsAPIClient.ts b/qa-core/src/config/public-api/TestConfiguration/accountsAPIClient.ts index f009084f0c..44b69aa247 100644 --- a/qa-core/src/config/public-api/TestConfiguration/accountsAPIClient.ts +++ b/qa-core/src/config/public-api/TestConfiguration/accountsAPIClient.ts @@ -48,11 +48,8 @@ class AccountsAPIClient { response.status == 400 ) { console.error("Error in apiCall") - console.error("Response:") console.error(response) - console.error("Response body:") console.error(response.body) - console.error("Request body:") console.error(requestOptions.body) } return response diff --git a/qa-core/src/config/public-api/TestConfiguration/applications.ts b/qa-core/src/config/public-api/TestConfiguration/applications.ts index ab25930544..56b0b70795 100644 --- a/qa-core/src/config/public-api/TestConfiguration/applications.ts +++ b/qa-core/src/config/public-api/TestConfiguration/applications.ts @@ -63,4 +63,15 @@ export default class AppApi { const response = await this.api.post(`/applications/${id}/unpublish`) return [response] } + + async createFirstApp() { + const body = { + name: "My first app", + url: "my-first-app", + useTemplate: false, + sampleData: true, + } + const response = await this.api.post("/applications", { body }) + expect(response).toHaveStatusCode(200) + } } diff --git a/qa-core/src/config/public-api/TestConfiguration/auth.ts b/qa-core/src/config/public-api/TestConfiguration/auth.ts index b832d6f7f9..ceb10b8bfc 100644 --- a/qa-core/src/config/public-api/TestConfiguration/auth.ts +++ b/qa-core/src/config/public-api/TestConfiguration/auth.ts @@ -24,7 +24,7 @@ export default class AuthApi { async login(email: String, password: String): Promise<[Response, any]> { const response = await this.api.post(`/auth/login`, { body: { - username: email, + email: email, password: password, }, }) diff --git a/qa-core/src/config/public-api/TestConfiguration/index.ts b/qa-core/src/config/public-api/TestConfiguration/index.ts index 259742d7c3..fc2d2fd572 100644 --- a/qa-core/src/config/public-api/TestConfiguration/index.ts +++ b/qa-core/src/config/public-api/TestConfiguration/index.ts @@ -43,6 +43,7 @@ export default class TestConfiguration { await this.accounts.create(account) await this.updateApiClients(account.tenantName) await this.auth.login(account.email, account.password) + await this.applications.createFirstApp() } async setApiKey() {