This commit is contained in:
tidusjar 2022-12-02 16:26:03 +00:00
commit 618a775eb3
7 changed files with 404 additions and 2969 deletions

View file

@ -1,4 +1,7 @@
import { defineConfig } from 'cypress'
import { defineConfig } from 'cypress';
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
import createEsbuildPlugin from "@badeball/cypress-cucumber-preprocessor/esbuild";
export default defineConfig({
watchForFileChanges: true,
@ -17,11 +20,25 @@ export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
async setupNodeEvents(
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
): Promise<Cypress.PluginConfigOptions> {
await addCucumberPreprocessorPlugin(on, config);
on(
"file:preprocessor",
createBundler({
plugins: [createEsbuildPlugin(config)],
})
);
// Make sure to return the config object as it might have been modified by the plugin.
return config;
// return require('./cypress/plugins/index.js')(on, config)
},
baseUrl: 'http://localhost:5000',
specPattern: 'cypress/tests/**/*.spec.ts*',
baseUrl: 'http://localhost:3577',
specPattern: ['cypress/tests/**/*.spec.ts*', '**/*.feature'],
excludeSpecPattern: ['**/snapshots/*'],
},
})

View file

@ -0,0 +1,13 @@
Feature: Login Page
Scenario: When visiting Ombi and the Landing Page is enabled, we should end up on the landing page
Given I set the Landing Page to "true"
When I visit Ombi
Then I should be on the "landingpage"
Then I click continue
Then I should be on the "login/true"
Scenario: When visiting Ombi and the Landing Page is disabled, we should end up on the login page
Given I set the Landing Page to "false"
When I visit Ombi
Then I should be on the "login"

View file

@ -0,0 +1,19 @@
import { After, Before, Given, When, Then } from "@badeball/cypress-cucumber-preprocessor";
import { loginPage as Page } from "@/integration/page-objects";
Given("I set the Landing Page to {string}", (bool) => {
cy.landingSettings(bool);
});
When("I visit Ombi", () => {
Page.visit();
});
Then("I should be on the {string}", (string) => {
cy.location("pathname").should("eq", `/${string}`);
});
Then("I click continue", () => {
cy.get("[data-cy=continue]").click();
});

View file

@ -1,20 +1,6 @@
import { loginPage as Page } from "@/integration/page-objects";
describe("Login Tests", () => {
it("Landing Page is enabled, should redirect", () => {
cy.landingSettings(true);
Page.visit();
cy.location("pathname").should("eq", "/landingpage");
cy.get("[data-cy=continue]").click();
cy.location("pathname").should("contains", "/login");
});
it("Landing Page is disabled, should not redirect", () => {
cy.landingSettings(false);
Page.visit();
cy.location("pathname").should("eq", "/login");
});
it("Plex OAuth Enabled, should be button", () => {
cy.landingSettings(false);

View file

@ -1,8 +1,9 @@
{
"devDependencies": {
"@badeball/cypress-cucumber-preprocessor": "^14.0.0",
"@bahmutov/cy-api": "^1.5.0",
"@bahmutov/cypress-esbuild-preprocessor": "^2.1.5",
"cypress": "11.2.0",
"cypress-cucumber-preprocessor": "^4.3.1",
"cypress-wait-until": "^1.7.1",
"typescript": "^4.2.3"
},

View file

@ -1,6 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"target": "es6",
"esModuleInterop": true,
"lib": ["es2018", "dom"],
"types": ["cypress", "cypress-wait-until", "cypress-image-snapshot", "cypress-real-events", "@bahmutov/cy-api", "node"],
"baseUrl": "./cypress",

File diff suppressed because it is too large Load diff