Skip to content

Commit

Permalink
MWPW-160756: Setup Nala tests for studio
Browse files Browse the repository at this point in the history
  • Loading branch information
afmicka committed Dec 12, 2024
1 parent 75ccf9a commit c13e2be
Show file tree
Hide file tree
Showing 14 changed files with 1,292 additions and 1 deletion.
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Nala'

runs:
using: 'composite'
steps:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: lts/*

- run: $GITHUB_ACTION_PATH/pr.run.sh
shell: bash
25 changes: 25 additions & 0 deletions nala/.nala-snippets/spec-snippet.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"Create Nala Spec": {
"prefix": "create nala spec",
"body": [
"module.exports = {",
" FeatureName: '${1:Block or Feature Name}',",
" features: [",
" {",
" tcid: '0',",
" name: '@${2:spec-name}',",
" path: '/drafts/nala/[${3:test-page-path}]',",
" data: {",
" attribute-1: '${4:value}',",
" attribute-2: '${5:value}',",
" attribute-3: '${6:value}',",
" },",
" tags: '@Block @smoke @regression @dme',",
" },",
" ],",
"};"
],
"description": "Create a Nala spec with block name or feature name"
}
}

19 changes: 19 additions & 0 deletions nala/libs/baseurl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-disable */
import pkg from 'axios';

const { head } = pkg;
export async function isBranchURLValid(url) {
try {
const response = await head(url);
if (response.status === 200) {
console.info(`\nURL (${url}) returned a 200 status code. It is valid.`);
return true;
} else {
console.info(`\nURL (${url}) returned a non-200 status code (${response.status}). It is invalid.`);
return false;
}
} catch (error) {
console.info(`\nError checking URL (${url}): returned a non-200 status code (${response.status})`);
return false;
}
}
31 changes: 31 additions & 0 deletions nala/libs/imslogin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint-disable import/no-import-module-exports */
import { expect } from '@playwright/test';

async function fillOutSignInForm(props, page) {
expect(process.env.IMS_EMAIL, 'ERROR: No environment variable for email provided for IMS Test.').toBeTruthy();
expect(process.env.IMS_PASS, 'ERROR: No environment variable for password provided for IMS Test.').toBeTruthy();

await expect(page).toHaveTitle(/Adobe ID/);
let heading = await page.locator('.spectrum-Heading1').first().innerText();
expect(heading).toBe('Sign in');

// Fill out Sign-in Form
await expect(async () => {
await page.locator('#EmailPage-EmailField').fill(process.env.IMS_EMAIL);
await page.locator('[data-id=EmailPage-ContinueButton]').click();
await expect(page.locator('text=Reset your password')).toBeVisible({ timeout: 45000 }); // Timeout accounting for how long IMS Login page takes to switch form
}).toPass({
intervals: [1_000],
timeout: 10_000,
});

heading = await page.locator('.spectrum-Heading1', { hasText: 'Enter your password' }).first().innerText();
expect(heading).toBe('Enter your password');
await page.locator('#PasswordPage-PasswordField').fill(process.env.IMS_PASS);
await page.locator('[data-id=PasswordPage-ContinueButton]').click();
await page.locator('div.ActionList-Item:nth-child(1)').click();
await page.waitForURL(`${props.url}#`);
await expect(page).toHaveURL(`${props.url}#`);
}

export default { fillOutSignInForm };
Loading

0 comments on commit c13e2be

Please sign in to comment.