Skip to content

Commit

Permalink
Merge pull request #2061 from ita-social-projects/refactor-addClub-test
Browse files Browse the repository at this point in the history
Refactor addClub test
  • Loading branch information
softservedata authored Dec 9, 2023
2 parents 7b0afae + a072da0 commit e858847
Show file tree
Hide file tree
Showing 3 changed files with 422 additions and 275 deletions.
36 changes: 34 additions & 2 deletions src/test/playwright/constants/api.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,47 @@ export const CREATE_CLUB_REQUEST = {
method: "POST",
body: {
categoriesName: ["Акторська майстерність, театр", "Центр розвитку", "Програмування, робототехніка, STEM"],
name: "Test Automation club new",
name: "Test Request Club",
ageFrom: 10,
ageTo: 18,
description:
'{"blocks":[{"key":"brl63","text":"This is a test description for a new club. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',
userId: "1",
locations: [
{
name: "Automation City",
name: "Test Request Location",
cityName: "Дніпро",
districtName: "Амур-Нижньодніпровський",
stationName: "Метробудівників",
address: "Volodymyra Velykoho str.",
coordinates: "49.790387, 24.028195",
phone: "0671834956",
key: 0.112830686973181,
},
],
urlLogo: "/upload/club/logos/clubLogo.jpg",
urlBackground: "/upload/club/backgrounds/cover.png",
urlGallery: ["/upload/club/galleries/galery.jpg"],
contacts:
'{"1"::"1236547891","2"::"someFacebook","3"::"someWhatsUp","4"::"testEmail@gmail.com","6"::"testWebPage.com"}',
centerId: 1,
},
};

export const CREATE_CLUB_REQUEST_2 = {
url: "http://localhost:8080/dev/api/club",
method: "POST",
body: {
categoriesName: ["Акторська майстерність, театр", "Центр розвитку", "Програмування, робототехніка, STEM"],
name: "Test Request Second",
ageFrom: 10,
ageTo: 18,
description:
'{"blocks":[{"key":"brl63","text":"This is a test description for a new club. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}],"entityMap":{}}',
userId: "1",
locations: [
{
name: "Test Request Location 2",
cityName: "Дніпро",
districtName: "Амур-Нижньодніпровський",
stationName: "Метробудівників",
Expand Down
3 changes: 1 addition & 2 deletions src/test/playwright/services/ApiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { expect} from "@playwright/test";
import { ADMIN_EMAIL, ADMIN_PASSWORD, USER_EMAIL, USER_PASSWORD } from "../constants/general.constants";
import {SIGN_IN_URL, CREATE_CLUB_REQUEST , USERS_CLUBS, CREATE_CHALLENGE_REQUEST_2, CREATE_TASK_REQUEST, GET_CHALLENGES_REQUEST, GET_TASK_REQUEST} from "../constants/api.constants";


class ApiService {
constructor(page) {
this.page = page;
Expand Down Expand Up @@ -59,7 +58,7 @@ class ApiService {
return responseJson.totalPages;
}

async createNewClub() {
async createNewClub(CREATE_CLUB_REQUEST) {
const response = await fetch(CREATE_CLUB_REQUEST.url, {
method: CREATE_CLUB_REQUEST.method,
body: JSON.stringify(CREATE_CLUB_REQUEST.body),
Expand Down
Loading

0 comments on commit e858847

Please sign in to comment.