-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #681 from nextcloud/test/676
- Loading branch information
Showing
5 changed files
with
254 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
let localUser | ||
const columnTitle = 'date and time' | ||
const tableTitle = 'Test datetime' | ||
|
||
describe('Test column ' + columnTitle, () => { | ||
|
||
before(function() { | ||
cy.createRandomUser().then(user => { | ||
localUser = user | ||
cy.login(localUser) | ||
}) | ||
}) | ||
|
||
beforeEach(function() { | ||
cy.login(localUser) | ||
cy.visit('apps/tables') | ||
}) | ||
|
||
it('Table and column setup', () => { | ||
cy.createTable(tableTitle) | ||
}) | ||
|
||
it('Insert and test rows', () => { | ||
cy.loadTable(tableTitle) | ||
cy.createDatetimeColumn(columnTitle, null, true) | ||
|
||
// insert row with int value | ||
cy.get('button').contains('Create row').click() | ||
cy.get('.modal__content input').first().clear().type('2023-12-24 05:15') | ||
cy.get('.modal-container .checkbox-radio-switch label').click().click() | ||
cy.get('button').contains('Save').click() | ||
cy.get('.custom-table table tr td div').contains('24').should('be.visible') | ||
cy.get('.custom-table table tr td div').contains('Dec').should('be.visible') | ||
cy.get('.custom-table table tr td div').contains('2023').should('be.visible') | ||
cy.get('.custom-table table tr td div').contains('5:15').should('be.visible') | ||
|
||
// delete row | ||
cy.get('.NcTable tr td button').first().click() | ||
cy.get('button').contains('Delete').click() | ||
cy.get('button').contains('I really').click() | ||
|
||
cy.removeColumn(columnTitle) | ||
}) | ||
|
||
it('Insert and test rows - default now', () => { | ||
cy.loadTable(tableTitle) | ||
cy.createDatetimeColumn(columnTitle, true, true) | ||
|
||
// insert row with int value | ||
cy.get('button').contains('Create row').click() | ||
const hour = new Date().getHours().toString().length < 2 ? '0' + new Date().getHours() : new Date().getHours().toString() | ||
const minutes = new Date().getMinutes().toString().length < 2 ? '0' + new Date().getMinutes() : new Date().getMinutes().toString() | ||
const date = new Date().toISOString().slice(2, 10) | ||
const datetime = date + ' ' + hour + ':' + minutes | ||
cy.get('.modal__content input').first().should('contain.value', '20' + datetime) | ||
cy.get('.modal-container .checkbox-radio-switch label').click().click() | ||
cy.get('button').contains('Save').click() | ||
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', | ||
'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'] | ||
cy.get('.custom-table table tr td div').contains(new Date().getDate()).should('be.visible') | ||
cy.get('.custom-table table tr td div').contains(monthNames[new Date().getMonth()]).should('be.visible') | ||
cy.get('.custom-table table tr td div').contains(new Date().getFullYear()).should('be.visible') | ||
cy.get('.custom-table table tr td div').contains(':' + minutes).should('be.visible') | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
let localUser | ||
const columnTitle = 'date' | ||
const tableTitle = 'Test datetime date' | ||
|
||
describe('Test column ' + columnTitle, () => { | ||
|
||
before(function() { | ||
cy.createRandomUser().then(user => { | ||
localUser = user | ||
cy.login(localUser) | ||
}) | ||
}) | ||
|
||
beforeEach(function() { | ||
cy.login(localUser) | ||
cy.visit('apps/tables') | ||
}) | ||
|
||
it('Table and column setup', () => { | ||
cy.createTable(tableTitle) | ||
}) | ||
|
||
it('Insert and test rows', () => { | ||
cy.loadTable(tableTitle) | ||
cy.createDatetimeDateColumn(columnTitle, null, true) | ||
|
||
// insert row with int value | ||
cy.get('button').contains('Create row').click() | ||
cy.get('.modal__content input').first().clear().type('2023-12-24') | ||
cy.get('.modal-container .checkbox-radio-switch label').click().click() | ||
cy.get('button').contains('Save').click() | ||
cy.get('.custom-table table tr td div').contains('24').should('be.visible') | ||
cy.get('.custom-table table tr td div').contains('Dec').should('be.visible') | ||
cy.get('.custom-table table tr td div').contains('2023').should('be.visible') | ||
|
||
// delete row | ||
cy.get('.NcTable tr td button').first().click() | ||
cy.get('button').contains('Delete').click() | ||
cy.get('button').contains('I really').click() | ||
|
||
cy.removeColumn(columnTitle) | ||
}) | ||
|
||
it('Insert and test rows - default now', () => { | ||
cy.loadTable(tableTitle) | ||
cy.createDatetimeDateColumn(columnTitle, true, true) | ||
|
||
// insert row with int value | ||
cy.get('button').contains('Create row').click() | ||
const date = new Date().toISOString().slice(2, 10) | ||
cy.get('.modal__content input').first().should('contain.value', date) | ||
cy.get('.modal-container .checkbox-radio-switch label').click().click() | ||
cy.get('button').contains('Save').click() | ||
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', | ||
'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec'] | ||
const datetime2 = new Date().getDate() + ' ' + monthNames[new Date().getMonth()] + ' ' + new Date().getFullYear() | ||
cy.log(datetime2) | ||
cy.get('.custom-table table tr td div').contains(new Date().getDate()).should('be.visible') | ||
cy.get('.custom-table table tr td div').contains(monthNames[new Date().getMonth()]).should('be.visible') | ||
cy.get('.custom-table table tr td div').contains(new Date().getFullYear()).should('be.visible') | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
let localUser | ||
const columnTitle = 'time' | ||
const tableTitle = 'Test datetime time' | ||
|
||
describe('Test column ' + columnTitle, () => { | ||
|
||
before(function() { | ||
cy.createRandomUser().then(user => { | ||
localUser = user | ||
cy.login(localUser) | ||
}) | ||
}) | ||
|
||
beforeEach(function() { | ||
cy.login(localUser) | ||
cy.visit('apps/tables') | ||
}) | ||
|
||
it('Table and column setup', () => { | ||
cy.createTable(tableTitle) | ||
}) | ||
|
||
it('Insert and test rows', () => { | ||
cy.loadTable(tableTitle) | ||
cy.createDatetimeTimeColumn(columnTitle, null, true) | ||
|
||
// insert row with int value | ||
cy.get('button').contains('Create row').click() | ||
cy.get('.modal__content input').first().clear().type('05:15') | ||
cy.get('.modal-container .checkbox-radio-switch label').click().click() | ||
cy.get('button').contains('Save').click() | ||
cy.get('.custom-table table tr td div').contains('5:15').should('be.visible') | ||
|
||
// delete row | ||
cy.get('.NcTable tr td button').first().click() | ||
cy.get('button').contains('Delete').click() | ||
cy.get('button').contains('I really').click() | ||
|
||
cy.removeColumn(columnTitle) | ||
}) | ||
|
||
it('Insert and test rows - default now', () => { | ||
cy.loadTable(tableTitle) | ||
cy.createDatetimeTimeColumn(columnTitle, true, true) | ||
|
||
// insert row with int value | ||
cy.get('button').contains('Create row').click() | ||
const minutes = ':' + new Date().getMinutes().toString().length < 2 ? '0' + new Date().getMinutes() : new Date().getMinutes().toString() | ||
cy.get('.modal__content input').first().should('contain.value', minutes) | ||
cy.get('.modal-container .checkbox-radio-switch label').click().click() | ||
cy.get('button').contains('Save').click() | ||
cy.get('.custom-table table tr td div').contains(minutes).should('be.visible') | ||
}) | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters