Skip to content

Commit

Permalink
Merge pull request #99 from goodtrailer/ci-ignore-tests
Browse files Browse the repository at this point in the history
Tests: Ignore certain tests if `CI` environment variable is enabled
  • Loading branch information
goodtrailer authored Jan 14, 2025
2 parents 66b4eac + b4160c3 commit a83001a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/dotnet-test-providers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ on:
- 'main'
pull_request:

env:
CI: true

jobs:
build:
build-and-test:
runs-on: windows-latest

steps:
Expand Down
46 changes: 26 additions & 20 deletions DailyDesktop.Tests/TestProviders.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Copyright (c) Alden Wu <aldenwu0@gmail.com>. Licensed under the MIT Licence.
// See the LICENSE file in the repository root for full licence text.

using System;
using System.Threading.Tasks;
using DailyDesktop.Core.Configuration;
using DailyDesktop.Core.Providers;
using DailyDesktop.Core.Util;
using DailyDesktop.Providers.Bing;
using DailyDesktop.Providers.CalvinAndHobbes;
using DailyDesktop.Providers.DeviantArt;
using DailyDesktop.Providers.FalseKnees;
using DailyDesktop.Providers.MTG;
using DailyDesktop.Providers.Pixiv;
Expand Down Expand Up @@ -55,26 +57,27 @@ public async Task TestCalvinAndHobbes()
Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.TitleUri), "Null/whitespace title URI.");
}

// [TestMethod]
// public async Task TestDeviantArt()
// {
// var wallpaperConfig = new WallpaperConfiguration();
// await new DeviantArtProvider().ConfigureWallpaperAsync(wallpaperConfig, AsyncUtils.LongCancel());

// TestContext.WriteLine("Image URI: " + wallpaperConfig.ImageUri);
// TestContext.WriteLine("Author: " + wallpaperConfig.Author);
// TestContext.WriteLine("Author URI: " + wallpaperConfig.AuthorUri);
// TestContext.WriteLine("Title: " + wallpaperConfig.Title);
// TestContext.WriteLine("Title URI: " + wallpaperConfig.TitleUri);
// TestContext.WriteLine("Description: " + wallpaperConfig.Description);

// Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.ImageUri), "Null/whitespace image URI!");
// Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.Author), "Null/whitespace author.");
// Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.AuthorUri), "Null/whitespace author URI.");
// Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.Title), "Null/whitespace title.");
// Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.TitleUri), "Null/whitespace title URI.");
// Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.Description), "Null/whitespace description.");
// }
[TestMethod]
public async Task TestDeviantArt()
{
if (Environment.GetEnvironmentVariable("CI") == "true")
Assert.Inconclusive("Skipped due to CI testing.");

var wallpaperConfig = new WallpaperConfiguration();
await new DeviantArtProvider().ConfigureWallpaperAsync(wallpaperConfig, AsyncUtils.LongCancel());

TestContext.WriteLine("Image URI: " + wallpaperConfig.ImageUri);
TestContext.WriteLine("Author: " + wallpaperConfig.Author);
TestContext.WriteLine("Author URI: " + wallpaperConfig.AuthorUri);
TestContext.WriteLine("Title: " + wallpaperConfig.Title);
TestContext.WriteLine("Title URI: " + wallpaperConfig.TitleUri);

Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.ImageUri), "Null/whitespace image URI!");
Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.Author), "Null/whitespace author.");
Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.AuthorUri), "Null/whitespace author URI.");
Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.Title), "Null/whitespace title.");
Assert.IsFalse(string.IsNullOrWhiteSpace(wallpaperConfig.TitleUri), "Null/whitespace title URI.");
}

[TestMethod]
public async Task TestFalseKnees()
Expand Down Expand Up @@ -134,6 +137,9 @@ public async Task TestPixiv()
[TestMethod]
public async Task TestRedditEarthPorn()
{
if (Environment.GetEnvironmentVariable("CI") == "true")
Assert.Inconclusive("Skipped due to CI testing.");

var wallpaperConfig = new WallpaperConfiguration();
await new RedditEarthPornProvider().ConfigureWallpaperAsync(wallpaperConfig, AsyncUtils.LongCancel());

Expand Down

0 comments on commit a83001a

Please sign in to comment.