Skip to content

Commit

Permalink
Cypress update tests (#136)
Browse files Browse the repository at this point in the history
* Initial commit - updating fixtures

* Finish unskipping tests

* Move some files around

* rebuild css
  • Loading branch information
brdunfield authored Jan 10, 2024
1 parent 2e370ed commit 00ba3b5
Show file tree
Hide file tree
Showing 14 changed files with 777 additions and 1,253 deletions.
45 changes: 23 additions & 22 deletions cypress/e2e/dataset-stubbed.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@ context('Dataset stubbed', () => {
})

// add check to make sure message updates to correct amount of rows
it.skip('I can filter the each table individually', () => {
cy.get(`#resource_1234abcd .dc-datatable > .dc-table > :nth-child(2) .tr > :nth-child(3) input`).type('35.08');
cy.get('.dc-tbody > :nth-child(3) > :nth-child(1)').should('contain', '57')
it('I can filter the each table individually', () => {
cy.get(`#resource_1234abcd .dc-datatable > thead > .tr > th:nth-child(3) input`).type('35.08');
cy.wait(500);
cy.get('.dc-tbody > :nth-child(3) > :nth-child(1)').should('contain', '57');
cy.get(`#resource_1234abcd .data-table-results`).contains('1 - 20 of 26 rows')
})

it.skip('I can sort each table individually', () => {
cy.get(`#resource_1234abcd .dc-table > :nth-child(1) .tr > :nth-child(1)`).click()
cy.get(`#resource_1234abcd .dc-table .dc-tbody > :nth-child(1) > :nth-child(1)`).should('contain', '1')
cy.get(`#resource_1234abcd .dc-table > :nth-child(1) .tr > :nth-child(1)`).click()
cy.get(`#resource_1234abcd .dc-table .dc-tbody > :nth-child(1) > :nth-child(1)`).should('contain', '200')
cy.get(`#resource_1234abcd .dc-table > :nth-child(1) .tr > :nth-child(1)`).click()
cy.get(`#resource_1234abcd .dc-table .dc-tbody > :nth-child(1) > :nth-child(1)`).should('contain', '1')
it('I can sort each table individually', () => {
cy.get(`#resource_1234abcd .dc-datatable > thead > .tr > th:nth-child(1) .dc-sort > button`).click()
cy.get(`#resource_1234abcd .dc-tbody > :nth-child(1) > :nth-child(1)`).should('contain', '1')
cy.get(`#resource_1234abcd .dc-datatable > thead > .tr > th:nth-child(1) .dc-sort > button`).click()
cy.get(`#resource_1234abcd .dc-tbody > :nth-child(1) > :nth-child(1)`).should('contain', '200')
cy.get(`#resource_1234abcd .dc-datatable > thead > .tr > th:nth-child(1) .dc-sort > button`).click()
cy.get(`#resource_1234abcd .dc-tbody > :nth-child(1) > :nth-child(1)`).should('contain', '1')
})

it('I see the tags.', () => {
Expand Down Expand Up @@ -69,7 +70,7 @@ context('Dataset stubbed', () => {
})

// Add check to make sure message updates correctly
it.skip('I can select the number of rows per page in each table.', () => {
it('I can select the number of rows per page in each table.', () => {
cy.get(`#resource_1234abcd .-pageInfo`).should('contain', 'Page 1 of 10')
cy.get(`#resource_1234abcd .page-size-select`).select('50')
cy.get(`#resource_1234abcd .-pageInfo`, { timeout: 75000 }).should('contain', 'Page 1 of 4')
Expand Down Expand Up @@ -97,7 +98,7 @@ context('Dataset stubbed', () => {
cy.get(`#resource_1234abcd .dc-tbody > tr > :nth-child(1)`, { timeout: 40000 }).should('not.have.css', 'width', '217.5px')
})

it.skip('I can open and close Manage Columns', () => {
it('I can open and close Manage Columns', () => {
cy.get(`#resource_1234abcd #dc-modal-manage_columns-open`).click()
// cy.get('#react-aria-modal-dialog #dialog-title').should('contain', 'Display column')
// Test close button in top right
Expand All @@ -113,33 +114,33 @@ context('Dataset stubbed', () => {
cy.get(`#dc-modal-manage_columns`).should('not.exist');
})

it.skip('I can remove and add back data table columns on just one table', () => {
cy.get(`#resource_1234abcd .dc-table > :nth-child(1) .tr`, { timeout: 40000 }).children('.th').should('have.length', 3)
cy.get(`.dc-table > :nth-child(1) .tr .th`).should('contain', 'record_number')
it('I can remove and add back data table columns on just one table', () => {
cy.get(`#resource_1234abcd .dc-datatable > :nth-child(1) tr`, { timeout: 40000 }).children('th').should('have.length', 3)
cy.get(`.dc-datatable > :nth-child(1) tr th`).should('contain', 'record_number')
cy.get(`#resource_1234abcd #dc-modal-manage_columns-open`).click()
cy.get(`#dc-modal-manage_columns .dc-modal-body > :nth-child(1) label`).should('contain', 'record_number')
cy.get(`#dc-modal-manage_columns .dc-modal-body > :nth-child(1) label`).click()
cy.get(`#dc-modal-manage_columns-header-close`).click()
cy.get(`#resource_1234abcd .dc-table > :nth-child(1) .tr .th`).should('contain', 'date')
cy.get(`#resource_1234abcd .dc-table > :nth-child(1) .tr`, { timeout: 40000 }).children('.th').should('have.length', 2)
cy.get(`#resource_1234abcd .dc-datatable > :nth-child(1) tr th`).should('contain', 'date')
cy.get(`#resource_1234abcd .dc-datatable > :nth-child(1) tr`, { timeout: 40000 }).children('th').should('have.length', 2)
cy.get(`#resource_1234abcd #dc-modal-manage_columns-open`).click()
cy.get('#dc-modal-manage_columns .dc-modal-body > :nth-child(1) label').should('contain', 'record_number')
cy.get('#dc-modal-manage_columns .dc-modal-body > :nth-child(1) label').click()
cy.get('#dc-modal-manage_columns-header-close').click()
cy.get(`#resource_1234abcd .dc-table > :nth-child(1) .tr`, { timeout: 40000 }).children('.th').should('have.length', 3)
cy.get(`#resource_1234abcd .dc-table > :nth-child(1) .tr .th`, { timeout: 40000 }).should('contain', 'record_number')
cy.get(`#resource_1234abcd .dc-datatable > :nth-child(1) tr`, { timeout: 40000 }).children('th').should('have.length', 3)
cy.get(`#resource_1234abcd .dc-datatable > :nth-child(1) tr th`, { timeout: 40000 }).should('contain', 'record_number')
})

it.skip('I can reorder table columns on just one table', () => {
cy.get(`#resource_1234abcd .dc-table:first-of-type > :nth-child(1) > .tr > :nth-child(1)`, { timeout: 40000 }).should('contain', 'record_number')
it('I can reorder table columns on just one table', () => {
cy.get(`#resource_1234abcd .dc-datatable:first-of-type > :nth-child(1) > .tr > :nth-child(1)`, { timeout: 40000 }).should('contain', 'record_number')
cy.get(`#resource_1234abcd #dc-modal-manage_columns-open`).click()
cy.get(`#dc-modal-manage_columns .dc-modal-body > :nth-child(2)`)
.trigger('dragstart')
cy.get(`#dc-modal-manage_columns .dc-modal-body > :nth-child(1)`)
.trigger('dragover')
.trigger('drop')
cy.get(`#dc-modal-manage_columns-close`).click()
cy.get(`#resource_1234abcd .dc-table:first-of-type > :nth-child(1) > .tr > :nth-child(1)`, { timeout: 40000 }).should('contain', 'date')
cy.get(`#resource_1234abcd .dc-datatable:first-of-type > :nth-child(1) > .tr > :nth-child(1)`, { timeout: 40000 }).should('contain', 'date')
})

})
5 changes: 3 additions & 2 deletions cypress/e2e/search-stubbed.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ context('Search stubbed', () => {
});

// FULLTEXT FILTER
it.skip('I can use the text input filter', () => {
it('I can use the text input filter', () => {
cy.stubSearchResults('/search');
const placholder = 'Type your search term here';
const filteredFacets = [
Expand Down Expand Up @@ -72,7 +72,7 @@ context('Search stubbed', () => {
});

// TAG FILTER
it.skip('I can use the tag filter', () => {
it('I can use the tag filter', () => {
cy.stubSearchResults('/search');
cy.get('.dc-search-results-message').contains('10 datasets found');
cy.get(searchList).children().its('length').should('eq', 10);
Expand All @@ -85,6 +85,7 @@ context('Search stubbed', () => {
cy.findByText('Finance and Budgeting (3)').should('exist');
cy.findByRole('heading', {name: 'London Deprivation Index'}).should('exist');
cy.findByRole('heading', {name: 'US National Foreclosure Statistics January 2012'}).should('exist');
cy.findByRole('button', {name: 'Show 9 more'}).click();
// Click united kingdom
cy.wait(500)
cy.findByText('United Kingdom (1)').click();
Expand Down
158 changes: 158 additions & 0 deletions cypress/fixtures/dataset/datasetResultsSorted.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
{
"count": 200,
"schema": {
"1234abcd": {
"fields": {

"record_number":{
"type":"text",
"description":""
},
"date":{
"type":"text",
"description":"CMS Certification Number (CCN)"
},
"price":{
"type":"text",
"description":"Facility Name"
}
}
},
"2a6924b6-f8bb-5c85-93d8-1744fa1e2093": {
"fields": {

"record_number":{
"type":"text",
"description":""
},
"date":{
"type":"text",
"description":"CMS Certification Number (CCN)"
},
"price":{
"type":"text",
"description":"Facility Name"
}
}
},
"18665dfe-b31e-5ccf-9325-97c9833c6804": {
"fields": {

"record_number":{
"type":"text",
"description":""
},
"date":{
"type":"text",
"description":"CMS Certification Number (CCN)"
},
"price":{
"type":"text",
"description":"Facility Name"
}
}
}
},
"results": [
{
"record_number": "200",
"date": "1950-01-01",
"price": "34.73"
},
{
"record_number": "199",
"date": "1950-02-01",
"price": "34.73"
},
{
"record_number": "198",
"date": "1950-03-01",
"price": "34.73"
},
{
"record_number": "197",
"date": "1950-04-01",
"price": "34.73"
},
{
"record_number": "196",
"date": "1950-05-01",
"price": "34.73"
},
{
"record_number": "195",
"date": "1950-06-01",
"price": "34.73"
},
{
"record_number": "194",
"date": "1950-07-01",
"price": "34.73"
},
{
"record_number": "193",
"date": "1950-08-01",
"price": "34.73"
},
{
"record_number": "192",
"date": "1950-09-01",
"price": "34.73"
},
{
"record_number": "191",
"date": "1950-10-01",
"price": "34.73"
},
{
"record_number": "190",
"date": "1950-11-01",
"price": "34.73"
},
{
"record_number": "189",
"date": "1950-12-01",
"price": "34.72"
},
{
"record_number": "188",
"date": "1951-01-01",
"price": "34.72"
},
{
"record_number": "187",
"date": "1951-02-01",
"price": "34.73"
},
{
"record_number": "186",
"date": "1951-03-01",
"price": "34.73"
},
{
"record_number": "185",
"date": "1951-04-01",
"price": "34.73"
},
{
"record_number": "184",
"date": "1951-05-01",
"price": "34.73"
},
{
"record_number": "183",
"date": "1951-06-01",
"price": "34.73"
},
{
"record_number": "182",
"date": "1951-07-01",
"price": "34.72"
},
{
"record_number": "181",
"date": "1951-08-01",
"price": "34.71"
}
]
}
Loading

0 comments on commit 00ba3b5

Please sign in to comment.