Instead of using visit(url), whenever possible we should use some method
that makes the app do the routing. One way is to use the search bar with
UUIDs, as it will use the route to the proper resource panel.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>
cy.clearLocalStorage();
});
cy.clearLocalStorage();
});
- it.only('shows collection by URL', function() {
+ it('shows collection by URL', function() {
cy.loginAs(activeUser);
[true, false].map(function(isWritable) {
cy.createGroup(adminUser.token, {
cy.loginAs(activeUser);
[true, false].map(function(isWritable) {
cy.createGroup(adminUser.token, {
head_uuid: this.sharedGroup.uuid,
tail_uuid: activeUser.user.uuid
})
head_uuid: this.sharedGroup.uuid,
tail_uuid: activeUser.user.uuid
})
- cy.visit(`/collections/${this.testCollection.uuid}`);
-
- cy.get('[data-cy=linear-progress]').should('exist');
- cy.get('[data-cy=linear-progress]').should('not.exist');
+ cy.doSearch(`${this.testCollection.uuid}`);
// Check that name & uuid are correct.
cy.get('[data-cy=collection-info-panel]')
// Check that name & uuid are correct.
cy.get('[data-cy=collection-info-panel]')
manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
.as('testCollection').then(function() {
cy.loginAs(activeUser);
manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
.as('testCollection').then(function() {
cy.loginAs(activeUser);
- cy.visit(`/collections/${this.testCollection.uuid}`);
-
- cy.get('[data-cy=linear-progress]').should('exist');
- cy.get('[data-cy=linear-progress]').should('not.exist');
+ cy.doSearch(`${this.testCollection.uuid}`);
const nameTransitions = [
['bar', '&'],
const nameTransitions = [
['bar', '&'],
manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
.as('testCollection').then(function() {
cy.loginAs(activeUser);
manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
.as('testCollection').then(function() {
cy.loginAs(activeUser);
- cy.visit(`/collections/${this.testCollection.uuid}`);
-
- cy.get('[data-cy=linear-progress]').should('exist');
- cy.get('[data-cy=linear-progress]').should('not.exist');
+ cy.doSearch(`${this.testCollection.uuid}`);
// Rename 'bar' to 'subdir/foo'
cy.get('[data-cy=collection-files-panel]')
// Rename 'bar' to 'subdir/foo'
cy.get('[data-cy=collection-files-panel]')
manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
.as('testCollection').then(function() {
cy.loginAs(activeUser);
manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
.as('testCollection').then(function() {
cy.loginAs(activeUser);
- cy.visit(`/collections/${this.testCollection.uuid}`);
-
- cy.get('[data-cy=linear-progress]').should('exist');
- cy.get('[data-cy=linear-progress]').should('not.exist');
+ cy.doSearch(`${this.testCollection.uuid}`);
const illegalNamesFromUI = [
['.', "Name cannot be '.' or '..'"],
const illegalNamesFromUI = [
['.', "Name cannot be '.' or '..'"],
});
// Check the old version displays as what it is.
cy.loginAs(activeUser)
});
// Check the old version displays as what it is.
cy.loginAs(activeUser)
- cy.visit(`/collections/${oldVersionUuid}`);
-
- cy.get('[data-cy=linear-progress]').should('exist');
- cy.get('[data-cy=linear-progress]').should('not.exist');
+ cy.doSearch(`${oldVersionUuid}`);
cy.get('[data-cy=collection-info-panel]').should('contain', 'This is an old version');
cy.get('[data-cy=read-only-icon]').should('exist');
cy.get('[data-cy=collection-info-panel]').should('contain', 'This is an old version');
cy.get('[data-cy=read-only-icon]').should('exist');
.as('collection').then(function() {
// Visit collection, check basic information
cy.loginAs(activeUser)
.as('collection').then(function() {
// Visit collection, check basic information
cy.loginAs(activeUser)
- cy.visit(`/collections/${this.collection.uuid}`);
-
- cy.get('[data-cy=linear-progress]').should('exist');
- cy.get('[data-cy=linear-progress]').should('not.exist');
+ cy.doSearch(`${this.collection.uuid}`);
cy.get('[data-cy=collection-info-panel]').should('not.contain', 'This is an old version');
cy.get('[data-cy=read-only-icon]').should('not.exist');
cy.get('[data-cy=collection-info-panel]').should('not.contain', 'This is an old version');
cy.get('[data-cy=read-only-icon]').should('not.exist');
})
.as('testCollection').then(function () {
cy.loginAs(activeUser);
})
.as('testCollection').then(function () {
cy.loginAs(activeUser);
- cy.visit(`/collections/${this.testCollection.uuid}`);
-
- cy.get('[data-cy=linear-progress]').should('exist');
- cy.get('[data-cy=linear-progress]').should('not.exist');
+ cy.doSearch(`${this.testCollection.uuid}`);
cy.get('[data-cy=collection-files-panel]').within(() => {
cy.get('[type="checkbox"]').first().check();
cy.get('[data-cy=collection-files-panel]').within(() => {
cy.get('[type="checkbox"]').first().check();
})
.as('testCollection').then(function () {
cy.loginAs(activeUser);
})
.as('testCollection').then(function () {
cy.loginAs(activeUser);
- cy.visit(`/collections/${this.testCollection.uuid}`);
-
- cy.get('[data-cy=linear-progress]').should('exist');
- cy.get('[data-cy=linear-progress]').should('not.exist');
+ cy.doSearch(`${this.testCollection.uuid}`);
cy.get('[data-cy=virtual-file-tree] > div > i').first().click();
cy.get('[data-cy=collection-files-panel]')
cy.get('[data-cy=virtual-file-tree] > div > i').first().click();
cy.get('[data-cy=collection-files-panel]')
cy.loginAs(activeUser);
const searchQuery = `${colName} type:arvados#collection`;
// Search for only collection's current version
cy.loginAs(activeUser);
const searchQuery = `${colName} type:arvados#collection`;
// Search for only collection's current version
- cy.visit(`/search-results?q=${encodeURIComponent(searchQuery)}`);
+ cy.doSearch(`${searchQuery}`);
cy.get('[data-cy=search-results]').should('contain', 'head version');
cy.get('[data-cy=search-results]').should('not.contain', 'version 1');
// ...and then, include old versions.
cy.get('[data-cy=search-results]').should('contain', 'head version');
cy.get('[data-cy=search-results]').should('not.contain', 'version 1');
// ...and then, include old versions.
- cy.visit(`/search-results?q=${encodeURIComponent(searchQuery + ' is:pastVersion')}`);
+ cy.doSearch(`${searchQuery} is:pastVersion`);
cy.get('[data-cy=search-results]').should('contain', 'head version');
cy.get('[data-cy=search-results]').should('contain', 'version 1');
});
cy.get('[data-cy=search-results]').should('contain', 'head version');
cy.get('[data-cy=search-results]').should('contain', 'version 1');
});
it('enables the +NEW side panel button on users home project', function() {
cy.loginAs(activeUser);
it('enables the +NEW side panel button on users home project', function() {
cy.loginAs(activeUser);
- cy.visit(`/projects/${activeUser.user.uuid}`);
+ cy.doSearch(`${activeUser.user.uuid}`);
cy.get('[data-cy=side-panel-button]')
.should('exist')
.and('not.be.disabled');
cy.get('[data-cy=side-panel-button]')
.should('exist')
.and('not.be.disabled');
head_uuid: this.sharedGroup.uuid,
tail_uuid: activeUser.user.uuid
})
head_uuid: this.sharedGroup.uuid,
tail_uuid: activeUser.user.uuid
})
- cy.visit(`/projects/${this.sharedGroup.uuid}`);
+ cy.doSearch(`${this.sharedGroup.uuid}`);
cy.get('[data-cy=side-panel-button]')
.should('exist')
.and(`${isWritable ? 'not.' : ''}be.disabled`);
cy.get('[data-cy=side-panel-button]')
.should('exist')
.and(`${isWritable ? 'not.' : ''}be.disabled`);
it('creates new collection on home project', function() {
cy.loginAs(activeUser);
it('creates new collection on home project', function() {
cy.loginAs(activeUser);
- cy.visit(`/projects/${activeUser.user.uuid}`);
+ cy.doSearch(`${activeUser.user.uuid}`);
cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
cy.get('[data-cy=breadcrumb-last]').should('not.exist');
// Create new collection
cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
cy.get('[data-cy=breadcrumb-last]').should('not.exist');
// Create new collection
}
cy.loginAs(activeUser);
}
cy.loginAs(activeUser);
- cy.visit(`/projects/${activeUser.user.uuid}`);
+ cy.doSearch(`${activeUser.user.uuid}`);
cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
cy.get('[data-cy=breadcrumb-last]').should('not.exist');
// Create new project
cy.get('[data-cy=breadcrumb-first]').should('contain', 'Projects');
cy.get('[data-cy=breadcrumb-last]').should('not.exist');
// Create new project
Cypress.Commands.add(
"loginAs", (user) => {
cy.visit(`/token/?api_token=${user.token}`);
Cypress.Commands.add(
"loginAs", (user) => {
cy.visit(`/token/?api_token=${user.token}`);
- cy.get('[data-cy=loading-spinner]').should('exist');
- cy.get('[data-cy=loading-spinner]').should('not.exist');
cy.url().should('contain', '/projects/');
cy.get('div#root').should('contain', 'Arvados Workbench (zzzzz)');
cy.get('div#root').should('not.contain', 'Your account is inactive');
}
)
cy.url().should('contain', '/projects/');
cy.get('div#root').should('contain', 'Arvados Workbench (zzzzz)');
cy.get('div#root').should('not.contain', 'Your account is inactive');
}
)
+
+Cypress.Commands.add(
+ "doSearch", (searchTerm) => {
+ cy.get('[data-cy=searchbar-input-field]').type(`{selectall}${searchTerm}{enter}`);
+ }
+)
\ No newline at end of file
<Paper className={isPopoverOpen ? classes.containerSearchViewOpened : classes.container} >
<form onSubmit={this.handleSubmit}>
<Input
<Paper className={isPopoverOpen ? classes.containerSearchViewOpened : classes.container} >
<form onSubmit={this.handleSubmit}>
<Input
- data-cy='search-input-field'
+ data-cy='searchbar-input-field'
className={classes.input}
onChange={this.handleChange}
placeholder="Search"
className={classes.input}
onChange={this.handleChange}
placeholder="Search"