Skip to content

Commit

Permalink
Merge branch 'off-cycle-release'
Browse files Browse the repository at this point in the history
  • Loading branch information
billy clark committed Nov 22, 2022
2 parents 29aca5e + 4cc056a commit 22487e4
Show file tree
Hide file tree
Showing 40 changed files with 382 additions and 201 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# The .dockerignore file excludes files from the container build process.
#
# https://docs.docker.com/engine/reference/builder/#dockerignore-file

# Exclude locally vendored dependencies.
src/vendor/

# Exclude "build-time" ignore files.
.dockerignore

# Exclude git history and configuration.
.gitignore
.git
3 changes: 2 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ Please provide screenshots / animations for any change that involves the UI. Ple
## Checklist

- [ ] I have performed a self-review of my own code
- [ ] I have reviewed the title/description of this PR which will be used as the squashed PR commit message
- [ ] I have reviewed the title & description of this PR which I will use as the squashed PR commit message
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have enabled auto-merge (optional)

## How to test

Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/integrate-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,16 @@ jobs:
-
name: Unit Tests
run: make unit-tests-ci
# -
# name: E2E Tests
# run: |
# docker compose -f docker-compose.yml up -d app-for-playwright
# npx playwright install chromium
# npx playwright test
-
name: Playwright E2E Tests
run: make playwright-tests-ci
-
name: Upload Playwright test results
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results
path: test-results
-
name: Log in to Docker Hub
uses: docker/login-action@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ jobs:
run: make playwright-tests-ci

-
name: Upload test results
name: Upload Playwright test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: test-results
path: test/e2e/test-results

check-code-formatting:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ test/php/\.phpunit\.result\.cache
node_modules
.DS_Store
docker-scan-results.txt
test-results/
playwright-report/
test-results
test-storage-state
*storageState.json
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ dev: start
playwright-tests-ci:
npm ci
$(MAKE) playwright-app
npx playwright install chromium && npx playwright test
npx playwright install chromium && npx playwright test -c ./test/e2e/playwright.config.ts

.PHONY: playwright-tests
playwright-tests:
npm install
$(MAKE) playwright-app
docker compose up -d ui-builder
npx playwright install chromium && npx playwright test $(params)
npx playwright install chromium && npx playwright test -c ./test/e2e/playwright.config.ts $(params)

.PHONY: playwright-app
playwright-app:
# delete any cached session storage state files if the service isn't running
docker compose ps app-for-playwright > /dev/null 2>&1 || rm -f *-storageState.json
docker compose ps app-for-playwright > /dev/null 2>&1 || $(MAKE) clean-test
docker compose up -d app-for-playwright
# wait until the app-for-playwright service is serving up HTTP before continuing
until curl localhost:3238 > /dev/null 2>&1; do sleep 1; done
Expand Down Expand Up @@ -83,9 +83,12 @@ clean:
docker compose down
docker system prune -f

clean-test:
cd test/e2e && npx rimraf test-storage-state test-results

.PHONY: clean-powerwash
clean-powerwash: clean
npx rimraf *storageState.json test-results
$(MAKE) clean-test
docker system prune -f --volumes
- docker rmi -f `docker images -q "lf-*"` sillsdev/web-languageforge:base-php
docker builder prune -f
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@ import { sf } from '$lib/fetch/server'
export async function GET({ params: { project_code }, request: { headers } }) {
const cookie = headers.get('cookie')

const activities = await get_activities({ project_code, cookie })
await sf({ name: 'set_project', args: [ project_code ], cookie })

const activities = await get_activities({ cookie })

return json(activities)
}

