Skip to content

Commit

Permalink
skipped some steps to make the test faster
Browse files Browse the repository at this point in the history
  • Loading branch information
SimaoBolota-MetaCell committed Mar 12, 2024
1 parent 5167f8b commit 421bbd0
Showing 1 changed file with 71 additions and 42 deletions.
113 changes: 71 additions & 42 deletions tests/frontend/e2e/tests/RxD.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const PASSWORD = 'testpassword'

//TESTS:

jest.setTimeout(600000);
jest.setTimeout(900000);
let browser_RxD;
let RxD_page;

Expand All @@ -47,41 +47,41 @@ describe('RxD testing', () => {
beforeAll(async () => {
browser_RxD = await puppeteer.launch(
{
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox'],
defaultViewport: {
width: 1300,
height: 1024
},
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox'],
defaultViewport: {
width: 1300,
height: 1024
},
}
);
RxD_page = await browser_RxD.newPage();
);
RxD_page = await browser_RxD.newPage();
await RxD_page.goto(baseURL);
if (baseURL.includes('test.netpyne.metacell.us')) {
console.log('Logging in as test user ...')
await RxD_page.waitForSelector(selectors.LOGIN_PAGE_SELECTOR);
await RxD_page.waitForSelector(selectors.USERNAME_SELECTOR)
await expect(RxD_page)
.toFill(selectors.USERNAME_SELECTOR, USERNAME, { timeout: TIMEOUT });
.toFill(selectors.USERNAME_SELECTOR, USERNAME, { timeout: TIMEOUT });

await RxD_page.waitForSelector(selectors.PASSWORD_SELECTOR)
await expect(RxD_page)
.toFill(selectors.PASSWORD_SELECTOR, PASSWORD, { timeout: TIMEOUT });
.toFill(selectors.PASSWORD_SELECTOR, PASSWORD, { timeout: TIMEOUT });

await RxD_page.click(selectors.LOGIN_BUTTON_SELECTOR)
// Wait for initial loading spinner to disappear
await RxD_page.waitForFunction(() => {
let el = document.querySelector('#loading-spinner');
return el == null || el.clientHeight === 0;
let el = document.querySelector('#loading-spinner');
return el == null || el.clientHeight === 0;
}, { timeout: TIMEOUT });
console.log('Logged in successfully')
}
}
});

afterAll(async () => {
// Close the browser instance after all tests have run
await browser_RxD.close();
});
});

