File size: 1,387 Bytes
cb5b71d
 
 
 
 
 
 
 
 
 
0c5b67f
cb5b71d
6a31b9a
 
 
cb5b71d
 
 
6a31b9a
 
 
cb5b71d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/// <reference types="cypress" />

import 'cypress-file-upload';
import 'cypress-iframe';


describe('Create a resource manually', () => {
  it('should allow adding a FileObject resource', () => {
    // Streamlit starts on :8501.
    cy.visit('http://localhost:8501')
    cy.get('button').contains('Create').click()
    cy.get('input[aria-label="Name:red[*]"]').type('MyDataset').blur()
    cy.enter('[title="components.tabs.tabs_component"]').then(getBody => {
      getBody().contains('Metadata').click()
    })
    cy.get('input[aria-label="URL:red[*]"]').type('https://mydataset.com', {force: true})
    
    // Create a resource manually.
    cy.enter('[title="components.tabs.tabs_component"]').then(getBody => {
      getBody().contains('Resources').click()
    })
    cy.get('[data-testid="stMarkdownContainer"]').contains('Add manually').click()

    cy.get('input[aria-label="File name:red[*]"]').type('test.csv').blur()
    cy.get('input[aria-label="SHA256"]').type('abcdefgh1234567').blur()
    cy.get('button').contains('Upload').click()

    // The file is created, so we can click on it to see the details.
    cy.enter('[title="components.tree.tree_component"]').then(getBody => {
      getBody().contains('test.csv').click()
    })

    cy.get('input[aria-label="SHA256:red[*]"]')
        .should('be.disabled')
        .should('have.value', 'abcdefgh1234567')
  })
})