Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix duplicated items in saved search on desk #4607

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ jobs:
run: npx playwright test
working-directory: e2e/client

- uses: actions/upload-artifact@v3
if: always()
- uses: actions/upload-artifact@v4
with:
name: playwright-report
path: e2e/client/playwright-report/
retention-days: 30
name: playwright-report-${{ matrix.suite }}
path: e2e/client/test-results

# playwright end

Expand Down
2 changes: 1 addition & 1 deletion e2e/client/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import path from 'path';
export default defineConfig({
testDir: './playwright',
/* Run tests in files in parallel */
fullyParallel: true,
fullyParallel: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we no longer gonna do parallel?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because that's causing tests to fail when there are 2 tests modifying data

/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
Expand Down
9 changes: 5 additions & 4 deletions e2e/client/specs/helpers/templates.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable newline-per-chained-call */

import {nav} from './utils';
import {element, by, browser} from 'protractor';
import {element, by, browser, ElementFinder} from 'protractor';
import {el} from '@superdesk/end-to-end-testing-helpers';
import {waitAndClick} from '../utils';

class Templates {
list: any;
Expand All @@ -11,7 +12,7 @@ class Templates {
openTemplatesSettings: () => void;
add: () => void;
getTemplateNameElement: any;
getLegalSwitch: any;
legalSwitch: ElementFinder;
getTemplateType: any;
setTemplateType: (templateType: any) => void;
getContentProfile: any;
Expand Down Expand Up @@ -75,7 +76,7 @@ class Templates {
* Get the legal switch element
* @returns {ElementFinder} legal switch element
**/
this.getLegalSwitch = () => element(by.model('item.flags.marked_for_legal'));
this.legalSwitch = element(by.model('item.flags.marked_for_legal'));

/**
* Get the template type element
Expand Down Expand Up @@ -137,7 +138,7 @@ class Templates {
/**
* Toggles legal switch
**/
this.toggleLegal = () => this.getLegalSwitch().click();
this.toggleLegal = () => waitAndClick(this.legalSwitch);

/**
* Toggle automatic item creation
Expand Down
2 changes: 1 addition & 1 deletion e2e/client/specs/templates_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('templates', () => {
expect(templates.getListCount()).toBeGreaterThan(2);
templates.edit('New Template');
templates.toggleMetadata();
expect(templates.getLegalSwitch().getAttribute('checked')).toEqual('true');
expect(templates.legalSwitch.getAttribute('checked')).toEqual('true');
expect(authoring.getHeadlineText()).toEqual('New Item');
expect(authoring.getBodyText()).toEqual('This is body from the template');
expect(authoring.getSignoffText()).toBe('ABC');
Expand Down
7 changes: 7 additions & 0 deletions e2e/client/specs/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {ElementFinder, browser, ExpectedConditions as EC} from 'protractor';

// tslint:disable-next-line: no-var-requires
var path = require('path');

Expand All @@ -6,3 +8,8 @@ export function getAbsoluteFilePath(
) {
return path.join(__dirname, `../${relativePath}`);
}

export function waitAndClick(element: ElementFinder) {
browser.wait(EC.elementToBeClickable(element), 1000);
element.click();
}
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions scripts/apps/monitoring/services/CardsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,6 @@ export function CardsService(search, session, desks, $location) {
query.filter({bool: {must}});
}
}

if (appConfig.features.nestedItemsInOutputStage) {
query.setOption('hidePreviousVersions', true);
}
}

function filterQueryByCardFileType(query, card: ICard) {
Expand Down Expand Up @@ -265,6 +261,10 @@ export function CardsService(search, session, desks, $location) {
criteria.es_highlight = search.getElasticHighlight();
}

if (appConfig.features.nestedItemsInOutputStage) {
query.setOption('hidePreviousVersions', true);
}

criteria.source = query.getCriteria();
if (card.type === 'search' && card.search && card.search.filter.query.repo) {
criteria.repo = card.search.filter.query.repo;
Expand Down