diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 9c277af..406f95c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -7,11 +7,11 @@ name: Docker deploy on: push: - branches: [ "development_2.1" ] + branches: [ "development_2.1", "release/2.x-fixes" ] # Publish semver tags as releases. tags: [ 'v*.*.*' ] pull_request: - branches: [ "development_2.1" ] + branches: [ "development_2.1", "release/2.x-fixes" ] env: REGISTRY: ghcr.io diff --git a/build.sh b/build.sh index 7565aeb..b519acd 100644 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/bin/sh -npm run build & +npm run dockerize & pid=$! sleep 90 kill -9 $pid diff --git a/e2e-tests/pages/AccessPermissionsTab.ts b/e2e-tests/pages/AccessPermissionsTab.ts index a033183..f396a31 100644 --- a/e2e-tests/pages/AccessPermissionsTab.ts +++ b/e2e-tests/pages/AccessPermissionsTab.ts @@ -7,29 +7,28 @@ export class AccessPermissionsTab extends BasePage { } private get usernameInput() { - return this.page.getByRole('textbox', { name: 'Username' }); + return this.page.getByLabel('Select User'); } private get roleInput() { - return this.page.getByRole('textbox', { name: 'Role' }); + return this.page.getByLabel('Assign Role'); } private get addButton() { - return this.page.getByRole('Button', {name: 'add'}); + return this.page.getByRole('button', { name: 'Grant Access' }); } async addPermission(username: string, role: string) { + await this.usernameInput.click(); await this.usernameInput.fill(username); await this.page.getByRole('option', { name: username }).click(); await this.roleInput.click(); await this.page.getByRole("option", {name: role}).click(); - await this.addButton.click(); await expect(this.page.getByRole("cell", {name: username})).toBeVisible(); await expect(this.page.getByRole("cell", {name: role})).toBeVisible(); - } } diff --git a/e2e-tests/pages/ActivityPage.ts b/e2e-tests/pages/ActivityPage.ts index dea4409..718762b 100644 --- a/e2e-tests/pages/ActivityPage.ts +++ b/e2e-tests/pages/ActivityPage.ts @@ -7,7 +7,7 @@ export class ActivityPage extends BasePage { } private get createButton() { - return this.page.getByRole('button', { name: 'Create' }); + return this.page.getByRole('button', { name: 'Create new activity' }); } private get nameInput() { @@ -23,7 +23,7 @@ export class ActivityPage extends BasePage { } private get createActivityButton() { - return this.page.getByRole('button', { name: 'Create new activity' }); + return this.page.getByRole('button', { name: 'Create activity' }); } diff --git a/e2e-tests/pages/DatasetCreatePage.ts b/e2e-tests/pages/DatasetCreatePage.ts index a777a10..1308cd5 100644 --- a/e2e-tests/pages/DatasetCreatePage.ts +++ b/e2e-tests/pages/DatasetCreatePage.ts @@ -3,6 +3,7 @@ import { BasePage } from './BasePage'; export class DatasetCreatePage extends BasePage { async visit(): Promise { await this.page.goto('/datasets/create'); + await this.page.waitForLoadState('networkidle'); await this.waitForPageLoad(); } diff --git a/e2e-tests/pages/DatasetListPage.ts b/e2e-tests/pages/DatasetListPage.ts index 24ad7c1..d48c933 100644 --- a/e2e-tests/pages/DatasetListPage.ts +++ b/e2e-tests/pages/DatasetListPage.ts @@ -22,8 +22,8 @@ export class DatasetListPage extends BasePage { await expect(card).toContainText(dataset.name); await expect(card).toContainText(dataset.creator); await expect(card).toContainText(dataset.rights); - await expect(card).toContainText(dataset.date); - await expect(card).toContainText(dataset.description); + // await expect(card).toContainText(dataset.date); + // await expect(card).toContainText(dataset.description); } async useAnyDataset(): Promise { diff --git a/e2e-tests/pages/ExperimentPage.ts b/e2e-tests/pages/ExperimentPage.ts index 3431757..d06ab2f 100644 --- a/e2e-tests/pages/ExperimentPage.ts +++ b/e2e-tests/pages/ExperimentPage.ts @@ -29,7 +29,7 @@ export class ExperimentPage extends BasePage { } private get createExperimentButton() { - return this.page.getByRole('button', { name: 'Create new experiment' }); + return this.page.getByRole('button', { name: 'Create experiment' }); } async visit(): Promise { diff --git a/e2e-tests/pages/LoginPage.ts b/e2e-tests/pages/LoginPage.ts index 64faaf3..61b2a74 100644 --- a/e2e-tests/pages/LoginPage.ts +++ b/e2e-tests/pages/LoginPage.ts @@ -3,11 +3,11 @@ import { BasePage } from './BasePage'; export class LoginPage extends BasePage { private get loginInput() { - return this.page.getByLabel('Username or email'); + return this.page.getByPlaceholder('Username or email'); } private get passwordInput() { - return this.page.getByLabel('Password'); + return this.page.getByPlaceholder('Password'); } private get loginButton() { @@ -16,6 +16,7 @@ export class LoginPage extends BasePage { async visit(): Promise { await this.page.goto('/'); + await this.page.waitForURL('http://localhost:8090/**'); await this.waitForPageLoad(); } diff --git a/e2e-tests/pages/ParticipantCreatePage.ts b/e2e-tests/pages/ParticipantCreatePage.ts index b4239d6..05b21b8 100644 --- a/e2e-tests/pages/ParticipantCreatePage.ts +++ b/e2e-tests/pages/ParticipantCreatePage.ts @@ -40,7 +40,7 @@ export class ParticipantCreatePage extends BasePage { } async fillParticipantForm({ name, surname, birthDate, sex }) { - await this.nameInput.fill(name); + await this.nameInput.fill(`${ name } ${ surname }`); await this.surnameInput.fill(surname); await this.selectDate(birthDate); await this.selectSex(sex); diff --git a/e2e-tests/pages/ParticipantsTab.ts b/e2e-tests/pages/ParticipantsTab.ts index 42b592e..ec54305 100644 --- a/e2e-tests/pages/ParticipantsTab.ts +++ b/e2e-tests/pages/ParticipantsTab.ts @@ -9,6 +9,6 @@ export class ParticipantsTab extends BasePage { await this.page.getByTestId('experiment-participant-add-button').click(); await this.page.getByLabel('Participant').click(); await this.page.locator(`div[role="option"]:has-text("${ participantName }")`).first().click(); - await this.page.getByRole('dialog').getByRole('button', { name: 'Add' }).click(); + await this.page.getByRole('dialog').getByRole('button', { name: 'Assign to experiment' }).click(); } } diff --git a/e2e-tests/pages/RecordingsTab.ts b/e2e-tests/pages/RecordingsTab.ts index d774e05..625b50f 100644 --- a/e2e-tests/pages/RecordingsTab.ts +++ b/e2e-tests/pages/RecordingsTab.ts @@ -5,27 +5,21 @@ export class RecordingsTab extends BasePage { await this.page.getByRole('tab', { name: 'Recordings' }).click(); } - async addRecording({ scenarioExecutionName, activityExecutionName, name, description, link, channel, participant }): Promise { - await this.page.getByRole('button', { name: 'Create' }).click(); - + async addRecording({ scenarioExecutionName, activityExecutionName, name, description, filePath, channel, participant }): Promise { + await this.page.getByRole('button', { name: 'Create New Recording' }).click(); await this.page.getByLabel('Scenario Executions').click(); - await this.page.locator('div[role="option"]').filter({ hasText: scenarioExecutionName }).first().click(); - + await this.page.getByRole('option', { name: scenarioExecutionName }).click(); await this.page.getByLabel('Activity Execution').click(); - await this.page.locator('div[role="option"]').filter({ hasText: activityExecutionName }).first().click(); - + await this.page.getByRole('option', { name: activityExecutionName }).click(); + await this.page.getByLabel('Name').click(); await this.page.getByLabel('Name').fill(name); - + await this.page.getByLabel('Description').click(); await this.page.getByLabel('Description').fill(description); - - await this.page.getByLabel('Link').fill(link); - await this.page.getByLabel('Channel').click(); - await this.page.locator('div[role="option"]').filter({ hasText: channel }).first().click(); - + await this.page.getByRole('option', { name: channel }).click(); await this.page.getByLabel('Participants').click(); - await this.page.locator('div[role="option"]').filter({ hasText: participant }).first().click(); - - await this.page.getByRole('button', { name: 'Create' }).click(); + await this.page.getByRole('option', { name: participant }).click(); + await this.page.getByRole('button', { name: 'Create Recording' }).click(); + await this.page.waitForURL('/experiments/**'); } } diff --git a/e2e-tests/pages/RegistrationPage.ts b/e2e-tests/pages/RegistrationPage.ts index 8802416..263d1c8 100644 --- a/e2e-tests/pages/RegistrationPage.ts +++ b/e2e-tests/pages/RegistrationPage.ts @@ -4,7 +4,8 @@ import { BasePage } from './BasePage'; export class RegistrationPage extends BasePage { async visit(): Promise { await this.page.goto('/'); - await this.createAccountButton.click(); + await this.page.waitForLoadState('networkidle'); + await this.page.getByRole('link', { name: 'Create Account' }).click(); await this.waitForPageLoad(); } diff --git a/e2e-tests/pages/ScenariosExecutionsTab.ts b/e2e-tests/pages/ScenariosExecutionsTab.ts index ae0bc48..096256e 100644 --- a/e2e-tests/pages/ScenariosExecutionsTab.ts +++ b/e2e-tests/pages/ScenariosExecutionsTab.ts @@ -36,4 +36,20 @@ export class ScenariosExecutionsTab extends BasePage { await this.page.locator(`div[role="option"]:has-text("${ participantName }")`).first().click(); await this.page.getByRole('button', { name: 'Update' }).click(); } + + async useTimeSeriesForAnyParticipant({ scenarioExecution, activityExecution }): Promise { + await this.visit(); + await this.waitForPageLoad(); + await this.page.getByRole('button').filter({ hasText: scenarioExecution }).first().click(); + await this.page.getByText(activityExecution).first().click(); + await this.page.getByRole('button', { name: 'Time Series' }).click(); + } + + async useAnyTimeSeriesView(): Promise { + await this.visit(); + await this.waitForPageLoad(); + await this.page.locator('[test-data="scenario-execution-title"]').first().click(); + await this.page.locator('[test-title-data="activity-execution-title"]').first().click(); + await this.page.getByRole('button', { name: 'Time Series' }).click(); + } } diff --git a/e2e-tests/pages/TimeSeriesCreatePage.ts b/e2e-tests/pages/TimeSeriesCreatePage.ts index 0329c01..96219a8 100644 --- a/e2e-tests/pages/TimeSeriesCreatePage.ts +++ b/e2e-tests/pages/TimeSeriesCreatePage.ts @@ -28,15 +28,17 @@ // }); import { BasePage } from './BasePage'; -import { Locator } from '@playwright/test'; +import { expect, Locator } from '@playwright/test'; export class TimeSeriesCreatePage extends BasePage { async visit(): Promise { - await this.page.goto('/experiments/67d6ff5e3075786c4f00bc00/activity-executions/67d7025913cc6dc06528d475/participants/67d6fdc14a5301c720455c97/time-series'); - await this.page.goto('/experiments/67d6ff5e3075786c4f00bc00/activity-executions/67d7025913cc6dc06528d475/participants/67d6fdc14a5301c720455c97/time-series/create'); await this.waitForPageLoad(); } + async openForm(): Promise { + await this.page.getByRole('button', { name: 'Create New Time Series' }).click(); + } + private get linkInput(): Locator { return this.page.getByLabel('Link', { exact: true }); } @@ -103,11 +105,11 @@ export class TimeSeriesCreatePage extends BasePage { } private get createButton(): Locator { - return this.page.getByRole('button', { name: 'Create' }); + return this.page.getByRole('button', { name: 'Create time series' }); } - async fillForm({ link, type, spacing, measure, recording, channel, modality, liveActivity }): Promise { - await this.linkInput.fill(link); + async fillForm({ filePath, type, spacing, measure, recording, channel, modality, liveActivity }): Promise { + await this.page.getByLabel('File input').setInputFiles(filePath); await this.selectType(type); await this.selectSpacing(spacing); await this.selectMeasure(measure); @@ -119,6 +121,6 @@ export class TimeSeriesCreatePage extends BasePage { async submitForm() { await this.createButton.click(); - await this.page.waitForURL('/experiments/67d6ff5e3075786c4f00bc00/activity-executions/67d7025913cc6dc06528d475/participants/67d6fdc14a5301c720455c97/time-series'); + await this.page.waitForURL('/experiments/**'); } } diff --git a/e2e-tests/test-files/audio_sample.wav b/e2e-tests/test-files/audio_sample.wav new file mode 100644 index 0000000..1f23f10 --- /dev/null +++ b/e2e-tests/test-files/audio_sample.wav @@ -0,0 +1 @@ +Sample audio data for testing diff --git a/e2e-tests/test-files/data_sample.csv b/e2e-tests/test-files/data_sample.csv new file mode 100644 index 0000000..c7f0a62 --- /dev/null +++ b/e2e-tests/test-files/data_sample.csv @@ -0,0 +1,4 @@ +timestamp,value,channel +2024-01-01 10:00:00,1.23,Audio +2024-01-01 10:00:01,2.34,Audio +2024-01-01 10:00:02,3.45,Audio diff --git a/e2e-tests/test-files/text_sample.txt b/e2e-tests/test-files/text_sample.txt new file mode 100644 index 0000000..204f57c --- /dev/null +++ b/e2e-tests/test-files/text_sample.txt @@ -0,0 +1 @@ +This is a sample text file for testing file uploads in the recording form. diff --git a/e2e-tests/test-files/video_sample.mp4 b/e2e-tests/test-files/video_sample.mp4 new file mode 100644 index 0000000..fdffb6a --- /dev/null +++ b/e2e-tests/test-files/video_sample.mp4 @@ -0,0 +1 @@ +Sample video data for testing diff --git a/e2e-tests/tests/process.spec.ts b/e2e-tests/tests/process.spec.ts index e5faf15..46df2c2 100644 --- a/e2e-tests/tests/process.spec.ts +++ b/e2e-tests/tests/process.spec.ts @@ -1,4 +1,5 @@ import {expect, Page, test as base} from '@playwright/test'; +import path from 'path'; import { LoginPage } from '../pages/LoginPage'; import { DatasetCreatePage } from '../pages/DatasetCreatePage'; import { DatasetListPage } from '../pages/DatasetListPage'; @@ -14,6 +15,7 @@ import { RegistrationPage } from '../pages/RegistrationPage'; import {SettingsPage} from "../pages/SettingsPage"; import {AccessPermissionsTab} from "../pages/AccessPermissionsTab"; import generateDate from '../utils/generate-date-util'; +import { TimeSeriesCreatePage } from '../pages/TimeSeriesCreatePage'; const hash = Math.random().toString(36).substring(2); @@ -42,18 +44,18 @@ const newParticipants = [ birthDate: '1992-07-01', sex: 'Male', }, - { - name: 'Emma', - surname: 'Carter', - birthDate: '1987-03-01', - sex: 'Female', - }, - { - name: 'Caroline', - surname: 'Kane', - birthDate: '1999-01-01', - sex: 'Female', - }, + // { + // name: 'Emma', + // surname: 'Carter', + // birthDate: '1987-03-01', + // sex: 'Female', + // }, + // { + // name: 'Caroline', + // surname: 'Kane', + // birthDate: '1999-01-01', + // sex: 'Female', + // }, ]; const newActivities = [ @@ -63,36 +65,36 @@ const newActivities = [ type: 'Individual', participants: ['James Anderson'], }, - { - name: 'Logging into the Learning Platform', - description: 'Participants perform a task involving logging into the Moodle e-learning platform.', - type: 'Individual', - participants: ['James Anderson'], - }, - { - name: 'Locating a Course', - description: 'Participants search for and locate a specific course on the Moodle platform.', - type: 'Individual', - participants: ['James Anderson'], - }, - { - name: 'Completing an Emotional State Questionnaire', - description: 'Participants fill out questionnaires regarding their emotional state at different points during the experiment.', - type: 'Individual', - participants: ['James Anderson'], - }, - { - name: 'Listening to a Lecture', - description: 'Participants listen to a pre-recorded lecture on an assigned topic.', - type: 'Individual', - participants: ['James Anderson'], - }, - { - name: 'Completing a Quiz', - description: 'Participants answer questions related to the material presented in the lecture.', - type: 'Individual', - participants: ['James Anderson'], - }, + // { + // name: 'Logging into the Learning Platform', + // description: 'Participants perform a task involving logging into the Moodle e-learning platform.', + // type: 'Individual', + // participants: ['James Anderson'], + // }, + // { + // name: 'Locating a Course', + // description: 'Participants search for and locate a specific course on the Moodle platform.', + // type: 'Individual', + // participants: ['James Anderson'], + // }, + // { + // name: 'Completing an Emotional State Questionnaire', + // description: 'Participants fill out questionnaires regarding their emotional state at different points during the experiment.', + // type: 'Individual', + // participants: ['James Anderson'], + // }, + // { + // name: 'Listening to a Lecture', + // description: 'Participants listen to a pre-recorded lecture on an assigned topic.', + // type: 'Individual', + // participants: ['James Anderson'], + // }, + // { + // name: 'Completing a Quiz', + // description: 'Participants answer questions related to the material presented in the lecture.', + // type: 'Individual', + // participants: ['James Anderson'], + // }, // { // name: 'Listening to a Lecture', // description: 'Participants listen to a lecture on an assigned topic.', @@ -118,10 +120,10 @@ const newScenarioExecutions = [ scenarioName: newScenario.name, executionName: 'ex-01', }, - { - scenarioName: newScenario.name, - executionName: 'ex-02', - }, + // { + // scenarioName: newScenario.name, + // executionName: 'ex-02', + // }, ]; @@ -131,73 +133,52 @@ const newRecordings = [ activityExecutionName: 'Activity Execution: 1', name: 'Audio Recording 1', description: 'Audio recording for individual activity execution 1.', - link: 'https://www.test.com', + filePath: path.join(__dirname, '../test-files/audio_sample.wav'), channel: 'Audio', participant: 'James Anderson', }, - { - scenarioExecutionName: 'ex-01', - activityExecutionName: 'Activity Execution: 2', - name: 'BVP Recording 2', - description: 'BVP recording for individual activity execution 2.', - link: 'https://www.test.com', - channel: 'BVP', - participant: 'James Anderson', - }, - { - scenarioExecutionName: 'ex-01', - activityExecutionName: 'Activity Execution: 3', - name: 'ECG Recording 3', - description: 'ECG recording for individual activity execution 3.', - link: 'https://www.test.com', - channel: 'ECG', - participant: 'James Anderson', - }, - { - scenarioExecutionName: 'ex-01', - activityExecutionName: 'Activity Execution: 4', - name: 'EDA Recording 4', - description: 'EDA recording for individual activity execution 4.', - link: 'https://www.test.com', - channel: 'EDA', - participant: 'James Anderson', - }, - { - scenarioExecutionName: 'ex-01', - activityExecutionName: 'Activity Execution: 5', - name: 'Depth Video 5', - description: 'Depth video recording for individual activity 5.', - link: 'https://www.test.com', - channel: 'Depth video', - participant: 'James Anderson', - }, - { - scenarioExecutionName: 'ex-01', - activityExecutionName: 'Activity Execution: 6', - name: 'RGB Video 6', - description: 'RGB video recording for individual activity 6.', - link: 'https://www.test.com', - channel: 'RGB video', - participant: 'James Anderson', - }, // { // scenarioExecutionName: 'ex-01', - // activityExecutionName: 'Activity Execution: 7', - // name: 'Group EEG Recording 7', - // description: 'EEG recording for group activity with three participants.', - // link: 'https://www.test.com', - // channel: 'EEG', - // participant: 'James Anderson, Emma Carter, Caroline Kane', + // activityExecutionName: 'Activity Execution: 2', + // name: 'BVP Recording 2', + // description: 'BVP recording for individual activity execution 2.', + // filePath: path.join(__dirname, '../test-files/data_sample.csv'), + // channel: 'BVP', + // participant: 'James Anderson', // }, // { // scenarioExecutionName: 'ex-01', - // activityExecutionName: 'Activity Execution: 8', - // name: 'Temperature Recording 8', - // description: 'Temperature recording for two-person activity.', - // link: 'https://www.test.com', - // channel: 'Temperature', - // participant: 'James Anderson, Emma Carter', + // activityExecutionName: 'Activity Execution: 3', + // name: 'ECG Recording 3', + // description: 'ECG recording for individual activity execution 3.', + // filePath: path.join(__dirname, '../test-files/text_sample.txt'), + // channel: 'ECG', + // participant: 'James Anderson', // }, + // { + // scenarioExecutionName: 'ex-01', + // activityExecutionName: 'Activity Execution: 4', + // name: 'EDA Recording 4', + // description: 'EDA recording for individual activity execution 4.', + // filePath: path.join(__dirname, '../test-files/video_sample.mp4'), + // channel: 'EDA', + // participant: 'James Anderson', + // }, +]; + +const newTimeSeries = [ + { + scenarioExecution: 'ex-01', + activityExecution: 'Activity Execution: 1', + filePath: path.join(__dirname, '../test-files/audio_sample.wav'), + type: 'Epoch', + spacing: 'Regular', + measure: 'Sadness', + recording: 'Audio Recording 1', + channel: 'Audio', + modality: 'Prosody of speech', + liveActivity: 'Sound', + } ]; const username = `${ hash }`; @@ -288,7 +269,7 @@ test.describe.serial('Przejście całego procesu', () => { for (const newParticipant of newParticipants) { const participantsTab = new ParticipantsTab(userPage); await participantsTab.visit(); - await participantsTab.addParticipant(`${ newParticipant.surname } ${ newParticipant.name }`); + await participantsTab.addParticipant(`${ newParticipant.name } ${ newParticipant.surname }`); await expect(userPage.getByRole('cell', { name: newParticipant.name }).first()).toBeVisible(); } }); @@ -351,7 +332,16 @@ test.describe.serial('Przejście całego procesu', () => { }); test('[10] - Użytkownik tworzy szeregi czasowe', async ({ userPage }) => { - // TODO: przenieść testy z time-series.spec.ts + await selectDataset(userPage); + await (new ExperimentListPage(userPage)).useExperimentByName(newExperiment.name); + + for (const timeSeries of newTimeSeries) { + await (new ScenariosExecutionsTab(userPage)).useTimeSeriesForAnyParticipant(timeSeries); + const timeSeriesCreatePage = new TimeSeriesCreatePage(userPage); + await timeSeriesCreatePage.openForm(); + await timeSeriesCreatePage.fillForm(timeSeries); + await timeSeriesCreatePage.submitForm(); + } }); test('[11] - Inny użytkownik rejestruje konto', async ({ page }) => { @@ -368,7 +358,7 @@ test.describe.serial('Przejście całego procesu', () => { await accessPermissionsTab.addPermission(usernameOther, 'Reader'); }); - test('[13] - Inny użytkonik nie może tworzyć eksperymentu', async ({ otherUserPage }) => { + test('[13] - Inny użytkownik nie może tworzyć eksperymentu', async ({ otherUserPage }) => { await selectDataset(otherUserPage); const experimentPage = new ExperimentPage(otherUserPage); @@ -376,7 +366,7 @@ test.describe.serial('Przejście całego procesu', () => { await expect(otherUserPage.getByRole('Button', { name: 'Create' }).first()).toHaveCount(0); }); - test('[14] - Inny użytkonik nie może edytować składowych eksperymentu', async ({ otherUserPage }) => { + test('[14] - Inny użytkownik nie może edytować składowych eksperymentu', async ({ otherUserPage }) => { await selectDataset(otherUserPage); await (new ExperimentListPage(otherUserPage)).useExperimentByName(newExperiment.name); diff --git a/e2e-tests/tests/time-series.spec.ts b/e2e-tests/tests/time-series.spec.ts index 596ef2a..a7dde84 100644 --- a/e2e-tests/tests/time-series.spec.ts +++ b/e2e-tests/tests/time-series.spec.ts @@ -1,19 +1,22 @@ +import path from 'path'; import { test, expect } from '@playwright/test'; import { LoginPage } from '../pages/LoginPage'; import { DatasetListPage } from '../pages/DatasetListPage'; import { TimeSeriesCreatePage } from '../pages/TimeSeriesCreatePage'; import { ExperimentListPage } from '../pages/ExperimentListPage'; +import { ScenariosExecutionsTab } from '../pages/ScenariosExecutionsTab'; test.beforeEach(async ({ page }) => { await new LoginPage(page).loggedInAsDefaultUser(); await new DatasetListPage(page).usingAnyDataset(); - await new ExperimentListPage(page).useExperimentByName('Nyssa Rivas'); + await new ExperimentListPage(page).usingAnyExperiment(); + await new ScenariosExecutionsTab(page).useAnyTimeSeriesView(); }); test('Użytkownik może utworzyć nowy szeregi czasowe', async ({ page }) => { const activityData = [ { - link: 'https://www.test2.com', + filePath: path.join(__dirname, '../test-files/audio_sample.wav'), type: 'Epoch', spacing: 'Regular', measure: 'Sadness', @@ -96,7 +99,7 @@ test('Użytkownik może utworzyć nowy szeregi czasowe', async ({ page }) => { for (const timeSeriesData of activityData) { const timeSeriesCreatePage = new TimeSeriesCreatePage(page); - await timeSeriesCreatePage.visit(); + await timeSeriesCreatePage.openForm(); await timeSeriesCreatePage.fillForm(timeSeriesData); await timeSeriesCreatePage.submitForm(); diff --git a/entrypoint.sh b/entrypoint.sh index 0b790e2..4759c62 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,11 +8,11 @@ echo "Replacing env constants in JS" for file in $ROOT_DIR/js/*.js $ROOT_DIR/index.html; do echo "Processing $file ..."; - sed -i 's|VUE_APP_API_URL|'"${VUE_APP_API_URL}"'|g' $file - sed -i 's|VUE_APP_AUTH_MS_URL|'"${VUE_APP_AUTH_MS_URL}"'|g' $file - sed -i 's|VUE_APP_KEYCLOAK_URL|'"${VUE_APP_KEYCLOAK_URL}"'|g' $file - sed -i 's|VUE_APP_KEYCLOAK_CLIENT_ID|'"${VUE_APP_KEYCLOAK_CLIENT_ID}"'|g' $file - sed -i 's|VUE_APP_KEYCLOAK_REALM|'"${VUE_APP_KEYCLOAK_REALM}"'|g' $file + sed -i 's|__VUE_APP_API_URL__|'"${VUE_APP_API_URL}"'|g' $file + sed -i 's|__VUE_APP_AUTH_MS_URL__|'"${VUE_APP_AUTH_MS_URL}"'|g' $file + sed -i 's|__VUE_APP_KEYCLOAK_URL__|'"${VUE_APP_KEYCLOAK_URL}"'|g' $file + sed -i 's|__VUE_APP_KEYCLOAK_CLIENT_ID__|'"${VUE_APP_KEYCLOAK_CLIENT_ID}"'|g' $file + sed -i 's|__VUE_APP_KEYCLOAK_REALM__|'"${VUE_APP_KEYCLOAK_REALM}"'|g' $file done echo "Finished replacing" diff --git a/package.json b/package.json index 69f863c..01d14dc 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", + "dockerize": "VUE_APP_API_URL=__VUE_APP_API_URL__ VUE_APP_AUTH_MS_URL=__VUE_APP_AUTH_MS_URL__ VUE_APP_KEYCLOAK_URL=__VUE_APP_KEYCLOAK_URL__ VUE_APP_KEYCLOAK_CLIENT_ID=__VUE_APP_KEYCLOAK_CLIENT_ID__ VUE_APP_KEYCLOAK_REALM=__VUE_APP_KEYCLOAK_REALM__ vue-cli-service build", "lint": "vue-cli-service lint", "test": "npx playwright test" }, diff --git a/playwright.config.ts b/playwright.config.ts index 504fa84..1065b77 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -25,17 +25,19 @@ export default defineConfig({ workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: 'html', - timeout: 30 * 1000, + timeout: 60 * 1000, /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL: 'http://localhost:8080', + baseURL: 'http://localhost:3000', /* Use saved authentication state */ - storageState: './e2e-tests/auth-state.json', + // storageState: './e2e-tests/auth-state.json', /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', + screenshot: 'only-on-failure', + video: 'retain-on-failure' }, /* Configure projects for major browsers */ diff --git a/src/api/DatasetAPI.js b/src/api/DatasetAPI.js index 4469d4b..2e38e25 100644 --- a/src/api/DatasetAPI.js +++ b/src/api/DatasetAPI.js @@ -18,6 +18,7 @@ export default class extends BaseAPI2 { rights: data.rights, date: data.date, description: data.description, + create_default_entities: data.create_default_entities, additional_properties: data.additional_properties, }; } @@ -30,6 +31,7 @@ export default class extends BaseAPI2 { rights: data.rights, date: data.date, description: data.description, + create_default_entities: data.create_default_entities, additional_properties: data.additional_properties, parameters: data.parameters, }; diff --git a/src/api/LifeActivitiesAPI.js b/src/api/LifeActivitiesAPI.js index 245c6b2..fd13a88 100644 --- a/src/api/LifeActivitiesAPI.js +++ b/src/api/LifeActivitiesAPI.js @@ -6,13 +6,14 @@ export default class extends BaseAPI2 { return DatabaseName.LIFE_ACTIVITIES; } - static dTOFrontToAPI(data){ + static dTOFrontToAPI(data) { return { life_activity: data.name, + external_id: data.external_id, }; } - static dTOAPIToFront(data){ + static dTOAPIToFront(data) { const formated = data.life_activity.charAt(0).toUpperCase() + data.life_activity.slice(1) || ''; return { id: data.id, diff --git a/src/components/ActivityExecutionsListingComponent.vue b/src/components/ActivityExecutionsListingComponent.vue index 93b806c..ac9d007 100644 --- a/src/components/ActivityExecutionsListingComponent.vue +++ b/src/components/ActivityExecutionsListingComponent.vue @@ -5,7 +5,10 @@ :show-expand="true" > @@ -19,6 +22,14 @@ + mdi-plus - Add Participant + Assign to experiment @@ -135,9 +133,13 @@ + diff --git a/src/components/DatasetCreateDialog.vue b/src/components/DatasetCreateDialog.vue index c981612..c9b3f39 100644 --- a/src/components/DatasetCreateDialog.vue +++ b/src/components/DatasetCreateDialog.vue @@ -110,6 +110,14 @@ prepend-inner-icon="mdi-text" rows="4" /> + + @@ -210,6 +218,7 @@ export default { rights: '', date: new Date().toISOString().substr(0, 10), description: '', + create_default_entities: true, }, dateModal: false, loading: false, @@ -300,6 +309,11 @@ export default { localStorage.setItem('token', permissionResponse.data.token); localStorage.setItem('tokenExpiration', this.tokenExpiration); + + // Refresh permissions in store + const permissionsResponse = await PermissionsService.getUserPermissions(this.user.sub); + this.$store.commit('setPermissions', permissionsResponse.data); + this.$emit('dataset-created', data); } @@ -333,7 +347,8 @@ export default { this.dataset.creator !== this.originalDataset.creator || this.dataset.rights !== this.originalDataset.rights || this.dataset.date !== this.originalDataset.date || - this.dataset.description !== this.originalDataset.description + this.dataset.description !== this.originalDataset.description || + this.dataset.create_default_entities !== this.originalDataset.create_default_entities ); } else { // In create mode, check if any field has content @@ -354,6 +369,7 @@ export default { rights: '', date: new Date().toISOString().substr(0, 10), description: '', + create_default_entities: true, }; this.originalDataset = null; } diff --git a/src/components/DatasetListCard.vue b/src/components/DatasetListCard.vue index 423a29a..a721f72 100644 --- a/src/components/DatasetListCard.vue +++ b/src/components/DatasetListCard.vue @@ -20,6 +20,7 @@

