|
3 | 3 | /* eslint-disable no-restricted-syntax */
|
4 | 4 | /* eslint-disable func-names */
|
5 | 5 | import { expect } from 'chai';
|
6 |
| -import path from 'path' |
7 |
| -import fs from 'fs' |
| 6 | +import path from 'path'; |
| 7 | +import fs from 'fs'; |
8 | 8 | import {
|
9 | 9 | removeSpace,
|
10 | 10 | removeTags,
|
11 | 11 | mochaAsync,
|
12 | 12 | userSignIn,
|
13 | 13 | menuGoToVisitSpace,
|
14 | 14 | expectElementToExist,
|
| 15 | + removePathSeparators, |
15 | 16 | } from '../utils';
|
16 | 17 | import { closeApplication, createApplication } from '../application';
|
17 | 18 | import {
|
@@ -46,7 +47,7 @@ import {
|
46 | 47 | DEFAULT_GLOBAL_TIMEOUT,
|
47 | 48 | LOAD_PHASE_PAUSE,
|
48 | 49 | OPEN_TOOLS_PAUSE,
|
49 |
| - APPS_FOLDER |
| 50 | + APPS_FOLDER, |
50 | 51 | } from '../constants';
|
51 | 52 | import { USER_GRAASP } from '../fixtures/users';
|
52 | 53 | import { USER_MODES, DEFAULT_USER_MODE } from '../../src/config/constants';
|
@@ -294,23 +295,29 @@ const hasPhaseLayout = async (
|
294 | 295 | case SAVED: {
|
295 | 296 | const iframe = await client.$(`${itemSelector} iframe`);
|
296 | 297 | const src = await iframe.getAttribute('src');
|
297 |
| - const {name, main} = mapping[url] |
| 298 | + const { name, main } = mapping[url]; |
298 | 299 |
|
299 | 300 | const varFolder = await client.getUserDataPath();
|
300 | 301 |
|
301 |
| - if(src.includes(asset)) { |
302 |
| - const absolutePath = path.join(varFolder, decodeURI(asset)) |
| 302 | + if (src.includes(asset)) { |
| 303 | + const absolutePath = path.join(varFolder, decodeURI(asset)); |
303 | 304 | expect(fs.existsSync(absolutePath)).to.be.true;
|
304 | 305 | }
|
305 | 306 | // check for prepackaged links
|
306 |
| - else if(name) { |
| 307 | + else if (name) { |
307 | 308 | // todo: use shared constant with public, src
|
308 | 309 | // src should contain prepackaged path
|
309 |
| - const prepackagedAppsFolder = path.join(varFolder,APPS_FOLDER, name, main) |
310 |
| - expect(src).to.include(prepackagedAppsFolder); |
311 |
| - } |
312 |
| - else { |
313 |
| - throw new Error(`${src} does not match ${asset}`) |
| 310 | + const prepackagedAppsFolder = path.join( |
| 311 | + varFolder, |
| 312 | + APPS_FOLDER, |
| 313 | + name, |
| 314 | + main |
| 315 | + ); |
| 316 | + expect(removePathSeparators(src)).to.include( |
| 317 | + removePathSeparators(prepackagedAppsFolder) |
| 318 | + ); |
| 319 | + } else { |
| 320 | + throw new Error(`${src} does not match ${asset}`); |
314 | 321 | }
|
315 | 322 |
|
316 | 323 | if (appInstance) {
|
|
0 commit comments