// src/Api/Model/Shared/Dto/ActivityListDto.php
// src/Api/Model/Shared/Dto/ActivityListDto.php->ActivityListModel.__construct
export async function get_activities({ project_code, cookie, start_date, end_date }) {
export async function get_activities({ cookie, start_date, end_date }) {
const args = {
name: 'activity_list_dto_for_project',
name: 'activity_list_dto_for_current_project',
args: [
project_code,
{
startDate: start_date,
endDate: end_date,
limit: start_date || end_date ? 50 : 0,
}
},
],
cookie,
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"webpack:dev:watch": "webpack -w --config webpack-dev.config.js",
"webpack:prd": "webpack --config webpack-prd.config.js",
"compile-test-e2e": "tsc -p test/app",
"test-e2e": "protractor test/app/protractorConf.js",
"test-e2e": "npx playwright test -c ./test/e2e/playwright.config.ts",
"prepare": "husky install"
},
"license": "MIT",
Expand Down
3 changes: 0 additions & 3 deletions src/Api/Model/Shared/Dto/RightsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ public function userCanAccessMethod($methodName)
case "activity_list_dto_for_current_project":
return $this->userHasSiteRight(Domain::PROJECTS + Operation::VIEW_OWN);

case "activity_list_dto_for_project":
return $this->userHasSiteRight(Domain::PROJECTS + Operation::VIEW_OWN);

case "activity_list_dto_for_lexical_entry":
return $this->userHasProjectRight(Domain::ENTRIES + Operation::VIEW);

Expand Down
10 changes: 0 additions & 10 deletions src/Api/Service/Sf.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,16 +438,6 @@ public function activity_list_dto_for_current_project($filterParams = [])
return ActivityListDto::getActivityForOneProject($projectModel, $this->userId, $filterParams);
}

public function activity_list_dto_for_project($projectCode, $filterParams = [])
{
$projectModel = ProjectModel::getByProjectCode($projectCode);
$user = new UserModel($this->userId);
if ($user->isMemberOfProject($projectModel->id->asString())) {
return ActivityListDto::getActivityForOneProject($projectModel, $this->userId, $filterParams);
}
throw new UserUnauthorizedException("User $this->userId is not a member of project $projectCode");
}

