Skip to content

Commit 4a691fd

Browse files
authored
Merge pull request #167 from jahn96/server_settings
Server settings
2 parents 66bc95f + 888a234 commit 4a691fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+5228
-2342
lines changed

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
. "$(dirname "$0")/_/husky.sh"
4+
5+
npx --no-install lint-staged
6+
jlpm lint-staged

babel.config.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
module.exports = {
2-
presets: [
3-
[
4-
'@babel/preset-env',
5-
{
6-
targets: {
7-
node: 'current'
8-
}
9-
}
10-
], '@babel/preset-react'
11-
]
12-
};
1+
module.exports = require('@jupyterlab/testutils/lib/babel.config');
2+
// module.exports = {
3+
// presets: [
4+
// [
5+
// '@babel/preset-env',
6+
// {
7+
// targets: {
8+
// node: 'current'
9+
// }
10+
// }
11+
// ], '@babel/preset-react'
12+
// ]
13+
// };

cypress.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

cypress/fixtures/example.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "hello@cypress.io",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
describe('Test Code Snippet Extension on load', () => {
2+
beforeEach(() => {
3+
cy.visit('http://localhost:8888/lab')
4+
})
5+
6+
// it('Create code snippet settings on load', () => {
7+
// cy.get('.jp-PluginList > ul > li').eq(1).should('have.attr', 'data-id', 'jupyterlab-code-snippets:snippets')
8+
// })
9+
10+
it('Create default snippets in the beginning', () => {
11+
cy.get('.jp-codeSnippetsContainer').find('.jp-codeSnippet-item').should('have.length', 3)
12+
})
13+
})
14+
15+
describe('Test Code Snippet Manipulation', () => {
16+
beforeEach(() => {
17+
cy.visit('http://localhost:8888/lab')
18+
})
19+
20+
it('Create a new code snippet', () => {
21+
// adding a snippet
22+
cy.get('.jp-Notebook').rightclick()
23+
.get('.lm-Menu-itemLabel').eq(13).click()
24+
.wait(500)
25+
.get('.jp-codeSnippet-dialog-input').eq(0).click().type("test").should('have.value', 'test')
26+
.wait(500)
27+
.get('.jp-codeSnippet-dialog-input').eq(1).click().type("testing with cypress").should('have.value', 'testing with cypress')
28+
.wait(500)
29+
.get('.jp-codeSnippet-dialog-input').eq(2).click().type("Python").should('have.value', 'Python')
30+
.get('.jp-mod-accept').click();
31+
32+
cy.get('.lm-Widget').eq(0).click({force: true});
33+
34+
// checking the snippet
35+
cy.get('.jp-codeSnippetsContainer').find('.jp-codeSnippet-item').should('have.length', 4);
36+
})
37+
38+
it('Delete a new code snippet', () => {
39+
// delete snippet
40+
cy.get('.jp-codeSnippet-item #0 > .jp-codeSnippetsContainer-button').click()
41+
.get('.jp-codeSnippet-more-options-delete').click()
42+
.get('.jp-mod-accept').click()
43+
44+
// checking the snippet
45+
cy.get('.jp-codeSnippetsContainer').find('.jp-codeSnippet-item').should('have.length', 3);
46+
})
47+
48+
it('Renaming a snippet', () => {
49+
cy.wait(500)
50+
// rename snippet
51+
cy.get('.jp-codeSnippet-item #0 > .jp-codeSnippetsContainer-name > span').eq(1).dblclick()
52+
.get('#jp-codeSnippet-rename').type('new_test')
53+
54+
cy.wait(500)
55+
// rename with duplicate name
56+
cy.get('.jp-codeSnippet-item #1 > .jp-codeSnippetsContainer-name > span').eq(1).dblclick()
57+
.get('#jp-codeSnippet-rename').type('new_test')
58+
.get('.lm-StackedPanel').eq(0).click({force:true})
59+
.get('.jp-mod-accept').click()
60+
61+
})
62+
63+
it('Create a new code snippet from scratch', () => {
64+
cy.get('.jp-createSnippetBtn').click().get('.jp-codeSnippet-editor-name').type('create_test').should('have.value', 'create_test')
65+
.get('.jp-codeSnippet-editor-description').type('testing').should('have.value', 'testing')
66+
.get('.saveBtn').click()
67+
})
68+
69+
it.only('Edit a snippet', () => {
70+
cy.get('.jp-codeSnippet-item #0 > .jp-codeSnippetsContainer-button').click()
71+
.get('.jp-codeSnippet-more-options-edit').click()
72+
.wait(500)
73+
.get('.jp-codeSnippet-editor-name').clear().type('test_editing').should('have.value', 'test_editing')
74+
.wait(500)
75+
.get('.jp-codeSnippet-editor-name').clear().type('test_editing').should('have.value', 'test_editing')
76+
.get('.saveBtn').click()
77+
78+
cy.get('.jp-codeSnippet-item #0 > .jp-codeSnippetsContainer-name > span').eq(1).contains('test_editing')
79+
})
80+
// it.only('moving a snippet', () => {
81+
// cy.visit('http://localhost:8888/lab')
82+
83+
// cy.wait(500)
84+
// cy.get('.jp-codeSnippet-drag-hover').eq(0)
85+
// .dragTo(':nth-child(3) > .jp-codeSnippet-metadata')
86+
// .get('.jp-codeSnippet-item #1 > .jp-codeSnippetsContainer-name > span').eq(1).contains('test')
87+
// })
88+
})

0 commit comments

Comments
 (0)