Skip to content

Commit

Permalink
chore(e2e): set download timeout to 1 minute
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHax committed Oct 25, 2023
1 parent 64c2dcf commit 3b8afa2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
os: [ubuntu-20.04, macos-latest]
name: E2E Testing on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
DOWNLOAD_TIMEOUT: 60000
steps:
- uses: actions/checkout@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions tests/pageobjects/volview.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as path from 'path';
import * as fs from 'fs';
import { Key } from 'webdriverio';
import { cleanuptotal } from 'wdio-cleanuptotal-service';
import { TEMP_DIR } from '../../wdio.shared.conf';
import { DOWNLOAD_TIMEOUT, TEMP_DIR } from '../../wdio.shared.conf';
import Page from './page';

let lastId = 0;
Expand Down Expand Up @@ -48,7 +48,7 @@ class VolViewPage extends Page {
return $$('div[data-testid~="vtk-view"] > canvas');
}

async waitForViews(timeout = 5000) {
async waitForViews(timeout = DOWNLOAD_TIMEOUT) {
const this_ = this;
await browser.waitUntil(
async function viewsExist() {
Expand Down
14 changes: 9 additions & 5 deletions tests/specs/session-zip.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as fs from 'fs';
import JSZip from 'jszip';
import { cleanuptotal } from 'wdio-cleanuptotal-service';
import { setValueVueInput, volViewPage } from '../pageobjects/volview.page';
import { DOWNLOAD_TIMEOUT, TEMP_DIR } from '../../wdio.shared.conf';
import { TEMP_DIR } from '../../wdio.shared.conf';

// from https://stackoverflow.com/a/47764403
function waitForFileExists(filePath: string, timeout: number) {
Expand Down Expand Up @@ -61,11 +61,14 @@ const saveGetManifest = async () => {
const annotate = async () => {
await volViewPage.open();
await volViewPage.downloadProstateSample();
await volViewPage.waitForViews(DOWNLOAD_TIMEOUT);
await volViewPage.waitForViews();

// draw rectangle
await volViewPage.activateRectangle();
await volViewPage.clickTwiceInTwoView();

// this may ensure imminently saved session.volview.zip has the tool in CI
await browser.pause(50);
};

describe('VolView config and deserialization', () => {
Expand All @@ -75,6 +78,8 @@ describe('VolView config and deserialization', () => {
const newColor = 'green';

const { manifest, session } = await saveGetManifest();

expect(manifest.tools.rectangles.tools.length).toEqual(1);
expect(manifest.tools.rectangles.tools?.[0].color).not.toEqual('green');

const config = {
Expand All @@ -98,8 +103,7 @@ describe('VolView config and deserialization', () => {
const sessionZipAndConfig = `?urls=[tmp/${configFileName},tmp/${session}]`;
await volViewPage.open(sessionZipAndConfig);

await volViewPage.waitForViews(DOWNLOAD_TIMEOUT);
// await volViewPage.activateRectangle(); // wait for config to load (waitForViews did not work)
await volViewPage.waitForViews();

const { manifest: changedManifest } = await saveGetManifest();
expect(changedManifest.tools.rectangles.tools?.[0].color).toEqual(newColor);
Expand All @@ -122,7 +126,7 @@ describe('VolView config and deserialization', () => {

const sessionZip = `?urls=[tmp/${session}]`;
await volViewPage.open(sessionZip);
await volViewPage.waitForViews(DOWNLOAD_TIMEOUT);
await volViewPage.waitForViews();

const { manifest: changedManifest } = await saveGetManifest();
expect(changedManifest.tools.rectangles.tools?.[0].strokeWidth).toEqual(
Expand Down

0 comments on commit 3b8afa2

Please sign in to comment.