mirror of
https://github.com/bitnami/charts.git
synced 2026-02-28 15:37:42 +08:00
[bitnami/jupyterhub] Fixes jupyterhub testing (#26353)
* Fixes jupyterhub testing Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com> * Update jupyterhub.cy.js Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com> --------- Signed-off-by: Rafael Rios Saavedra <rrios@vmware.com>
This commit is contained in:
committed by
GitHub
parent
522582196e
commit
cfe910609f
@@ -7,43 +7,47 @@
|
||||
import { random } from '../support/utils';
|
||||
|
||||
it('allows to upload and execute a python notebook', () => {
|
||||
const notebookName = `notebook_template_${random}.ipynb`;
|
||||
const userName = Cypress.env('username');
|
||||
cy.session('test_upload', () => {
|
||||
const notebookName = `notebook_template_${random}.ipynb`;
|
||||
const userName = Cypress.env('username');
|
||||
|
||||
cy.login();
|
||||
cy.visit(`/user/${userName}/tree/tmp`);
|
||||
cy.contains('Upload').should('be.visible');
|
||||
cy.get('[type=file]').selectFile('cypress/fixtures/notebook_template.ipynb', {
|
||||
force: true,
|
||||
cy.login();
|
||||
cy.visit(`/user/${userName}/tree/tmp`);
|
||||
cy.contains('Upload').should('be.visible');
|
||||
cy.get('[type=file]').selectFile('cypress/fixtures/notebook_template.ipynb', {
|
||||
force: true,
|
||||
});
|
||||
cy.get('.filename_input').clear().type(notebookName);
|
||||
cy.contains('button', 'Upload').click();
|
||||
cy.contains('a', notebookName);
|
||||
|
||||
cy.visit(`/user/${userName}/notebooks/tmp/${notebookName}`);
|
||||
cy.contains('button', 'Run').click();
|
||||
cy.contains('Hello World!');
|
||||
});
|
||||
cy.get('.filename_input').clear().type(notebookName);
|
||||
cy.contains('button', 'Upload').click();
|
||||
cy.contains('a', notebookName);
|
||||
|
||||
cy.visit(`/user/${userName}/notebooks/tmp/${notebookName}`);
|
||||
cy.contains('button', 'Run').click();
|
||||
cy.contains('Hello World!');
|
||||
});
|
||||
|
||||
it('allows generating an API token', () => {
|
||||
cy.login();
|
||||
cy.visit('/hub/token');
|
||||
// We need to wait until the background API request is finished
|
||||
cy.contains(/\d+Z/).should('not.exist');
|
||||
cy.contains('button', 'API token').click();
|
||||
cy.get('#token-result')
|
||||
.should('be.visible')
|
||||
.invoke('text')
|
||||
.then((apiToken) => {
|
||||
cy.request({
|
||||
url: '/hub/api/users',
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `token ${apiToken}`,
|
||||
},
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.body[0].name).to.eq(Cypress.env('username'));
|
||||
cy.session('test_token', () => {
|
||||
cy.login();
|
||||
cy.visit('/hub/token');
|
||||
// We need to wait until the background API request is finished
|
||||
cy.contains(/\d+Z/).should('not.exist');
|
||||
cy.contains('button', 'API token').click();
|
||||
cy.get('#token-result')
|
||||
.should('be.visible')
|
||||
.invoke('text')
|
||||
.then((apiToken) => {
|
||||
cy.request({
|
||||
url: '/hub/api/users',
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `token ${apiToken}`,
|
||||
},
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
expect(response.body[0].name).to.eq(Cypress.env('username'));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user