it('Open new page', async () => {

Expand Down Expand Up @@ -125,27 +125,27 @@ describe('RxD testing', () => {
await RxD_page.click(selectors.TUTORIALS_BUTTON_SELECTOR, { timeout: TIMEOUT })
await RxD_page.waitForSelector(selectors.TUTORIAL_3B_SELECTOR, { timeout: TIMEOUT })
await RxD_page.click(selectors.TUTORIAL_3B_SELECTOR, { timeout: TIMEOUT })
await RxD_page.waitForSelector('#E')
await RxD_page.waitForSelector('#I')
await RxD_page.waitForSelector('#E', { timeout: TIMEOUT })
await RxD_page.waitForSelector('#I', { timeout: TIMEOUT })
await RxD_page.waitForTimeout(PAGE_WAIT)

console.log('Tutorial loaded')

})

it('Create and Simulate Network', async () => {
it.skip('Create and Simulate Network', async () => {


await RxD_page.waitForSelector(selectors.MODEL_BUTTON_SELECTOR)
await RxD_page.waitForSelector(selectors.MODEL_BUTTON_SELECTOR, { timeout: TIMEOUT })
await RxD_page.click(selectors.MODEL_BUTTON_SELECTOR);
await RxD_page.waitForSelector(selectors.CREATE_NETWORK_SELECTOR)
await RxD_page.waitForSelector(selectors.CREATE_NETWORK_SELECTOR, { timeout: TIMEOUT })
await RxD_page.click(selectors.CREATE_NETWORK_SELECTOR, { timeout: TIMEOUT });

console.log('Creating network ...')

await RxD_page.waitForTimeout(PAGE_WAIT * 3)

await RxD_page.waitForSelector('div[title="3D Representation"][aria-disabled="false"]')
await RxD_page.waitForSelector('div[title="3D Representation"][aria-disabled="false"]', { timeout: TIMEOUT * 3 })
await RxD_page.waitForSelector(selectors.MODEL_BUTTON_SELECTOR, { timeout: TIMEOUT });
await RxD_page.click(selectors.MODEL_BUTTON_SELECTOR, { timeout: TIMEOUT });
await RxD_page.waitForSelector(selectors.SIMULATE_NETWORK_SELECTOR, { timeout: TIMEOUT });
Expand All @@ -161,12 +161,16 @@ describe('RxD testing', () => {

})

it('Check RxD Plot', async () => {
it.skip('Check RxD Plot', async () => {
console.log('Opening the RxD plot ...')

await RxD_page.waitForSelector('div[title="RxD concentration plot"][aria-disabled="false"]', { timeout: TIMEOUT * 3 })
await RxD_page.click('div[title="RxD concentration plot"][aria-disabled="false"]')
await RxD_page.waitForSelector('div.flexlayout__tabset')
await RxD_page.waitForFunction(
selector => document.querySelectorAll(selector).length === 2,
{ timeout: TIMEOUT },
'div.flexlayout__tabset'
);

console.log('... taking snapshot ...');
await RxD_page.waitForTimeout(PAGE_WAIT);
Expand All @@ -178,12 +182,16 @@ describe('RxD testing', () => {
await RxD_page.waitForTimeout(PAGE_WAIT);
console.log('Plot displayed')
})
it('Check LFP Time Series Plot', async () => {
it.skip('Check LFP Time Series Plot', async () => {
console.log('Opening the LFP TS plot ...')

await RxD_page.waitForSelector('div[title="LFP Time Series Plot"][aria-disabled="false"]', { timeout: TIMEOUT * 3 })
await RxD_page.click('div[title="LFP Time Series Plot"][aria-disabled="false"]')
await RxD_page.waitForSelector('div.flexlayout__tabset')
await RxD_page.waitForFunction(
selector => document.querySelectorAll(selector).length === 2,
{ timeout: TIMEOUT },
'div.flexlayout__tabset'
);

console.log('... taking snapshot ...');
await RxD_page.waitForTimeout(PAGE_WAIT);
Expand All @@ -195,12 +203,16 @@ describe('RxD testing', () => {
await RxD_page.waitForTimeout(PAGE_WAIT);
console.log('Plot displayed')
})
it('Check LFP PSD Plot', async () => {
it.skip('Check LFP PSD Plot', async () => {
console.log('Opening the LFP PSD plot ...')

await RxD_page.waitForSelector('div[title="LFP PSD Plot"][aria-disabled="false"]', { timeout: TIMEOUT * 3 })
await RxD_page.click('div[title="LFP PSD Plot"][aria-disabled="false"]')
await RxD_page.waitForSelector('div.flexlayout__tabset')
await RxD_page.waitForFunction(
selector => document.querySelectorAll(selector).length === 2,
{ timeout: TIMEOUT },
'div.flexlayout__tabset'
);

console.log('... taking snapshot ...');
await RxD_page.waitForTimeout(PAGE_WAIT);
Expand All @@ -214,7 +226,7 @@ describe('RxD testing', () => {

})

it('Go back to Edit', async () => {
it.skip('Go back to Edit', async () => {

console.log('Going back to Edit ...')
await RxD_page.waitForSelector('.MuiButtonBase-root.MuiButton-root.MuiButton-contained')
Expand All @@ -228,7 +240,7 @@ describe('RxD testing', () => {
})

it('Open RxD Tab ', async () => {

console.log('Opening RxD tab ...')
await RxD_page.waitForSelector('div[title="Reaction-Diffusion"]')
await RxD_page.click('div[title="Reaction-Diffusion"]')
Expand All @@ -250,7 +262,7 @@ describe('RxD testing', () => {
await RxD_page.waitForSelector('#ip3')
console.log('Species tab opened')
await RxD_page.waitForTimeout(PAGE_WAIT)

})

it('Increase IP3 species concentration', async () => {
Expand Down Expand Up @@ -279,24 +291,29 @@ describe('RxD testing', () => {

})


it('Create and Simulate Network', async () => {

await RxD_page.waitForSelector(selectors.MODEL_BUTTON_SELECTOR)
await RxD_page.waitForSelector(selectors.MODEL_BUTTON_SELECTOR, { timeout: TIMEOUT })
await RxD_page.click(selectors.MODEL_BUTTON_SELECTOR);
await RxD_page.waitForSelector(selectors.CREATE_AND_SIMULATE_NETWORK_SELECTOR)
await RxD_page.click(selectors.CREATE_AND_SIMULATE_NETWORK_SELECTOR, { timeout: TIMEOUT });
await RxD_page.waitForSelector(selectors.CREATE_NETWORK_SELECTOR, { timeout: TIMEOUT })
await RxD_page.click(selectors.CREATE_NETWORK_SELECTOR, { timeout: TIMEOUT });

console.log('Creating and simulating network ...')
console.log('Creating network ...')

await RxD_page.waitForTimeout(PAGE_WAIT * 3)

await RxD_page.waitForSelector('div[title="3D Representation"][aria-disabled="false"]', { timeout: TIMEOUT * 3 })
await RxD_page.waitForSelector(selectors.MODEL_BUTTON_SELECTOR, { timeout: TIMEOUT });
await RxD_page.click(selectors.MODEL_BUTTON_SELECTOR, { timeout: TIMEOUT });
await RxD_page.waitForSelector(selectors.SIMULATE_NETWORK_SELECTOR, { timeout: TIMEOUT });
await RxD_page.click(selectors.SIMULATE_NETWORK_SELECTOR, { timeout: TIMEOUT });
console.log('Simulating network ...')

await RxD_page.waitForSelector('div[title="Raster plot"][aria-disabled="false"]', { timeout: TIMEOUT * 3 })
await RxD_page.waitForSelector('div[title="RxD concentration plot"][aria-disabled="false"]', { timeout: TIMEOUT * 3 })

await RxD_page.waitForTimeout(PAGE_WAIT)

console.log('Network created and simulated')
})

it('Check RxD Plot', async () => {
Expand All @@ -305,7 +322,11 @@ describe('RxD testing', () => {

await RxD_page.waitForSelector('div[title="RxD concentration plot"][aria-disabled="false"]', { timeout: TIMEOUT * 3 })
await RxD_page.click('div[title="RxD concentration plot"][aria-disabled="false"]')
await RxD_page.waitForSelector('div.flexlayout__tabset')
await RxD_page.waitForFunction(
selector => document.querySelectorAll(selector).length === 2,
{ timeout: TIMEOUT },
'div.flexlayout__tabset'
);

console.log('... taking snapshot ...');
await RxD_page.waitForTimeout(PAGE_WAIT);
Expand All @@ -323,7 +344,11 @@ describe('RxD testing', () => {

await RxD_page.waitForSelector('div[title="LFP Time Series Plot"][aria-disabled="false"]', { timeout: TIMEOUT * 3 })
await RxD_page.click('div[title="LFP Time Series Plot"][aria-disabled="false"]')
await RxD_page.waitForSelector('div.flexlayout__tabset')
await RxD_page.waitForFunction(
selector => document.querySelectorAll(selector).length === 2,
{ timeout: TIMEOUT },
'div.flexlayout__tabset'
);

console.log('... taking snapshot ...');
await RxD_page.waitForTimeout(PAGE_WAIT);
Expand All @@ -341,7 +366,11 @@ describe('RxD testing', () => {

await RxD_page.waitForSelector('div[title="LFP PSD Plot"][aria-disabled="false"]', { timeout: TIMEOUT * 3 })
await RxD_page.click('div[title="LFP PSD Plot"][aria-disabled="false"]')
await RxD_page.waitForSelector('div.flexlayout__tabset')
await RxD_page.waitForFunction(
selector => document.querySelectorAll(selector).length === 2,
{ timeout: TIMEOUT },
'div.flexlayout__tabset'
);

console.log('... taking snapshot ...');
await RxD_page.waitForTimeout(PAGE_WAIT);
Expand Down

0 comments on commit 421bbd0

Please sign in to comment.