Skip to content

Commit

Permalink
chore: restore skipped saml tests
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Zedel <[email protected]>
  • Loading branch information
mzedel committed Aug 7, 2023
1 parent 6190ea6 commit 2c7f4a1
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 40 deletions.
14 changes: 7 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ test:docs-links:hosted:
test:prep:
stage: pre-test
image: docker
only:
- staging
# only:
# - staging
services:
- docker:dind
script:
Expand Down Expand Up @@ -292,7 +292,7 @@ build:docker:

.template:test:staging-deployment:
image: mendersoftware/mender-test-containers:gui-e2e-testing
stage: .post
stage: test
services:
- docker:dind
cache:
Expand All @@ -318,10 +318,10 @@ build:docker:
after_script:
- cd $CI_PROJECT_DIR
- mkdir logs && cp /root/.npm/_logs/* logs/
only:
- staging
when: delayed
start_in: 15 minutes
# only:
# - staging
# when: delayed
# start_in: 15 minutes
artifacts:
expire_in: 2w
paths:
Expand Down
20 changes: 11 additions & 9 deletions tests/e2e_tests/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { PlaywrightTestConfig } from '@playwright/test';
import { LaunchOptions, PlaywrightTestConfig } from '@playwright/test';
import * as path from 'path';

const contextArgs = {
Expand All @@ -20,20 +20,22 @@ const contextArgs = {
viewport: { width: 1600, height: 900 }
};

const launchOptions: LaunchOptions = {
...contextArgs,
args: process.env.TEST_ENVIRONMENT === 'staging' ? [] : ['--disable-dev-shm-usage', '--disable-web-security'],
slowMo: process.env.TEST_ENVIRONMENT === 'staging' ? undefined : 50
// to ease running the test locally and "headful" uncomment and modify the below option to match your preferred browser installation
// this might also require adjusting the `runWith` call at the bottom of the file
// executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
};

export const contextOptions = {
...contextArgs,
contextOptions: contextArgs,
// slowMo: 50,
screenshot: 'only-on-failure',
video: 'retry-with-video',
// headless: false,
launchOptions: {
...contextArgs,
args: process.env.TEST_ENVIRONMENT === 'staging' ? [] : ['--disable-dev-shm-usage', '--disable-web-security']
// to ease running the test locally and "headful" uncomment and modify the below option to match your preferred browser installation
// this might also require adjusting the `runWith` call at the bottom of the file
// executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
}
launchOptions
};

const options: PlaywrightTestConfig = {
Expand Down
24 changes: 4 additions & 20 deletions tests/e2e_tests/integration/07-saml.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ test.describe('SAML Login via sso/id/login', () => {
});

// Setups the SAML/SSO login with samltest.id Identity Provider
test('Set up SAML', async ({ browserName, context, environment, baseUrl, page }) => {
// QA-579
test.skip(browserName === 'webkit');

test('Set up SAML', async ({ context, environment, baseUrl, page }) => {
test.skip(environment !== 'staging');
// allow a lot of time to enter metadata + then some to handle uploading the config to the external service
test.setTimeout(5 * timeouts.sixtySeconds + timeouts.fifteenSeconds);
Expand All @@ -71,20 +68,15 @@ test.describe('SAML Login via sso/id/login', () => {
expect(status).toBeGreaterThanOrEqual(200);
expect(status).toBeLessThan(300);
await page.goto(`${baseUrl}ui/settings/organization-and-billing`);

const isInitialized = await page.isVisible('text=Entity ID');
if (!isInitialized) {
// Check input[type="checkbox"]
await page.locator('input[type="checkbox"]').check();
// Click text=input with the text editor
await page.locator('text=input with the text editor').click();

// Click .view-lines
await page.locator('.view-lines').click();

await page
.locator('[aria-label="Editor content\\;Press Alt\\+F1 for Accessibility Options\\."]')
.type(metadata.replace(/(?:\r\n|\r|\n)/g, ''), { delay: 0 });
const textfield = await page.locator('[aria-label="Editor content\\;Press Alt\\+F1 for Accessibility Options\\."]');
await textfield.type(metadata.replace(/(?:\r\n|\r|\n)/g, ''));
console.log('typing metadata done.');
// The screenshot saves the view of the typed metadata
await page.screenshot({ 'path': 'saml-edit-saving.png' });
Expand All @@ -100,9 +92,8 @@ test.describe('SAML Login via sso/id/login', () => {
expect(downloadTargetPath).toBeTruthy();
const dialog = await page.locator('text=SAML metadata >> .. >> ..');
await dialog.locator('data-testid=CloseIcon').click();

const storage = await context.storageState();
const jwt = storage['cookies'].find(cookie => cookie.name === 'JWT').value;
const jwt = storage.cookies.find(cookie => cookie.name === 'JWT').value;
const requestInfo = { method: 'GET', headers: { ...defaultHeaders, Authorization: `Bearer ${jwt}` }, httpsAgent };
const { data } = await axios({ ...requestInfo, url: `${baseUrl}api/management/v1/useradm/sso/idp/metadata` });
const metadataId = data[0].id;
Expand Down Expand Up @@ -132,9 +123,6 @@ test.describe('SAML Login via sso/id/login', () => {

// Creates a user with login that matches Identity privder (samltest.id) user email
test('Creates a user without a password', async ({ environment, browserName, baseUrl, page }) => {
// QA-579
test.skip(browserName === 'webkit');

test.skip(environment !== 'staging');
await page.goto(`${baseUrl}ui/settings/user-management`);
const userExists = await page.isVisible(`text=${samlSettings.credentials[browserName].email}`);
Expand All @@ -158,10 +146,6 @@ test.describe('SAML Login via sso/id/login', () => {
// This test calls auth/sso/${id}/login, where id is the id of the identity provider
// and verifies that login is successful.
test('User can login via sso/login endpoint', async ({ environment, browserName, baseUrl, browser, loggedInPage }) => {
// QA-579
test.skip(browserName === 'firefox');
test.skip(browserName === 'webkit');

test.skip(environment !== 'staging');
test.setTimeout(2 * timeouts.fifteenSeconds);

Expand Down
8 changes: 4 additions & 4 deletions tests/e2e_tests/integration/99-settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { baseUrlToDomain, generateOtp, login, prepareCookies, startClient, tenan
import { selectors, timeouts } from '../utils/constants';

test.describe('Settings', () => {
test.describe('access token feature', () => {
test.skip('access token feature', () => {
test.use({ storageState: 'storage.json' });
test('allows access to access tokens', async ({ baseUrl, loggedInPage: page }) => {
await page.goto(`${baseUrl}ui/settings`);
Expand Down Expand Up @@ -68,7 +68,7 @@ test.describe('Settings', () => {
await page.waitForSelector('text=/in a year/i');
});
});
test.describe('account upgrades', () => {
test.skip('account upgrades', () => {
test.use({ storageState: 'storage.json' });
test('allows upgrading to Professional', async ({ environment, loggedInPage: page }) => {
test.skip(environment !== 'staging');
Expand Down Expand Up @@ -105,7 +105,7 @@ test.describe('Settings', () => {
});
});

test.describe('2FA setup', () => {
test.skip('2FA setup', () => {
test('supports regular 2fa setup', async ({ baseUrl, context, environment, username, password }) => {
test.skip(environment !== 'staging');
const { token, userId } = await login(username, password, baseUrl);
Expand Down Expand Up @@ -185,7 +185,7 @@ test.describe('Settings', () => {
});
});

test.describe('Basic setting features', () => {
test.skip('Basic setting features', () => {
const replacementPassword = 'mysecretpassword!456';

test('allows access to user management', async ({ baseUrl, loggedInPage: page }) => {
Expand Down

0 comments on commit 2c7f4a1

Please sign in to comment.