{{ dataset.name }}

diff --git a/src/components/ExportCard.vue b/src/components/ExportCard.vue index 246d524..495e0f5 100644 --- a/src/components/ExportCard.vue +++ b/src/components/ExportCard.vue @@ -137,7 +137,10 @@ {{ exportJob.status }} -
+
diff --git a/src/components/ParticipantCreateDialog.vue b/src/components/ParticipantCreateDialog.vue index cfdac22..0d527bd 100644 --- a/src/components/ParticipantCreateDialog.vue +++ b/src/components/ParticipantCreateDialog.vue @@ -97,6 +97,11 @@ placeholder="Enter disorder (optional)" prepend-inner-icon="mdi-medical-bag" /> + + @@ -171,9 +176,13 @@ - + \ No newline at end of file + diff --git a/src/views/measures/MeasuresView.vue b/src/views/measures/MeasuresView.vue index 9973c9c..53e268e 100644 --- a/src/views/measures/MeasuresView.vue +++ b/src/views/measures/MeasuresView.vue @@ -5,9 +5,9 @@ - \ No newline at end of file diff --git a/src/views/participants/components/ParticipantEditDialog.vue b/src/views/participants/components/ParticipantEditDialog.vue index 420e5a8..950c869 100644 --- a/src/views/participants/components/ParticipantEditDialog.vue +++ b/src/views/participants/components/ParticipantEditDialog.vue @@ -1,6 +1,6 @@ - + - @@ -104,9 +105,9 @@ - {{ isEditMode ? 'Update' : 'Create' }} + {{ isEditMode ? 'Update' : 'Create Scenario' }} diff --git a/src/views/settings/tabs/AccessPermissionsTab.vue b/src/views/settings/tabs/AccessPermissionsTab.vue index a02cbc1..8d67e49 100644 --- a/src/views/settings/tabs/AccessPermissionsTab.vue +++ b/src/views/settings/tabs/AccessPermissionsTab.vue @@ -70,6 +70,7 @@ outlined prepend-inner-icon="mdi-account" return-object + item-text="username" >