mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Add documents query params e2e tests
This commit is contained in:
		
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":"v1.7.1","update_available":false,"feature_is_set":true}
 | 
			
		||||
							
								
								
									
										17
									
								
								src-ui/cypress/fixtures/storage_paths/storage_paths.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src-ui/cypress/fixtures/storage_paths/storage_paths.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
{
 | 
			
		||||
    "count": 1,
 | 
			
		||||
    "next": null,
 | 
			
		||||
    "previous": null,
 | 
			
		||||
    "results": [
 | 
			
		||||
        {
 | 
			
		||||
            "id": 2,
 | 
			
		||||
            "slug": "year-title",
 | 
			
		||||
            "name": "Year - Title",
 | 
			
		||||
            "path": "{created_year}/{title}",
 | 
			
		||||
            "match": "",
 | 
			
		||||
            "matching_algorithm": 6,
 | 
			
		||||
            "is_insensitive": true,
 | 
			
		||||
            "document_count": 1
 | 
			
		||||
        }
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
@@ -1 +1,103 @@
 | 
			
		||||
{"count":8,"next":null,"previous":null,"results":[{"id":4,"slug":"another-sample-tag","name":"Another Sample Tag","color":"#a6cee3","text_color":"#000000","match":"","matching_algorithm":6,"is_insensitive":true,"is_inbox_tag":false,"document_count":3},{"id":7,"slug":"newone","name":"NewOne","color":"#9e4ad1","text_color":"#ffffff","match":"","matching_algorithm":1,"is_insensitive":true,"is_inbox_tag":false,"document_count":2},{"id":6,"slug":"partial-tag","name":"Partial Tag","color":"#72dba7","text_color":"#000000","match":"","matching_algorithm":1,"is_insensitive":true,"is_inbox_tag":false,"document_count":1},{"id":2,"slug":"tag-2","name":"Tag 2","color":"#612db7","text_color":"#ffffff","match":"","matching_algorithm":1,"is_insensitive":true,"is_inbox_tag":false,"document_count":3},{"id":3,"slug":"tag-3","name":"Tag 3","color":"#b2df8a","text_color":"#000000","match":"","matching_algorithm":1,"is_insensitive":true,"is_inbox_tag":false,"document_count":4},{"id":5,"slug":"tagwithpartial","name":"TagWithPartial","color":"#3b2db4","text_color":"#ffffff","match":"","matching_algorithm":6,"is_insensitive":true,"is_inbox_tag":false,"document_count":2},{"id":8,"slug":"test-another","name":"Test Another","color":"#3ccea5","text_color":"#000000","match":"","matching_algorithm":4,"is_insensitive":true,"is_inbox_tag":false,"document_count":0},{"id":1,"slug":"test-tag","name":"Test Tag","color":"#fb9a99","text_color":"#000000","match":"","matching_algorithm":1,"is_insensitive":true,"is_inbox_tag":false,"document_count":4}]}
 | 
			
		||||
{
 | 
			
		||||
    "count": 8,
 | 
			
		||||
    "next": null,
 | 
			
		||||
    "previous": null,
 | 
			
		||||
    "results": [
 | 
			
		||||
        {
 | 
			
		||||
            "id": 4,
 | 
			
		||||
            "slug": "another-sample-tag",
 | 
			
		||||
            "name": "Another Sample Tag",
 | 
			
		||||
            "color": "#a6cee3",
 | 
			
		||||
            "text_color": "#000000",
 | 
			
		||||
            "match": "",
 | 
			
		||||
            "matching_algorithm": 6,
 | 
			
		||||
            "is_insensitive": true,
 | 
			
		||||
            "is_inbox_tag": false,
 | 
			
		||||
            "document_count": 3
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "id": 7,
 | 
			
		||||
            "slug": "newone",
 | 
			
		||||
            "name": "NewOne",
 | 
			
		||||
            "color": "#9e4ad1",
 | 
			
		||||
            "text_color": "#ffffff",
 | 
			
		||||
            "match": "",
 | 
			
		||||
            "matching_algorithm": 1,
 | 
			
		||||
            "is_insensitive": true,
 | 
			
		||||
            "is_inbox_tag": false,
 | 
			
		||||
            "document_count": 2
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "id": 6,
 | 
			
		||||
            "slug": "partial-tag",
 | 
			
		||||
            "name": "Partial Tag",
 | 
			
		||||
            "color": "#72dba7",
 | 
			
		||||
            "text_color": "#000000",
 | 
			
		||||
            "match": "",
 | 
			
		||||
            "matching_algorithm": 1,
 | 
			
		||||
            "is_insensitive": true,
 | 
			
		||||
            "is_inbox_tag": false,
 | 
			
		||||
            "document_count": 1
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "id": 2,
 | 
			
		||||
            "slug": "tag-2",
 | 
			
		||||
            "name": "Tag 2",
 | 
			
		||||
            "color": "#612db7",
 | 
			
		||||
            "text_color": "#ffffff",
 | 
			
		||||
            "match": "",
 | 
			
		||||
            "matching_algorithm": 1,
 | 
			
		||||
            "is_insensitive": true,
 | 
			
		||||
            "is_inbox_tag": false,
 | 
			
		||||
            "document_count": 3
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "id": 3,
 | 
			
		||||
            "slug": "tag-3",
 | 
			
		||||
            "name": "Tag 3",
 | 
			
		||||
            "color": "#b2df8a",
 | 
			
		||||
            "text_color": "#000000",
 | 
			
		||||
            "match": "",
 | 
			
		||||
            "matching_algorithm": 1,
 | 
			
		||||
            "is_insensitive": true,
 | 
			
		||||
            "is_inbox_tag": false,
 | 
			
		||||
            "document_count": 4
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "id": 5,
 | 
			
		||||
            "slug": "tagwithpartial",
 | 
			
		||||
            "name": "TagWithPartial",
 | 
			
		||||
            "color": "#3b2db4",
 | 
			
		||||
            "text_color": "#ffffff",
 | 
			
		||||
            "match": "",
 | 
			
		||||
            "matching_algorithm": 6,
 | 
			
		||||
            "is_insensitive": true,
 | 
			
		||||
            "is_inbox_tag": false,
 | 
			
		||||
            "document_count": 2
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "id": 8,
 | 
			
		||||
            "slug": "test-another",
 | 
			
		||||
            "name": "Test Another",
 | 
			
		||||
            "color": "#3ccea5",
 | 
			
		||||
            "text_color": "#000000",
 | 
			
		||||
            "match": "",
 | 
			
		||||
            "matching_algorithm": 4,
 | 
			
		||||
            "is_insensitive": true,
 | 
			
		||||
            "is_inbox_tag": false,
 | 
			
		||||
            "document_count": 0
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "id": 1,
 | 
			
		||||
            "slug": "test-tag",
 | 
			
		||||
            "name": "Test Tag",
 | 
			
		||||
            "color": "#fb9a99",
 | 
			
		||||
            "text_color": "#000000",
 | 
			
		||||
            "match": "",
 | 
			
		||||
            "matching_algorithm": 1,
 | 
			
		||||
            "is_insensitive": true,
 | 
			
		||||
            "is_inbox_tag": false,
 | 
			
		||||
            "document_count": 4
 | 
			
		||||
        }
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -72,6 +72,7 @@ describe('documents-list', () => {
 | 
			
		||||
      fixture: 'document_types/doctypes.json',
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    cy.viewport(1280, 1024)
 | 
			
		||||
    cy.visit('/documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										350
									
								
								src-ui/cypress/integration/documents/query-params.spec.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										350
									
								
								src-ui/cypress/integration/documents/query-params.spec.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,350 @@
 | 
			
		||||
import { PaperlessDocument } from 'src/app/data/paperless-document'
 | 
			
		||||
 | 
			
		||||
describe('documents query params', () => {
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    cy.intercept('http://localhost:8000/api/ui_settings/', {
 | 
			
		||||
      fixture: 'ui_settings/settings.json',
 | 
			
		||||
    })
 | 
			
		||||
    cy.intercept('http://localhost:8000/api/remote_version/', {
 | 
			
		||||
      fixture: 'remote_version/remote_version.json',
 | 
			
		||||
    })
 | 
			
		||||
    cy.intercept('http://localhost:8000/api/correspondents/*', {
 | 
			
		||||
      fixture: 'correspondents/correspondents.json',
 | 
			
		||||
    })
 | 
			
		||||
    cy.intercept('http://localhost:8000/api/document_types/*', {
 | 
			
		||||
      fixture: 'document_types/doctypes.json',
 | 
			
		||||
    })
 | 
			
		||||
    cy.intercept('http://localhost:8000/api/saved_views/*', {
 | 
			
		||||
      fixture: 'saved_views/savedviews.json',
 | 
			
		||||
    })
 | 
			
		||||
    cy.intercept('http://localhost:8000/api/storage_paths/*', {
 | 
			
		||||
      fixture: 'storage_paths/storage_paths.json',
 | 
			
		||||
    })
 | 
			
		||||
    cy.intercept('http://localhost:8000/api/tags/*', {
 | 
			
		||||
      fixture: 'tags/tags.json',
 | 
			
		||||
    })
 | 
			
		||||
    cy.fixture('documents/documents.json').then((documentsJson) => {
 | 
			
		||||
      // mock api filtering
 | 
			
		||||
      cy.intercept('GET', 'http://localhost:8000/api/documents/*', (req) => {
 | 
			
		||||
        let response = { ...documentsJson }
 | 
			
		||||
 | 
			
		||||
        if (req.query.hasOwnProperty('ordering')) {
 | 
			
		||||
          const sort_field = req.query['ordering'].toString().replace('-', '')
 | 
			
		||||
          const reverse = req.query['ordering'].toString().indexOf('-') !== -1
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).sort((docA, docB) => {
 | 
			
		||||
            let result = 0
 | 
			
		||||
            switch (sort_field) {
 | 
			
		||||
              case 'created':
 | 
			
		||||
              case 'added':
 | 
			
		||||
                result =
 | 
			
		||||
                  new Date(docA[sort_field]) < new Date(docB[sort_field])
 | 
			
		||||
                    ? -1
 | 
			
		||||
                    : 1
 | 
			
		||||
                break
 | 
			
		||||
              case 'archive_serial_number':
 | 
			
		||||
                result = docA[sort_field] < docB[sort_field] ? -1 : 1
 | 
			
		||||
                break
 | 
			
		||||
            }
 | 
			
		||||
            if (reverse) result = -result
 | 
			
		||||
            return result
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (req.query.hasOwnProperty('tags__id__in')) {
 | 
			
		||||
          const tag_ids: Array<number> = req.query['tags__id__in']
 | 
			
		||||
            .toString()
 | 
			
		||||
            .split(',')
 | 
			
		||||
            .map((v) => +v)
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter(
 | 
			
		||||
            (d) =>
 | 
			
		||||
              d.tags.length > 0 &&
 | 
			
		||||
              d.tags.filter((t) => tag_ids.includes(t)).length > 0
 | 
			
		||||
          )
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        } else if (req.query.hasOwnProperty('tags__id__none')) {
 | 
			
		||||
          const tag_ids: Array<number> = req.query['tags__id__none']
 | 
			
		||||
            .toString()
 | 
			
		||||
            .split(',')
 | 
			
		||||
            .map((v) => +v)
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => d.tags.filter((t) => tag_ids.includes(t)).length == 0)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        } else if (
 | 
			
		||||
          req.query.hasOwnProperty('is_tagged') &&
 | 
			
		||||
          req.query['is_tagged'] == '0'
 | 
			
		||||
        ) {
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => d.tags.length == 0)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (req.query.hasOwnProperty('document_type__id')) {
 | 
			
		||||
          const doctype_id = +req.query['document_type__id']
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => d.document_type == doctype_id)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        } else if (
 | 
			
		||||
          req.query.hasOwnProperty('document_type__isnull') &&
 | 
			
		||||
          req.query['document_type__isnull'] == '1'
 | 
			
		||||
        ) {
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => d.document_type == undefined)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (req.query.hasOwnProperty('correspondent__id')) {
 | 
			
		||||
          const correspondent_id = +req.query['correspondent__id']
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => d.correspondent == correspondent_id)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        } else if (
 | 
			
		||||
          req.query.hasOwnProperty('correspondent__isnull') &&
 | 
			
		||||
          req.query['correspondent__isnull'] == '1'
 | 
			
		||||
        ) {
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => d.correspondent == undefined)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (req.query.hasOwnProperty('storage_path__id')) {
 | 
			
		||||
          const storage_path_id = +req.query['storage_path__id']
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => d.storage_path == storage_path_id)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        } else if (
 | 
			
		||||
          req.query.hasOwnProperty('storage_path__isnull') &&
 | 
			
		||||
          req.query['storage_path__isnull'] == '1'
 | 
			
		||||
        ) {
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => d.storage_path == undefined)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (req.query.hasOwnProperty('created__date__gt')) {
 | 
			
		||||
          const date = new Date(req.query['created__date__gt'])
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => new Date(d.created) > date)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        } else if (req.query.hasOwnProperty('created__date__lt')) {
 | 
			
		||||
          const date = new Date(req.query['created__date__lt'])
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => new Date(d.created) < date)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (req.query.hasOwnProperty('added__date__gt')) {
 | 
			
		||||
          const date = new Date(req.query['added__date__gt'])
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => new Date(d.added) > date)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        } else if (req.query.hasOwnProperty('added__date__lt')) {
 | 
			
		||||
          const date = new Date(req.query['added__date__lt'])
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => new Date(d.added) < date)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (req.query.hasOwnProperty('title_content')) {
 | 
			
		||||
          const title_content_regexp = new RegExp(
 | 
			
		||||
            req.query['title_content'].toString(),
 | 
			
		||||
            'i'
 | 
			
		||||
          )
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter(
 | 
			
		||||
            (d) =>
 | 
			
		||||
              title_content_regexp.test(d.title) ||
 | 
			
		||||
              title_content_regexp.test(d.content)
 | 
			
		||||
          )
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (req.query.hasOwnProperty('archive_serial_number')) {
 | 
			
		||||
          const asn = +req.query['archive_serial_number']
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) => d.archive_serial_number == asn)
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        } else if (req.query.hasOwnProperty('archive_serial_number__isnull')) {
 | 
			
		||||
          const isnull = req.query['storage_path__isnull'] == '1'
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter((d) =>
 | 
			
		||||
            isnull
 | 
			
		||||
              ? d.archive_serial_number == undefined
 | 
			
		||||
              : d.archive_serial_number != undefined
 | 
			
		||||
          )
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        } else if (req.query.hasOwnProperty('archive_serial_number__gt')) {
 | 
			
		||||
          const asn = +req.query['archive_serial_number__gt']
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter(
 | 
			
		||||
            (d) => d.archive_serial_number > 0 && d.archive_serial_number > asn
 | 
			
		||||
          )
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        } else if (req.query.hasOwnProperty('archive_serial_number__lt')) {
 | 
			
		||||
          const asn = +req.query['archive_serial_number__lt']
 | 
			
		||||
          response.results = (
 | 
			
		||||
            documentsJson.results as Array<PaperlessDocument>
 | 
			
		||||
          ).filter(
 | 
			
		||||
            (d) => d.archive_serial_number > 0 && d.archive_serial_number < asn
 | 
			
		||||
          )
 | 
			
		||||
          response.count = response.results.length
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        req.reply(response)
 | 
			
		||||
      })
 | 
			
		||||
    })
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents sorted by created', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created')
 | 
			
		||||
    cy.get('app-document-card-small').first().contains('No latin title')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents reverse sorted by created', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true')
 | 
			
		||||
    cy.get('app-document-card-small').first().contains('sit amet')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents sorted by added', () => {
 | 
			
		||||
    cy.visit('/documents?sort=added')
 | 
			
		||||
    cy.get('app-document-card-small').first().contains('No latin title')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents reverse sorted by added', () => {
 | 
			
		||||
    cy.visit('/documents?sort=added&reverse=true')
 | 
			
		||||
    cy.get('app-document-card-small').first().contains('sit amet')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by any tags', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&tags__id__in=2,4,5')
 | 
			
		||||
    cy.contains('3 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by excluded tags', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&tags__id__none=2,4')
 | 
			
		||||
    cy.contains('One document')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by no tags', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&is_tagged=0')
 | 
			
		||||
    cy.contains('One document')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by document type', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&document_type__id=1')
 | 
			
		||||
    cy.contains('3 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by no document type', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&document_type__isnull=1')
 | 
			
		||||
    cy.contains('One document')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by correspondent', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&correspondent__id=9')
 | 
			
		||||
    cy.contains('2 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by no correspondent', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&correspondent__isnull=1')
 | 
			
		||||
    cy.contains('2 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by storage path', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&storage_path__id=2')
 | 
			
		||||
    cy.contains('One document')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by no storage path', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&storage_path__isnull=1')
 | 
			
		||||
    cy.contains('3 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by title or content', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&title_content=lorem')
 | 
			
		||||
    cy.contains('2 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by asn', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&archive_serial_number=12345')
 | 
			
		||||
    cy.contains('One document')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by empty asn', () => {
 | 
			
		||||
    cy.visit(
 | 
			
		||||
      '/documents?sort=created&reverse=true&archive_serial_number__isnull=1'
 | 
			
		||||
    )
 | 
			
		||||
    cy.contains('2 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by non-empty asn', () => {
 | 
			
		||||
    cy.visit(
 | 
			
		||||
      '/documents?sort=created&reverse=true&archive_serial_number__isnull=0'
 | 
			
		||||
    )
 | 
			
		||||
    cy.contains('2 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by asn greater than', () => {
 | 
			
		||||
    cy.visit(
 | 
			
		||||
      '/documents?sort=created&reverse=true&archive_serial_number__gt=12346'
 | 
			
		||||
    )
 | 
			
		||||
    cy.contains('One document')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by asn less than', () => {
 | 
			
		||||
    cy.visit(
 | 
			
		||||
      '/documents?sort=created&reverse=true&archive_serial_number__lt=12346'
 | 
			
		||||
    )
 | 
			
		||||
    cy.contains('One document')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by created date greater than', () => {
 | 
			
		||||
    cy.visit(
 | 
			
		||||
      '/documents?sort=created&reverse=true&created__date__gt=2022-03-23'
 | 
			
		||||
    )
 | 
			
		||||
    cy.contains('3 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by created date less than', () => {
 | 
			
		||||
    cy.visit(
 | 
			
		||||
      '/documents?sort=created&reverse=true&created__date__lt=2022-03-23'
 | 
			
		||||
    )
 | 
			
		||||
    cy.contains('One document')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by added date greater than', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&added__date__gt=2022-03-24')
 | 
			
		||||
    cy.contains('2 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by added date less than', () => {
 | 
			
		||||
    cy.visit('/documents?sort=created&reverse=true&added__date__lt=2022-03-24')
 | 
			
		||||
    cy.contains('2 documents')
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  it('should show a list of documents filtered by multiple filters', () => {
 | 
			
		||||
    cy.visit(
 | 
			
		||||
      '/documents?sort=created&reverse=true&document_type__id=1&correspondent__id=9&tags__id__in=4,5'
 | 
			
		||||
    )
 | 
			
		||||
    cy.contains('2 documents')
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user