public function activity_list_dto_for_lexical_entry($entryId, $filterParams = [])
{
$projectModel = ProjectModel::getById($this->projectId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@
</div>
</div>
</div>
<div class="row" data-ng-show="$ctrl.entries.length == 0 && $ctrl.lecRights.canEditProject() && $ctrl.lecFinishedLoading">
<div class="row" data-ng-show="$ctrl.entries.length == 0 && $ctrl.lecFinishedLoading">
<div class="col">
<div class="lexiconItemListContainer" data-pui-when-scrolled="$ctrl.show.more()">
<div class="text-center no-entries" id="noEntries">
<h4>Looks like there are no entries yet.</h4>
<button class="btn btn-primary" data-ng-click="$ctrl.navigateToLiftImport()"
<button class="btn btn-primary" data-ng-if="$ctrl.lecRights.canEditEntry()" data-ng-click="$ctrl.navigateToLiftImport()"
data-ng-hide="$ctrl.projectSettings.hasSendReceive">
<i class="fa fa-upload"></i> Import entries from LIFT</button>
<button class="btn btn-primary" data-ng-click="$ctrl.syncProject()" data-ng-show="$ctrl.projectSettings.hasSendReceive">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ export class LexiconEditorController implements angular.IController {

deleteEntry = (entry: LexEntry): void => {
const deleteMsg = 'Are you sure you want to delete the entry <b>\'' +
LexiconUtilityService.getLexeme(this.lecConfig, this.lecConfig.entry, entry) + '\'</b>';
LexiconUtilityService.getLexeme(this.lecConfig, this.lecConfig.entry, entry) + '\'</b>?';
this.modal.showModalSimple('Delete Entry', deleteMsg, 'Cancel', 'Delete Entry').then(() => {
let iShowList = this.editorService.getIndexInList(entry.id, this.visibleEntries);
this.editorService.removeEntryFromLists(entry.id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class FieldAudioController implements angular.IController {
deleteAudio(): void {
if (this.hasAudio()) {
const deleteMsg = 'Are you sure you want to delete the audio <b>\'' +
FieldAudioController.originalFileName(this.dcFilename) + '\'</b>';
FieldAudioController.originalFileName(this.dcFilename) + '\'</b>?';
this.modalService.showModalSimple('Delete Audio', deleteMsg, 'Cancel', 'Delete Audio')
.then(() => {
this.lexProjectService.removeMediaFile('audio', this.dcFilename, result => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div data-ng-if="$ctrl.control.rights.canDeleteEntry() && $ctrl.isAtEditorEntry()" class="d-flex align-items-center justify-content-between">
Entry

<a href data-ng-click="$ctrl.deleteEntry()" class="text-danger" role="button">
<a href data-ng-click="$ctrl.deleteEntry()" class="text-danger" role="button" title="Delete this entry">
<span class="fa fa-trash"></span>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ export class FieldEntryController implements angular.IController {
}

deleteSense = (index: number): void => {
const deletemsg = 'Are you sure you want to delete the meaning <b>\' ' +
const deletemsg = 'Are you sure you want to delete the meaning <b>\'' +
LexiconUtilityService.getMeaning(this.control.config, this.config.fields.senses as LexConfigFieldList,
this.model.senses[index]) + ' \'</b>';
this.model.senses[index]) + '\'</b>?';
this.modal.showModalSimple('Delete Meaning', deletemsg, 'Cancel', 'Delete Meaning')
.then(() => {
// Adding or removing senses makes for a non-delta update, so save a possible delta update first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<span class="flex-grow"></span>

<div class="mr-4">
<a href data-ng-show="$ctrl.index > 0" data-ng-click="$ctrl.move($ctrl.index, -1)" class="mr-1" role="button">
<a href data-ng-show="$ctrl.index > 0" data-ng-click="$ctrl.move($ctrl.index, -1)" class="mr-1" role="button" title="Move this example up">
<span class="fa fa-arrow-up"></span>
</a>
<a href data-ng-show="$ctrl.index+1 < $ctrl.numExamples()" data-ng-click="$ctrl.move($ctrl.index, 1)" class="mr-1" role="button">
<a href data-ng-show="$ctrl.index+1 < $ctrl.numExamples()" data-ng-click="$ctrl.move($ctrl.index, 1)" class="mr-1" role="button" title="Move this example down">
<span class="fa fa-arrow-down"></span>
</a>
</div>

<a href data-ng-click="$ctrl.remove($ctrl.index)" class="text-danger" role="button">
<a href data-ng-click="$ctrl.remove($ctrl.index)" class="text-danger" role="button" title="Delete this example">
<span class="fa fa-trash"></span>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class FieldPictureController implements angular.IController {
const fileName: string = this.pictures[index].fileName;
if (fileName) {
const deleteMsg: string = 'Are you sure you want to delete the picture <b>\'' +
FieldPictureController.originalFileName(fileName) + '\'</b>';
FieldPictureController.originalFileName(fileName) + '\'</b>?';
this.modalService.showModalSimple('Delete Picture', deleteMsg, 'Cancel', 'Delete Picture').then(() => {
this.pictures.splice(index, 1);
this.lexProjectService.removeMediaFile('sense-image', fileName, result => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<span class="flex-grow"></span>

<div class="mr-4">
<a href data-ng-show="$ctrl.index > 0" data-ng-click="$ctrl.move($ctrl.index, -1)" class="mr-1" role="button">
<a href data-ng-show="$ctrl.index > 0" data-ng-click="$ctrl.move($ctrl.index, -1)" class="mr-1" role="button" title="Move this meaning up">
<span class="fa fa-arrow-up"></span>
</a>
<a href data-ng-show="$ctrl.index+1 < $ctrl.numSenses()" data-ng-click="$ctrl.move($ctrl.index, 1)" class="mr-1" role="button">
<a href data-ng-show="$ctrl.index+1 < $ctrl.numSenses()" data-ng-click="$ctrl.move($ctrl.index, 1)" class="mr-1" role="button" title="Move this meaning down">
<span class="fa fa-arrow-down"></span>
</a>
</div>

<a href data-ng-click="$ctrl.remove($ctrl.index)" class="text-danger" role="button">
<a href data-ng-click="$ctrl.remove($ctrl.index)" class="text-danger" role="button" title="Delete this meaning">
<span class="fa fa-trash"></span>
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export class FieldSenseController implements angular.IController {

// noinspection JSUnusedGlobalSymbols
deleteExample = (index: number): void => {
const deletemsg = 'Are you sure you want to delete the example <b>\' ' +
const deletemsg = 'Are you sure you want to delete the example <b>\'' +
LexiconUtilityService.getExample(this.control.config, this.config.fields.examples as LexConfigFieldList,
this.model.examples[index], 'sentence')
+ ' \'</b>';
+ '\'</b>?';
this.modal.showModalSimple('Delete Example', deletemsg, 'Cancel', 'Delete Example')
.then(() => {
// Adding or removing examples makes for a non-delta update, so save a possible delta update first
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class OptionListConfigurationController implements angular.IController {
return null;
}

return this.olcOptionListsDirty[this.currentListIndex].items;
return this.olcOptionListsDirty[this.currentListIndex]?.items;
},
(newVal: LexOptionListItem[], oldVal: LexOptionListItem[]) => {
if (newVal != null && newVal !== oldVal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,9 @@ export class ConfigurationFieldUnifiedViewModel {
const userView: LexUserViewConfig = config.userViews[userId];
if (userView != null) {
if (userView.inputSystems && userView.inputSystems.length) {
inputSystemSettings.groups[groupIndex].show = userView.inputSystems.includes(tag);
inputSystemSettings.groups[groupIndex] = {show: userView.inputSystems.includes(tag)};
} else {
inputSystemSettings.groups[groupIndex].show = true;
inputSystemSettings.groups[groupIndex] = {show: true};
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</div>
<div class="form-group row">
<label class="col-form-label col-12">Project Owner</label>
<div data-testid="e2e-test-project-owner" class="controls col-12 notranslate">
<div class="controls col-12 notranslate">
{{$ctrl.project.ownerRef.username}}
</div>
</div>
Expand Down

This file was deleted.

4 changes: 4 additions & 0 deletions test/app/testConstants.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
"observerName": "Test ObserverUser",
"observerPassword": "normaluser5",
"observerEmail": "test_runner_observer_normal_user@example.com",
"writableUsername": "test_runner_writable_user",
"writableName": "Test WritableUser",
"writablePassword": "writableuser5",
"writableEmail": "test_runner_writable_user@example.com",
"unusedUsername": "test_runner_unused_user",
"unusedName": "Test UnusedUser",
"unusedEmail": "test_runner_unused_user+test@example.com",
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/pages/base-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export abstract class BasePage {

async waitForPage(): Promise<void> {
await Promise.all([
this.page.waitForNavigation({ url: new RegExp(`${this.url}(#|$)`) }),
this.page.waitForNavigation({url: new RegExp(`${this.url}(#|$)`)}),
this.waitFor?.waitFor(),
]);
}
Expand Down
12 changes: 9 additions & 3 deletions test/e2e/pages/editor.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Project } from '../utils/types';
import { BasePage, GotoOptions } from './base-page';
import { ConfigurationPage } from './configuration.page';
import { EntriesListPage } from './entries-list.page';
import { ProjectSettingsPage } from './project-settings.page';

export interface EditorGotoOptions extends GotoOptions {
entryId?: string;
Expand Down Expand Up @@ -67,7 +68,7 @@ export class EditorPage extends BasePage {
readonly addPictureButtonSelector = 'a >> text=Add Picture';

constructor(page: Page, readonly project: Project) {
super(page, `/app/lexicon/${project.id}/`, page.locator('.words-container-title'));
super(page, `/app/lexicon/${project.id}/`, page.locator('.words-container-title, .no-entries'));
}

async goto(options?: EditorGotoOptions): Promise<void> {
Expand All @@ -83,11 +84,16 @@ export class EditorPage extends BasePage {
await expect(this.page.locator('.page-name >> text=' + this.project.name)).toBeVisible();
}

async navigateToSettings() {
async navigateToSettings(): Promise<ProjectSettingsPage> {
await expect(this.settingsMenuLink).toBeVisible();
await this.settingsMenuLink.click();
await expect(this.projectSettingsLink).toBeVisible();
await this.projectSettingsLink.click();
const projectSettingsPage = new ProjectSettingsPage(this.page, this.project);
await Promise.all([
this.projectSettingsLink.click(),
projectSettingsPage.waitForPage(),
]);
return projectSettingsPage;
}

async navigateToEntriesList() {
Expand Down
Loading

0 comments on commit 22487e4

Please sign in to comment.