Skip to content

Commit

Permalink
TASK: Add inital app load test
Browse files Browse the repository at this point in the history
This should help with random errors in the CI that the app fails to load.
  • Loading branch information
Sebobo committed Nov 28, 2022
1 parent 3a01f51 commit 7fba9e4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .testcaferc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
"takeOnFails": true
},
"hostname": "localhost",
"retryTestPages": true
"retryTestPages": true,
"pageLoadTimeout": 10000,
"pageRequestTimeout": 60000
}
17 changes: 17 additions & 0 deletions Resources/Private/JavaScript/media-module/tests/00_app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { waitForReact } from 'testcafe-react-selectors';
import page from './page-model';
import { SERVER_NAME } from './helpers';

/**
* This fixture should be run first to make sure the server is running and the app is loaded
*/

fixture('App')
.page(SERVER_NAME)
.beforeEach(async () => {
await waitForReact();
});

test('The app loads and shows all main components', async (t) => {
await t.expect(page.assetSourceList.exists).ok('The asset source list should exist');
});
4 changes: 4 additions & 0 deletions Resources/Private/JavaScript/media-module/tests/page-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ class Page {
public tagSelection: Selector;
public assetInspector: Selector;
public inspectorActions: Selector;
public assetSourceList: Selector;

constructor() {
// Collection tree
this.collectionTree = ReactSelector('AssetCollectionTree');
this.assetCollections = this.collectionTree.findReact('AssetCollectionTreeNode');
this.tags = this.assetCollections.withText('All').findReact('TagTreeNode');

// Asset sources
this.assetSourceList = ReactSelector('AssetSourceList');

// Main area
this.thumbnails = ReactSelector('Thumbnail');
this.lightbox = ReactSelector('ReactImageLightbox');
Expand Down

0 comments on commit 7fba9e4

Please sign in to comment.