diff --git a/.github/workflows/violet-test.yml b/.github/workflows/violet-test.yml index cdda7cffd..737f9f82f 100644 --- a/.github/workflows/violet-test.yml +++ b/.github/workflows/violet-test.yml @@ -7,7 +7,7 @@ on: jobs: test: if: ${{ github.event.label.name == 'ci/flutter-test' }} - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 defaults: run: working-directory: violet diff --git a/violet/test/api_test.dart b/violet/test/api_test.dart index 7bdba5cdb..6115b4b44 100644 --- a/violet/test/api_test.dart +++ b/violet/test/api_test.dart @@ -1,6 +1,8 @@ // This source code is a part of Project Violet. // Copyright (C) 2020-2024. violet-team. Licensed under the Apache-2.0 License. +import 'dart:io'; + import 'package:flutter_test/flutter_test.dart'; import 'package:violet/api/api.swagger.dart'; import 'package:violet/server/violet_v2.dart'; @@ -16,16 +18,21 @@ class MockApi { } } -void main() { +void main() async { + var disabled = true; + if (Platform.environment.containsKey('ENABLE_API_TESTS')) { + disabled = false; + } + MockApi.init(); test('Test Hello', () async { final res = await MockApi.instance.apiV2Get(); expect(res.body as String, 'Hello World!'); - }); + }, skip: disabled); test('Test Hmac', () async { final res = await MockApi.instance.apiV2HmacGet(); expect(res.statusCode, 200); - }); + }, skip: disabled); } diff --git a/violet/test/component_test.dart b/violet/test/component_test.dart index 829cb4960..7759acdd5 100644 --- a/violet/test/component_test.dart +++ b/violet/test/component_test.dart @@ -13,29 +13,25 @@ void main() { WidgetsFlutterBinding.ensureInitialized(); SharedPreferences.setMockInitialValues({ 'eh_cookies': - 'yay=louder; ipb_member_id=2742770; ipb_pass_hash=622fcc2be82c922135bb0516e0ee497d; sl=dm_2; sk=t8inbzaqn45ttyn9f78eanzuqizh; igneous=hez0uu1qwsa7r91eqpt sl=dm_1' + 'ipb_member_id=2742770; ipb_pass_hash=622fcc2be82c922135bb0516e0ee497d; sk=t8inbzaqn45ttyn9f78eanzuqizh; igneous=rcrmcztqgf1v8p1e0' }); - }); - test('EHentai Gallery Parse', () async { Settings.searchCategory = 1; Settings.searchExpunged = false; Settings.ignoreTimeout = true; + Settings.includeTagNetwork = false; + Settings.excludeTagNetwork = false; + }); + test('EHentai Gallery Parse', () async { final result = await HentaiManager.searchEHentai('"female:big breasts"', 0, false); - expect(result.length >= 25, true); }); test('ExHentai Gallery Parse', () async { - Settings.searchCategory = 1; - Settings.searchExpunged = false; - Settings.ignoreTimeout = true; - final result = await HentaiManager.searchEHentai('"female:big breasts"', 0, true); - expect(result.length >= 25, true); }); diff --git a/violet/test/parse_test.dart b/violet/test/parse_test.dart index 34af1e6a4..a8294232a 100644 --- a/violet/test/parse_test.dart +++ b/violet/test/parse_test.dart @@ -17,7 +17,7 @@ void main() { Uri.parse('https://exhentai.org/g/2504057/6757b3c4b8/'), headers: { 'Cookie': - 'yay=louder; ipb_member_id=2742770; ipb_pass_hash=622fcc2be82c922135bb0516e0ee497d; ipb_session_id=8c457abd02a2ee708e532d7ba379a186; igneous=19f996fc4; sl=dm_1; sk=t8inbzaqn45ttyn9f78eanzuqizh' + 'ipb_member_id=2742770; ipb_pass_hash=622fcc2be82c922135bb0516e0ee497d; sk=t8inbzaqn45ttyn9f78eanzuqizh; igneous=rcrmcztqgf1v8p1e0' })) .body;