Skip to content

Commit

Permalink
use storage records api in e2e (#4373)
Browse files Browse the repository at this point in the history
* use storage records api

* use updated server in e2e

* update dump

* fix failing tests

* update e2e server

* fix failing test

* fix lint

* remove screenshots

* add docs regarding recording

* fix notifications error

* rename existing dump to legacy

* add initial dump with desk and article

* disable old spec
  • Loading branch information
petrjasek authored Nov 21, 2023
1 parent a3a33c9 commit 8c46629
Show file tree
Hide file tree
Showing 90 changed files with 75 additions and 31 deletions.
3 changes: 2 additions & 1 deletion e2e/client/specs/authoring_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,8 @@ describe('authoring', () => {
monitoring.actionOnItem('Edit', 3, 2);
authoring.showHistory();
expect(authoring.getHistoryItems().count()).toBe(1);
expect(authoring.getHistoryItem(0).getText()).toMatch(/Fetched by first name last name Today/);
expect(authoring.getHistoryItem(0).getText())
.toMatch(/Fetched by first name last name Wednesday, 8\. November/); // we use a dump, so date won't change
authoring.close();

// view item history move operation
Expand Down
9 changes: 8 additions & 1 deletion e2e/client/specs/helpers/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,18 @@ class Content {
this.openItemMenu = function(item) {
const itemElem = this.getItem(item);

// move mouse out of the item
browser.actions()
.mouseMove(itemElem, {x: -50, y: -50})
.perform();

// move mouse on the item
browser.actions()
.mouseMove(itemElem, {x: -50, y: -50}) // first move out
.mouseMove(itemElem) // now it can mouseover for sure
.perform();

browser.sleep(100);

el(['context-menu-button'], null, itemElem).click();

const menu = el(['context-menu']);
Expand Down
4 changes: 2 additions & 2 deletions e2e/client/specs/helpers/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {backendRequest, backendRequestAuth} from './backend';

export function resetApp(profile, callback) {
backendRequest({
uri: '/prepopulate',
uri: '/restore_record',
method: 'POST',
timeout: 30000,
json: {profile: profile},
json: {name: 'legacy'},
}, (e, r, j) => {
browser.params.token = null;
callback(e, r, j);
Expand Down
4 changes: 3 additions & 1 deletion e2e/client/specs/monitoring_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,9 @@ describe('monitoring', () => {

monitoring.actionOnItemSubmenu('Publishing actions', 'Correct item', 0, 0);
authoring.send_correction_button.click();
expect(element(by.id('multi-select-count')).isPresent()).toBeFalsy();

// check if multi select is closed
browser.wait(ECE.not(ECE.presenceOf(element(by.id('multi-select-count')))), 500);
});

it('can view published duplicated item in duplicate tab of non-published original item', () => {
Expand Down
4 changes: 2 additions & 2 deletions e2e/client/specs/notifications_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ describe('notifications', () => {
browser.wait(() => comments.count(), 2000);

expect(comments.count()).toBe(1);
expect(unreadCount.getText()).toBe('3');
expect(unreadCount.getText()).toBe('');

logout();
var modal = new LoginModal();

modal.login('admin1', 'admin');

expect(unreadCount.getText()).toBe('4');
expect(unreadCount.getText()).toBe('1');

click(element(by.id('unread-count')));

Expand Down
4 changes: 3 additions & 1 deletion e2e/client/specs/send_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ describe('send', () => {
expect(getItemState(0)).toBe('SUBMITTED');
});

it('warns that there are spelling mistakes', () => {
// disabling the test, it wasn't really testing any spellcheck warning
// the popup there was related to saving unsaved changes
xit('warns that there are spelling mistakes', () => {

Check warning on line 37 in e2e/client/specs/send_spec.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected xit

Check warning on line 37 in e2e/client/specs/send_spec.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected xit
workspace.editItem(1);
authoring.writeText('mispeled word');
authoring.sendTo('Sports Desk');
Expand Down
1 change: 1 addition & 0 deletions e2e/server/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
env
dump
__pycache__
12 changes: 12 additions & 0 deletions e2e/server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# Start recording based on e2e base dump

When running e2e server via docker you can run:

$ docker-compose run superdesk run python manage.py storage:record -b e2e -n new

This will create new record called `new` in the records which can be used now via `/restore_record` api.

If running locally using `honcho` you can use similar command:

$ honcho run python manage.py storage:record -b e2e -n new
10 changes: 9 additions & 1 deletion e2e/server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ services:
- e2e

mongo:
image: mongo:4
image: mongo:4.4
ports:
- "27017:27017"
networks:
- e2e
environment:
- MONGO_INITDB_DATABASE=superdesk_e2e
tmpfs:
- /data/db
volumes:
- ./mongo-rs-initialize.js:/docker-entrypoint-initdb.d/mongo-rs-initialize.js:ro
command: --replSet rs0

elastic:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2
Expand Down Expand Up @@ -46,6 +51,9 @@ services:
- WEB_WORKERS=2
- WEB_TIMEOUT=30
- WEB_LOG_LEVEL=info
volumes:
- ./dump:/opt/superdesk/dump:rw

networks:
e2e:
driver: bridge
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added e2e/server/dump/records/initial.json.bz2
Binary file not shown.
Binary file added e2e/server/dump/records/legacy.json.bz2
Binary file not shown.
1 change: 1 addition & 0 deletions e2e/server/mongo-rs-initialize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rs.initiate();
54 changes: 32 additions & 22 deletions e2e/server/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile requirements.in
#
amqp==5.1.1
amqp==5.2.0
# via kombu
arrow==0.13.0
# via
Expand All @@ -14,7 +14,7 @@ async-timeout==4.0.3
# via redis
authlib==0.14.3
# via superdesk-core
babel==2.12.1
babel==2.13.1
# via flask-babel
bcrypt==3.1.7
# via superdesk-core
Expand All @@ -26,16 +26,18 @@ blinker==1.4
# flask-mail
# raven
# superdesk-core
boto3==1.28.37
boto3==1.28.80
# via superdesk-core
botocore==1.31.37
botocore==1.31.80
# via
# boto3
# s3transfer
cachetools==5.3.1
cachetools==5.3.2
# via flask-oidc-ex
celery[redis]==5.2.7
# via superdesk-core
# via
# celery
# superdesk-core
cerberus==1.3.5
# via
# eve
Expand All @@ -45,13 +47,13 @@ certifi==2023.7.22
# elastic-apm
# elasticsearch
# requests
cffi==1.15.1
cffi==1.16.0
# via
# bcrypt
# cryptography
chardet==3.0.4
# via superdesk-core
charset-normalizer==3.2.0
charset-normalizer==3.3.2
# via requests
ciso8601==1.0.8
# via eve-elastic
Expand All @@ -71,18 +73,22 @@ click-repl==0.3.0
# via celery
croniter==0.3.37
# via superdesk-core
cryptography==41.0.3
cryptography==41.0.5
# via
# authlib
# jwcrypto
deprecated==1.2.14
# via jwcrypto
draftjs-exporter[lxml]==2.1.7
# via superdesk-core
# via
# draftjs-exporter
# superdesk-core
ecs-logging==2.1.0
# via elastic-apm
elastic-apm[flask]==6.18.0
# via superdesk-core
elastic-apm[flask]==6.19.0
# via
# elastic-apm
# superdesk-core
elasticsearch==7.13.4
# via eve-elastic
eve==1.1.2
Expand Down Expand Up @@ -164,7 +170,7 @@ oauth2client==4.1.3
# via flask-oidc-ex
oauthlib==3.2.2
# via requests-oauthlib
packaging==23.1
packaging==23.2
# via gunicorn
pillow==9.2.0
# via superdesk-core
Expand All @@ -180,6 +186,8 @@ pyasn1-modules==0.3.0
# via oauth2client
pycparser==2.21
# via cffi
pymemcache==4.0.0
# via superdesk-core
pymongo==3.11.4
# via
# eve
Expand All @@ -199,7 +207,7 @@ python-magic==0.4.27
# via superdesk-core
python-twitter==3.5
# via superdesk-core
pytz==2023.3
pytz==2023.3.post1
# via
# celery
# eve-elastic
Expand All @@ -209,7 +217,9 @@ pytz==2023.3
pyyaml==6.0.1
# via superdesk-core
raven[flask]==6.10.0
# via superdesk-core
# via
# raven
# superdesk-core
redis==4.5.5
# via
# celery
Expand All @@ -225,11 +235,11 @@ requests-oauthlib==1.3.1
# via python-twitter
rsa==4.9
# via oauth2client
s3transfer==0.6.2
s3transfer==0.7.0
# via boto3
sgmllib3k==1.0.0
# via feedparser
simplejson==3.19.1
simplejson==3.19.2
# via eve
six==1.16.0
# via
Expand All @@ -239,7 +249,7 @@ six==1.16.0
# python-dateutil
superdesk-core @ git+https://github.com/superdesk/superdesk-core.git@develop
# via -r requirements.in
typing-extensions==4.7.1
typing-extensions==4.8.0
# via superdesk-core
tzlocal==2.1
# via superdesk-core
Expand All @@ -252,20 +262,20 @@ urllib3==1.25.11
# elasticsearch
# requests
# superdesk-core
vine==5.0.0
vine==5.1.0
# via
# amqp
# celery
# kombu
wcwidth==0.2.6
wcwidth==0.2.9
# via prompt-toolkit
websockets==10.3
# via superdesk-core
werkzeug==1.0.1
# via
# flask
# superdesk-core
wrapt==1.15.0
wrapt==1.14.1
# via
# deprecated
# elastic-apm

0 comments on commit 8c46629

Please sign in to comment.