Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
miskopo committed Aug 1, 2023
1 parent 026ad1a commit f62a8b7
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 23 deletions.
53 changes: 53 additions & 0 deletions tests/features/steps/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { When, Then, Given } from "@badeball/cypress-cucumber-preprocessor";

Given("I am on login page", () => {
cy.visit("/");
});

Given(
"an administrator account named {word} exists",
(admin_account_exists) => {
console.log("Admin exists, SUCCESS");
// TODO: implement
}
);

Given("I am logged in as {word}", (loginName) => {

});

When("I logout", () => {});

When("I open the side menu", () => {
cy.get('[id="nav-toggle"]').then(($ele => {
if ($ele.attr('aria-expanded') === 'false') {
$ele.click();
}
}))
})

When("I close the side menu", () => {
cy.get('[id="nav-toggle"]').then(($ele => {
if ($ele.attr('aria-expanded') === 'true') {
$ele.click();
}
}))
})
When("I click on {} tab", (tabText) => {
cy.get('nav a').contains(tabText).click();
});

When("I click on {} button", function (buttonText) {
cy.get('button').contains(buttonText).click();
});

When("in a dialog I click on {} button", function (buttonText) {
cy.get('[role=dialog] button').contains(buttonText).click();
});

When("I type in the field {} text {}", (fieldName, content) => {
cy.get('[role=dialog] label').contains(fieldName).parent().then(($label) =>
{
cy.get('[name=modal-form-' + $label.attr('for') + ']').type(content);
})
});
24 changes: 1 addition & 23 deletions tests/features/steps/test_webui.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,11 @@
const { Given, When, Then } = require("cucumber");

Given(
"an administrator account named {word} exists",
function (admin_account_exists) {
console.log("Admin exists, SUCCESS");
}
);

Given("I am logged in as {word}", function (admin_login) {
console.log("Admin logged in, SUCCESS");
});

When("I login as an entry {word}", function (login) {});
When("I logout", function (logout) {});
import { When, Then, Given } from "@badeball/cypress-cucumber-preprocessor";

Given("I have a sample {word}", function (create_record) {});

When("I click on {} tab", function (tab_name) {
document.getElementById(tab_name).click();
});

When("I click on {word} button", function (button_name) {
document.getElementById(button_name).click();
});

When("there is only one existing user", function () {});

Then("I should see {word} entry in the result table", function (entry_id) {});
When("I type in the field {word} text {}", function (field_id, content) {});
Given("There is an entry {word}", function (entry_id) {});
When("I open details for entry {word}", function (entry_id) {});
Then(
Expand Down
17 changes: 17 additions & 0 deletions tests/features/test_test.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Created by mpolovka at 25/07/2023
Feature: Test the test
Yolo, do not commit
Scenario: idk lol
When I am on login page
When I open the side menu
When I click on Active users tab
When I close the side menu
When I open the side menu
When I click on Stage users tab
When I close the side menu
When I click on Add button
When I type in the field User login text testuser1
When I type in the field First name text Test
When I type in the field Last name text User
When in a dialog I click on Add button

0 comments on commit f62a8b7

Please sign in to comment.