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 e2e tests on post-broadcasting #4315

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
0a21c14
batch 1
tomaskikutis Aug 25, 2023
469d4c9
batch 2
tomaskikutis Sep 4, 2023
a523b34
[email protected]
tomaskikutis Sep 4, 2023
90710be
set server with prepopulate data fixes
tomaskikutis Sep 6, 2023
d47aec6
fix e2e test - authoring history
tomaskikutis Sep 6, 2023
98439f1
fix e2e test
tomaskikutis Sep 6, 2023
8574645
revert to earlier data-test-id for content-create
tomaskikutis Sep 6, 2023
3b08c83
[email protected]
tomaskikutis Sep 6, 2023
1b95679
Merge branch 'authoring-react-post-broadcasting' into fix-e2e-on-post…
tomaskikutis Sep 7, 2023
76ea3a2
disable authoring-react by default
tomaskikutis Sep 7, 2023
018aaaf
focus e2e test open an item in authoring
tomaskikutis Sep 7, 2023
b76af88
Revert "focus e2e test open an item in authoring"
tomaskikutis Sep 7, 2023
f6f0ab0
fix e2e server requirements (#4317)
petrjasek Sep 7, 2023
beb24ef
fix e2e test
tomaskikutis Sep 7, 2023
f8335c0
fix e2e test
tomaskikutis Sep 7, 2023
bf7f01b
fix e2e test
tomaskikutis Sep 7, 2023
b0eccf4
fix e2e test
tomaskikutis Sep 7, 2023
b170f34
fix e2e test
tomaskikutis Sep 7, 2023
0b679c5
fix e2e test
tomaskikutis Sep 8, 2023
974bf3e
fix test
tomaskikutis Sep 8, 2023
4a0b8ef
fix e2e test
tomaskikutis Sep 8, 2023
6818fda
display error if sending to desk fails
tomaskikutis Sep 10, 2023
37982ac
fix e2e test
tomaskikutis Sep 10, 2023
a166094
fix e2e test
tomaskikutis Sep 11, 2023
2f4c996
fix e2e test
tomaskikutis Sep 11, 2023
5ac06de
fix e2e test
tomaskikutis Sep 11, 2023
fd333aa
[email protected]
tomaskikutis Sep 11, 2023
936e359
Merge branch 'authoring-react-post-broadcasting' into fix-e2e-on-post…
tomaskikutis Sep 11, 2023
969a50b
fix e2e test
tomaskikutis Sep 12, 2023
2c0054e
fix e2e test
tomaskikutis Sep 12, 2023
fb9af55
disable e2e test
tomaskikutis Sep 13, 2023
585a4b2
fixed e2e test
tomaskikutis Sep 13, 2023
5753782
fix e2e test
tomaskikutis Sep 13, 2023
11deffb
publish from enabled by default
tomaskikutis Sep 13, 2023
fd63acc
do not persist destination
tomaskikutis Sep 13, 2023
44dbd09
display publish buttons vertically as they are displayed at the moment
tomaskikutis Sep 13, 2023
fd0c822
fix e2e test
tomaskikutis Sep 14, 2023
ca35811
fix e2e test
tomaskikutis Sep 14, 2023
7be5881
fix e2e test
tomaskikutis Sep 14, 2023
6ec12da
fix e2e test
tomaskikutis Sep 14, 2023
9aa4a47
fix e2e test
tomaskikutis Sep 14, 2023
f61c77a
fix e2e test
tomaskikutis Sep 14, 2023
a81d040
fix e2e test
tomaskikutis Sep 14, 2023
576d4f8
fix e2e test
tomaskikutis Sep 14, 2023
4b2ab3e
fix e2e test
tomaskikutis Sep 14, 2023
5669e48
fix e2e test
tomaskikutis Sep 14, 2023
f06092a
[email protected]
tomaskikutis Sep 14, 2023
29c8cfd
fix e2e test
tomaskikutis Sep 15, 2023
11046f4
fix lint
tomaskikutis Sep 15, 2023
1e70de4
fixed bug - funciton was invoking a promise but not waiting for it
tomaskikutis Sep 15, 2023
83d0b4e
use tree select for destination select; adjust e2e tests
tomaskikutis Sep 18, 2023
78e0f07
add spacing for authoring switch
tomaskikutis Sep 18, 2023
e712e71
hide authoring switch while new authoring isn't released yet
tomaskikutis Sep 18, 2023
6109a40
update e2e selector
tomaskikutis Sep 18, 2023
1627ce3
update procedure to run e2e
tomaskikutis Sep 18, 2023
5006cc7
[email protected]
tomaskikutis Sep 18, 2023
d95ca72
fix e2e
tomaskikutis Sep 18, 2023
b4ae87c
fix e2e
tomaskikutis Sep 18, 2023
b8b25d7
disable broken tests that are supposed to check for spelling mistakes…
tomaskikutis Sep 18, 2023
fa8367e
improve stability of e2e test (was unstable due to animation)
tomaskikutis Sep 18, 2023
0fb695a
use default timeout
tomaskikutis Sep 19, 2023
2fe9056
make e2e test more stable by removing time based assumptions
tomaskikutis Sep 19, 2023
796b873
increase timeout
tomaskikutis Sep 19, 2023
f2c69eb
stabilize e2e test by waiting for condition
tomaskikutis Sep 19, 2023
efd80fe
fix e2e test - use default wait
tomaskikutis Sep 19, 2023
3281f89
use 2.7 server for e2e tests
tomaskikutis Sep 19, 2023
2038dec
improve tree-select driver to allow selecting values across multiple …
tomaskikutis Sep 19, 2023
f697188
improve unstable tests
tomaskikutis Sep 20, 2023
33ee04b
restore e2e test: can set embargo and send
tomaskikutis Sep 20, 2023
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
2 changes: 1 addition & 1 deletion e2e/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"server": "grunt server",
"start-client-server": "http-server dist -p 9000 -s &",
"stop-client-server": "fuser -k 9000/tcp",
"protractor": "node run-end-to-end-tests.js",
"protractor": "protractor protractor.conf.js",
"specs--compile": "find ./specs/ -name '*.js' -type f -delete && tsc -p ./specs",
"specs--watch": "find ./specs/ -name '*.js' -type f -delete && tsc -p ./specs -w",
"start-test-server": "cd ../server && docker-compose build && docker-compose up -d",
Expand Down
46 changes: 0 additions & 46 deletions e2e/client/run-end-to-end-tests.js

This file was deleted.

3 changes: 2 additions & 1 deletion e2e/client/specs/archived_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {globalSearch} from './helpers/search';
import {authoring} from './helpers/authoring';
import {content} from './helpers/content';
import {monitoring} from './helpers/monitoring';
import {element, by} from 'protractor';

describe('archived', () => {
beforeEach(() => {
Expand Down Expand Up @@ -31,7 +32,7 @@ describe('archived', () => {
expect(authoring.edit_correct_button.isDisplayed()).toBe(false);
expect(authoring.edit_kill_button.isDisplayed()).toBe(false);
expect(authoring.edit_takedown_button.isDisplayed()).toBe(false);
expect(authoring.navbarMenuBtn.isPresent()).toBe(false);
expect(element(by.css('[data-test-id="content-create"]')).isPresent()).toBe(false);
expect(authoring.sendToButton.isDisplayed()).toBe(false);
authoring.showInfo();
expect(authoring.isPublishedState()).toBe(true);
Expand Down
39 changes: 31 additions & 8 deletions e2e/client/specs/authoring_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ describe('authoring', () => {

it('authoring operations', () => {
// allows to create a new empty package
monitoring.createItemAction('create_package');
el(['content-create']).click();
el(['content-create-dropdown', 'create-package']).click();

expect(element(by.className('packaging-screen')).isDisplayed()).toBe(true);
authoring.close();

Expand Down Expand Up @@ -252,7 +254,13 @@ describe('authoring', () => {
authoring.writeText('z');
element(by.cssContainingText('label', 'Dateline')).click();
ctrlShiftKey('s');
browser.wait(() => element(by.buttonText('Save')).getAttribute('disabled'), 500);

browser.wait(ECE.attributeEquals(
element(by.buttonText('Save')),
'disabled',
'true',
));

authoring.close();
monitoring.actionOnItem('Edit', 2, 0);
browser.sleep(300);
Expand Down Expand Up @@ -322,16 +330,31 @@ describe('authoring', () => {

it('toggle auto spellcheck and hold changes', () => {
monitoring.actionOnItem('Edit', 2, 1);
browser.sleep(300);
expect(element(by.model('spellcheckMenu.isAuto')).getAttribute('checked')).toBeTruthy();

browser.wait(ECE.attributeEquals(
element(by.model('spellcheckMenu.isAuto')),
'checked',
'true',
));

authoring.toggleAutoSpellCheck();
browser.sleep(300);
expect(element(by.model('spellcheckMenu.isAuto')).getAttribute('checked')).toBeFalsy();

browser.wait(ECE.attributeEquals(
element(by.model('spellcheckMenu.isAuto')),
'checked',
null,
));

authoring.close();

monitoring.actionOnItem('Edit', 2, 2);
expect(element(by.model('spellcheckMenu.isAuto')).getAttribute('checked')).toBeFalsy();
});

browser.wait(ECE.attributeEquals(
element(by.model('spellcheckMenu.isAuto')),
'checked',
null,
));
});
it('related item widget', () => {
monitoring.actionOnItem('Edit', 2, 1);
authoring.writeText('something');
Expand Down
9 changes: 4 additions & 5 deletions e2e/client/specs/content_profile_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {workspace} from './helpers/workspace';
import {authoring} from './helpers/authoring';
import {metadata} from './helpers/metadata';
import {assertToastMsg} from './helpers/utils';
import {ECE} from '@superdesk/end-to-end-testing-helpers';

describe('Content profiles', () => {
it('creates corresponding template', () => {
Expand All @@ -19,7 +20,6 @@ describe('Content profiles', () => {
templates.openTemplatesSettings();
expect(templates.getListCount()).toBeGreaterThan(2);
templates.edit('Simple');
expect(authoring.getAbstractFieldCount()).toEqual(0);
expect(templates.getContentProfile()).toEqual('Simple');
templates.cancel();

Expand Down Expand Up @@ -57,7 +57,6 @@ describe('Content profiles', () => {
monitoring.openMonitoring();
workspace.selectDesk('Sports Desk');
authoring.createTextItemFromTemplate('simple');
expect(authoring.getAbstractFieldCount()).toEqual(0);

// publish of the required field will fail
authoring.setHeaderSluglineText('Story1 slugline');
Expand Down Expand Up @@ -89,12 +88,12 @@ describe('Content profiles', () => {

contentProfiles.editContentFields();

const btns = element.all(by.partialButtonText(FIELD_LABEL));
const buttons = element.all(by.partialButtonText(FIELD_LABEL));

expect(btns.filter((elem) => elem.isDisplayed()).count()).toBe(0);
browser.wait(ECE.hasElementCount(buttons, 0));

contentProfiles.openAddFieldDropdown();

expect(btns.filter((elem) => elem.isDisplayed()).count()).toBe(1);
browser.wait(ECE.hasElementCount(buttons, 1));
});
});
59 changes: 34 additions & 25 deletions e2e/client/specs/content_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {content} from './helpers/content';
import {authoring} from './helpers/authoring';
import {multiAction} from './helpers/actions';
import {ECE, el} from '@superdesk/end-to-end-testing-helpers';
import {TreeSelectDriver} from './helpers/tree-select-driver';

describe('content', () => {
var body = element(by.tagName('body'));
Expand All @@ -33,8 +34,8 @@ describe('content', () => {
var embargoTime = (now.getHours() < 10 ? '0' + now.getHours() : now.getHours()) + ':' +
(now.getMinutes() < 10 ? '0' + now.getMinutes() : now.getMinutes());

element(by.model('item.embargo_date')).element(by.tagName('input')).sendKeys(embargoDate);
element(by.model('item.embargo_time')).element(by.tagName('input')).sendKeys(embargoTime);
el(['authoring', 'interactive-actions-panel', 'embargo', 'date-input']).sendKeys(embargoDate);
el(['authoring', 'interactive-actions-panel', 'embargo', 'time-input']).sendKeys(embargoTime);
}

it('can navigate with keyboard', () => {
Expand Down Expand Up @@ -141,7 +142,7 @@ describe('content', () => {

browser.sleep(100);

multiAction('Multiedit');
multiAction('Multi-edit');
expect(browser.getCurrentUrl()).toMatch(/multiedit$/);
expect(element.all(by.repeater('board in boards')).count()).toBe(2);
});
Expand All @@ -150,8 +151,7 @@ describe('content', () => {
workspace.switchToDesk('SPORTS DESK');
content.setListView();

element(by.className('sd-create-btn')).click();
element(by.id('create_text_article')).click();
authoring.createTextItem();

authoring.writeText('Words');
authoring.save();
Expand All @@ -164,8 +164,8 @@ describe('content', () => {
workspace.switchToDesk('SPORTS DESK');
content.setListView();

element(by.className('sd-create-btn')).click();
element(by.id('create_package')).click();
el(['content-create']).click();
el(['content-create-dropdown', 'create-package']).click();

element.all(by.model('item.headline')).first().sendKeys('Empty Package');
authoring.save();
Expand Down Expand Up @@ -220,10 +220,10 @@ describe('content', () => {

it('can display embargo in metadata when set', () => {
workspace.editItem('item3', 'SPORTS');
authoring.sendToButton.click();

el(['open-send-publish-pane']).click();

setEmbargo();
browser.sleep(100);

authoring.closeSendAndPublish();

Expand All @@ -238,37 +238,46 @@ describe('content', () => {
content.closePreview();
});

it('can enable/disable send based on embargo', () => {
it('can set embargo and send', () => {
// Initial steps before proceeding, to get initial state of send buttons.
workspace.editItem('item3', 'SPORTS');
authoring.sendTo('Sports Desk', 'Incoming Stage');
authoring.confirmSendTo();

workspace.editItem('item3', 'SPORTS');
authoring.sendToButton.click().then(() => {
// Initial State
expect(authoring.sendBtn.isEnabled()).toBe(false);
});

var sidebar = element.all(by.css('.side-panel')).last(),
dropdown = sidebar.element(by.css('.dropdown--boxed .dropdown__toggle'));
el(['open-send-publish-pane']).click();

el(['authoring', 'interactive-actions-panel', 'tabs'], by.buttonText('Send to')).click();

const sendToButton = el(['authoring', 'interactive-actions-panel', 'send']);

dropdown.waitReady();
dropdown.click();
sidebar.element(by.buttonText('Sports Desk')).click();
browser.wait(ECE.visibilityOf(sendToButton));

new TreeSelectDriver(
el(['interactive-actions-panel', 'destination-select']),
).setValue('Sports Desk');

const stage = 'two';

// State after selecting different Stage in the same desk
sidebar.element(by.buttonText('two')).click();
expect(authoring.sendBtn.isEnabled()).toBe(true);
el(
['interactive-actions-panel', 'stage-select'],
by.cssContainingText('[data-test-id="item"]', stage),
).click();

expect(sendToButton.isEnabled()).toBe(true);

// State after setting Embargo
setEmbargo();
browser.sleep(100);
expect(authoring.sendBtn.isEnabled()).toBe(true);
expect(sendToButton.isEnabled()).toBe(true);

// State after changing Desk
dropdown.click();
sidebar.element(by.buttonText('Politic Desk')).click();
expect(authoring.sendBtn.isEnabled()).toBe(true);
new TreeSelectDriver(
el(['interactive-actions-panel', 'destination-select']),
).setValue('Politic Desk');

expect(sendToButton.isEnabled()).toBe(true);
});
});
40 changes: 26 additions & 14 deletions e2e/client/specs/fetch_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {content} from './helpers/content';
import {authoring} from './helpers/authoring';
import {desks} from './helpers/desks';
import {multiAction} from './helpers/actions';
import {ECE, els} from '@superdesk/end-to-end-testing-helpers';
import {ECE, el, els, s} from '@superdesk/end-to-end-testing-helpers';

describe('fetch', () => {
beforeEach(() => {
Expand All @@ -31,7 +31,7 @@ describe('fetch', () => {
it('can fetch as', () => {
workspace.openIngest();
content.actionOnItem('Fetch To', 0);
content.send();
el(['interactive-actions-panel', 'fetch']).click();
workspace.openContent();
expect(content.count()).toBe(3);
});
Expand All @@ -46,9 +46,9 @@ describe('fetch', () => {
workspace.openIngest();
content.actionOnItem('Fetch To', 0);

var btnFetchAndOpen = element(by.css('[ng-disabled="disableFetchAndOpenButton()"]'));
var btnFetchAndOpen = element(s(['interactive-actions-panel', 'fetch-and-open']));

expect(btnFetchAndOpen.getAttribute('disabled')).toBeFalsy();
expect(btnFetchAndOpen.isEnabled()).toBe(true);

// Adding a new desk with no member, which serves as a non-member desk when selected
desks.openDesksSettings();
Expand All @@ -59,21 +59,32 @@ describe('fetch', () => {
desks.setDeskType('authoring');
desks.setDeskDefaultContentTemplate('testing');
desks.setDeskDefaultContentProfile('testing');
desks.actionDoneOnGeneralTab();
desks.actionSaveAndContinueOnGeneralTab(); // save desk and continue to Stages tab

desks.editStage('Working Stage');
desks.toggleGlobalReadFlag(); // turn OFF Global Read
desks.saveEditedStage();

desks.editStage('Incoming Stage');
desks.toggleGlobalReadFlag(); // turn OFF Global Read
desks.saveEditedStage();

desks.actionDoneOnStagesTab();

workspace.openIngest();
content.actionOnItem('Fetch To', 0);
authoring.selectDeskforSendTo('Test Desk');
expect(btnFetchAndOpen.getAttribute('disabled')).toBeTruthy();

expect(btnFetchAndOpen.isEnabled()).toBe(false);
});

it('can hide stage with global read OFF if selected desk as a non-member', () => {
workspace.openIngest();
content.actionOnItem('Fetch To', 0);

var btnFetchAndOpen = element(by.css('[ng-disabled="disableFetchAndOpenButton()"]'));
var btnFetchAndOpen = element(s(['interactive-actions-panel', 'fetch-and-open']));

expect(btnFetchAndOpen.getAttribute('disabled')).toBeFalsy();
expect(btnFetchAndOpen.isEnabled()).toBe(true);

// Adding a new desk with no member, which serves as a non-member desk when selected
desks.openDesksSettings();
Expand Down Expand Up @@ -106,11 +117,12 @@ describe('fetch', () => {
content.actionOnItem('Fetch To', 0);
authoring.selectDeskforSendTo('Test Desk');

var sidebar = element.all(by.css('.side-panel')).last();

expect(sidebar.element(by.buttonText('Working Stage')).isPresent()).toBeTruthy();
expect(sidebar.element(by.buttonText('Test Stage')).isPresent()).toBeFalsy();
expect(btnFetchAndOpen.getAttribute('disabled')).toBeTruthy();
expect(
element(s(['interactive-actions-panel', 'stage-select', 'item'], 'Working Stage')).isPresent(),
).toBeTruthy();
expect(
element(s(['interactive-actions-panel', 'stage-select', 'item'], 'Test Stage')).isPresent(),
).toBeFalsy();
});

it('can fetch multiple items', () => {
Expand All @@ -127,7 +139,7 @@ describe('fetch', () => {
content.selectItem(0);
browser.sleep(1000); // Wait for animation
multiAction('Fetch to');
content.send();
el(['interactive-actions-panel', 'fetch']).click();
workspace.openContent();
expect(content.count()).toBe(3);
});
Expand Down
Loading
Loading