Run Cypress tests on Firefox for nightlies (#20592)

This commit is contained in:
Simeon Babev 2023-06-20 15:21:49 +03:00 committed by GitHub
parent a6ad701b5e
commit 7d3423ca5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 102 additions and 44 deletions

View file

@ -194,14 +194,25 @@ jobs:
strategy:
matrix:
container: [1, 2, 3, 4, 5]
browser: [chrome, firefox]
exclude:
# Only test with Firefox on scheduled runs
- browser: ${{ github.event_name != 'schedule' && 'firefox' || '' }}
steps:
- uses: actions/checkout@v3
- name: Install Google Chrome
if: matrix.browser == 'chrome'
uses: browser-actions/setup-chrome@v1
with:
chrome-version: stable
- name: Install Firefox
if: matrix.browser == 'firefox'
uses: browser-actions/setup-firefox@v1
with:
firefox-version: latest
- uses: ./.github/actions/pnpm-setup
with:
working-directory: js
@ -233,7 +244,8 @@ jobs:
install: false
record: true
parallel: true
browser: chrome
group: ${{ matrix.browser }}
browser: ${{ matrix.browser }}
wait-on: http://localhost:8080
working-directory: js/apps/admin-ui
env:
@ -245,7 +257,7 @@ jobs:
- name: Upload server logs
uses: actions/upload-artifact@v3
with:
name: server-log-${{ matrix.container }}
name: server-log-${{ matrix.container }}-${{ matrix.browser }}
path: ~/server.log
check-set-status:

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import Form from "../support/forms/Form";
import FormValidation from "../support/forms/FormValidation";
import Select from "../support/forms/Select";
@ -11,7 +12,7 @@ const loginPage = new LoginPage();
const sidebarPage = new SidebarPage();
describe("Authentication - Policies - CIBA", () => {
const realmName = crypto.randomUUID();
const realmName = uuid();
before(() => adminClient.createRealm(realmName));
after(() => adminClient.deleteRealm(realmName));

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import { keycloakBefore } from "../support/util/keycloak_hooks";
import LoginPage from "../support/pages/LoginPage";
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
@ -20,7 +21,7 @@ const masthead = new Masthead();
const sidebarPage = new SidebarPage();
const commonPage = new CommonPage();
const listingPage = new ListingPage();
const realmName = "test" + crypto.randomUUID();
const realmName = "test" + uuid();
describe("Authentication test", () => {
const detailPage = new FlowDetails();

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import { keycloakBefore } from "../support/util/keycloak_hooks";
import adminClient from "../support/util/AdminClient";
import LoginPage from "../support/pages/LoginPage";
@ -20,7 +21,7 @@ describe("Client authentication subtab", () => {
const clientDetailsPage = new ClientDetailsPage();
const policiesSubTab = new PoliciesTab();
const permissionsSubTab = new PermissionsTab();
const clientId = "client-authentication-" + crypto.randomUUID();
const clientId = "client-authentication-" + uuid();
before(() =>
adminClient.createClient({

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import LoginPage from "../support/pages/LoginPage";
import Masthead from "../support/pages/admin-ui/Masthead";
import ListingPage, {
@ -295,7 +296,7 @@ describe("Client Scopes test", () => {
});
it("Client scope CRUD test", () => {
itemId += "_" + crypto.randomUUID();
itemId += "_" + uuid();
// Create
listingPage.itemExist(itemId, false).goToCreateItem();

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import LoginPage from "../support/pages/LoginPage";
import ListingPage, {
Filter,
@ -314,7 +315,7 @@ describe("Clients test", () => {
});
it("Client CRUD test", () => {
itemId += "_" + crypto.randomUUID();
itemId += "_" + uuid();
// Create
commonPage.tableUtils().checkRowItemExists(itemId, false);
@ -481,7 +482,7 @@ describe("Clients test", () => {
describe("Roles tab test", () => {
const rolesTab = new ClientRolesTab();
const client = "client_" + crypto.randomUUID();
const client = "client_" + uuid();
before(() =>
adminClient.createClient({
@ -687,7 +688,7 @@ describe("Clients test", () => {
loginPage.logIn();
keycloakBefore();
commonPage.sidebar().goToClients();
client = "client_" + crypto.randomUUID();
client = "client_" + uuid();
commonPage.tableToolbarUtils().createClient();
createClientPage
.selectClientType("openid-connect")

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import LoginPage from "../support/pages/LoginPage";
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
import UserEventsTab, {
@ -33,7 +34,7 @@ describe.skip("Events tests", () => {
const eventsTestUser = {
eventsTestUserId: "",
userRepresentation: {
username: "events-test" + crypto.randomUUID(),
username: "events-test" + uuid(),
enabled: true,
credentials: [{ value: "events-test" }],
},
@ -268,7 +269,7 @@ describe.skip("Events tests", () => {
});
describe("Admin events list", () => {
const realmName = crypto.randomUUID();
const realmName = uuid();
before(() => adminClient.createRealm(realmName));
after(() => adminClient.deleteRealm(realmName));

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import GroupModal from "../support/pages/admin-ui/manage/groups/GroupModal";
import GroupDetailPage from "../support/pages/admin-ui/manage/groups/group_details/GroupDetailPage";
import AttributesTab from "../support/pages/admin-ui/manage/AttributesTab";
@ -55,7 +56,7 @@ describe("Group test", () => {
loginPage.logIn();
keycloakBefore();
sidebarPage.goToGroups();
groupName = groupNamePrefix + crypto.randomUUID();
groupName = groupNamePrefix + uuid();
groupNames.push(groupName);
});

View file

@ -38,8 +38,20 @@ describe("Masthead tests", () => {
it("Should go to documentation page", () => {
masthead.clickGlobalHelp();
masthead.clickDocumentationLink();
cy.get("#header").should("contain.text", "Server Administration Guide");
masthead
.getDocumentationLink()
.invoke("attr", "href")
.then((href) => {
if (!href) return;
masthead.clickDocumentationLink();
cy.origin(href, () => {
cy.get("#header").should(
"contain.text",
"Server Administration Guide"
);
});
});
});
it("Enable/disable help mode in desktop mode", () => {

View file

@ -44,7 +44,7 @@ describe("Partial import test", () => {
it("Import button only enabled if JSON has something to import", () => {
modal.open();
modal.textArea().type("{}");
modal.textArea().type("{}", { force: true });
modal.importButton().should("be.disabled");
modal.cancelButton().click();
});
@ -119,7 +119,7 @@ describe("Partial import test", () => {
//clear button should be disabled if there is nothing in the dialog
modal.clearButton().should("be.disabled");
modal.textArea().type("{}");
modal.textArea().type("{}", { force: true });
modal.textArea().get(".view-lines").should("have.text", "{}");
modal.clearButton().should("not.be.disabled");
modal.clearButton().click();

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import LoginPage from "../support/pages/LoginPage";
import Masthead from "../support/pages/admin-ui/Masthead";
import ModalUtils from "../support/util/ModalUtils";
@ -46,7 +47,7 @@ describe("Realm roles test", () => {
});
it("Realm role CRUD test", () => {
itemId += "_" + crypto.randomUUID();
itemId += "_" + uuid();
// Create
listingPage.itemExist(itemId, false).goToCreateItem();
@ -69,7 +70,7 @@ describe("Realm roles test", () => {
});
it("should delete role from details action", () => {
itemId += "_" + crypto.randomUUID();
itemId += "_" + uuid();
listingPage.goToCreateItem();
createRealmRolePage.fillRealmRoleData(itemId).save();
masthead.checkNotificationMessage("Role created", true);
@ -89,7 +90,7 @@ describe("Realm roles test", () => {
});
it("Add associated roles test", () => {
itemId += "_" + crypto.randomUUID();
itemId += "_" + uuid();
// Create
listingPage.itemExist(itemId, false).goToCreateItem();
@ -183,7 +184,7 @@ describe("Realm roles test", () => {
it("Should delete associated roles from list test", () => {
itemId = "realm_role_crud";
itemId += "_" + crypto.randomUUID();
itemId += "_" + uuid();
// Create
listingPage.itemExist(itemId, false).goToCreateItem();

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
import LoginPage from "../support/pages/LoginPage";
import RealmSettingsPage from "../support/pages/admin-ui/manage/realm_settings/RealmSettingsPage";
@ -12,7 +13,7 @@ const modalUtils = new ModalUtils();
const masthead = new Masthead();
describe("Realm settings client policies tab tests", () => {
const realmName = "Realm_" + crypto.randomUUID();
const realmName = "Realm_" + uuid();
const realmSettingsPage = new RealmSettingsPage(realmName);
beforeEach(() => {

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
import LoginPage from "../support/pages/LoginPage";
import RealmSettingsPage from "../support/pages/admin-ui/manage/realm_settings/RealmSettingsPage";
@ -14,7 +15,7 @@ const masthead = new Masthead();
describe("Realm settings client profiles tab tests", () => {
const profileName = "Test";
const editedProfileName = "Edit";
const realmName = "Realm_" + crypto.randomUUID();
const realmName = "Realm_" + uuid();
const realmSettingsPage = new RealmSettingsPage(realmName);
beforeEach(() => {

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
import LoginPage from "../support/pages/LoginPage";
import RealmSettingsPage from "../support/pages/admin-ui/manage/realm_settings/RealmSettingsPage";
@ -16,7 +17,7 @@ const realmSettingsPage = new RealmSettingsPage();
const keysTab = new KeysTab();
describe("Realm settings events tab tests", () => {
const realmName = "Realm_" + crypto.randomUUID();
const realmName = "Realm_" + uuid();
const listingPage = new ListingPage();
beforeEach(() => {
@ -89,10 +90,7 @@ describe("Realm settings events tab tests", () => {
};
const addBundle = () => {
realmSettingsPage.addKeyValuePair(
"key_" + crypto.randomUUID(),
"value_" + crypto.randomUUID()
);
realmSettingsPage.addKeyValuePair("key_" + uuid(), "value_" + uuid());
return this;
};

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
import LoginPage from "../support/pages/LoginPage";
import RealmSettingsPage from "../support/pages/admin-ui/manage/realm_settings/RealmSettingsPage";
@ -11,7 +12,7 @@ const masthead = new Masthead();
const realmSettingsPage = new RealmSettingsPage();
describe("Realm settings general tab tests", () => {
const realmName = "Realm_" + crypto.randomUUID();
const realmName = "Realm_" + uuid();
beforeEach(() => {
loginPage.logIn();

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
import LoginPage from "../support/pages/LoginPage";
import RealmSettingsPage from "../support/pages/admin-ui/manage/realm_settings/RealmSettingsPage";
@ -17,7 +18,7 @@ const keysTab = new KeysTab();
const modalUtils = new ModalUtils();
describe("Realm settings tabs tests", () => {
const realmName = "Realm_" + crypto.randomUUID();
const realmName = "Realm_" + uuid();
beforeEach(() => {
loginPage.logIn();

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import ListingPage from "../support/pages/admin-ui/ListingPage";
import UserProfile from "../support/pages/admin-ui/manage/realm_settings/UserProfile";
import Masthead from "../support/pages/admin-ui/Masthead";
@ -23,7 +24,7 @@ const clickCreateAttributeButton = () =>
userProfileTab.createAttributeButtonClick();
describe("User profile tabs", () => {
const realmName = "Realm_" + crypto.randomUUID();
const realmName = "Realm_" + uuid();
const attributeName = "Test";
before(() =>

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import LoginPage from "../support/pages/LoginPage";
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
import CreateRealmPage from "../support/pages/admin-ui/CreateRealmPage";
@ -14,9 +15,9 @@ const createRealmPage = new CreateRealmPage();
const realmSettings = new RealmSettings();
const modalUtils = new ModalUtils();
const testRealmName = "Test-realm-" + crypto.randomUUID();
const newRealmName = "New-Test-realm-" + crypto.randomUUID();
const editedRealmName = "Edited-Test-realm-" + crypto.randomUUID();
const testRealmName = "Test-realm-" + uuid();
const newRealmName = "New-Test-realm-" + uuid();
const editedRealmName = "Edited-Test-realm-" + uuid();
const testDisabledName = "Test-Disabled";
describe("Realm tests", () => {

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation";
import LoginPage from "../support/pages/LoginPage";
import Masthead from "../support/pages/admin-ui/Masthead";
@ -16,9 +17,7 @@ const masthead = new Masthead();
const createUser = (fields: UserRepresentation) =>
cy
.wrap(null)
.then(() =>
adminClient.createUser({ username: crypto.randomUUID(), ...fields })
);
.then(() => adminClient.createUser({ username: uuid(), ...fields }));
const deleteUser = (username: string) =>
cy.wrap(null).then(() => adminClient.deleteUser(username));

View file

@ -1,3 +1,5 @@
import { v4 as uuid } from "uuid";
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
import LoginPage from "../support/pages/LoginPage";
import CreateUserPage from "../support/pages/admin-ui/manage/users/CreateUserPage";
@ -39,7 +41,7 @@ describe("User creation", () => {
before(async () => {
for (let i = 0; i <= 2; i++) {
groupName += "_" + crypto.randomUUID();
groupName += "_" + uuid();
await adminClient.createGroup(groupName);
groupsList = [...groupsList, groupName];
}
@ -63,7 +65,7 @@ describe("User creation", () => {
});
it("Create user test", () => {
itemId += "_" + crypto.randomUUID();
itemId += "_" + uuid();
// Create
createUserPage.goToCreateUser();
@ -75,7 +77,7 @@ describe("User creation", () => {
});
it("Create user with groups test", () => {
itemIdWithGroups += crypto.randomUUID();
itemIdWithGroups += uuid();
// Add user from search bar
createUserPage.goToCreateUser();
@ -97,7 +99,7 @@ describe("User creation", () => {
});
it("Create user with credentials test", () => {
itemIdWithCred += "_" + crypto.randomUUID();
itemIdWithCred += "_" + uuid();
// Add user from search bar
createUserPage.goToCreateUser();

View file

@ -58,8 +58,12 @@ export default class Masthead extends CommonElements {
return this;
}
getDocumentationLink() {
return cy.get(this.documentationLink);
}
clickDocumentationLink() {
cy.get(this.documentationLink)
this.getDocumentationLink()
.find("a")
.invoke("removeAttr", "target")
.click();

View file

@ -148,7 +148,7 @@ export default class UserProfile {
}
typeJSON(text: string) {
this.textArea().type(text);
this.textArea().type(text, { force: true });
return this;
}

View file

@ -1,3 +1,4 @@
import { v4 as uuid } from "uuid";
import { RequiredActionAlias } from "@keycloak/keycloak-admin-client/lib/defs/requiredActionProviderRepresentation";
import PageObject from "../../../components/PageObject";
@ -20,8 +21,7 @@ export default class UserDetailsPage extends PageObject {
this.saveBtn = "save-user";
this.cancelBtn = "cancel-create-user";
this.emailInput = "email-input";
this.emailValue = () =>
"example" + "_" + crypto.randomUUID() + "@example.com";
this.emailValue = () => "example" + "_" + uuid() + "@example.com";
this.firstNameInput = "firstName-input";
this.firstNameValue = "firstname";
this.lastNameInput = "lastName-input";

View file

@ -100,12 +100,14 @@
"@types/lodash-es": "^4.17.7",
"@types/react": "^18.2.13",
"@types/react-dom": "^18.2.6",
"@types/uuid": "^9.0.2",
"@vitejs/plugin-react-swc": "^3.3.2",
"cypress": "^12.14.0",
"cypress-axe": "^1.4.0",
"jsdom": "^22.1.0",
"ldap-server-mock": "^6.0.1",
"ts-node": "^10.9.1",
"uuid": "^9.0.0",
"vite": "^4.3.9",
"vite-plugin-checker": "^0.6.0",
"vitest": "^0.32.2"

View file

@ -250,6 +250,9 @@ importers:
'@types/react-dom':
specifier: ^18.2.6
version: 18.2.6
'@types/uuid':
specifier: ^9.0.2
version: 9.0.2
'@vitejs/plugin-react-swc':
specifier: ^3.3.2
version: 3.3.2(vite@4.3.9)
@ -268,6 +271,9 @@ importers:
ts-node:
specifier: ^10.9.1
version: 10.9.1(@types/node@20.3.1)(typescript@5.1.3)
uuid:
specifier: ^9.0.0
version: 9.0.0
vite:
specifier: ^4.3.9
version: 4.3.9(@types/node@20.3.1)
@ -1963,6 +1969,10 @@ packages:
'@types/jest': 29.5.2
dev: true
/@types/uuid@9.0.2:
resolution: {integrity: sha512-kNnC1GFBLuhImSnV7w4njQkUiJi0ZXUycu1rUaouPqiKlXkh77JKgdRnTAp1x5eBwcIwbtI+3otwzuIDEuDoxQ==}
dev: true
/@types/yargs-parser@21.0.0:
resolution: {integrity: sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==}
dev: true
@ -6507,6 +6517,11 @@ packages:
hasBin: true
dev: true
/uuid@9.0.0:
resolution: {integrity: sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==}
hasBin: true
dev: true
/v8-compile-cache-lib@3.0.1:
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
dev: true